SlideShare ist ein Scribd-Unternehmen logo
1 von 31
Downloaden Sie, um offline zu lesen
www.SecurityXploded.com
Disclaimer
The Content, Demonstration, Source Code and Programs presented here is "AS IS"
without any warranty or conditions of any kind. Also the views/ideas/knowledge
expressed here are solely of the trainer’s only and nothing to do with the company or
the organization in which the trainer is currently working.
However in no circumstances neither the trainer nor SecurityXploded is responsible for
any damage or loss caused due to use or misuse of the information presented here.
www.SecurityXploded.com
Acknowledgement
 Special thanks to Null & Garage4Hackers community for their extended support and
cooperation.
 Thanks to all the Trainers who have devoted their precious time and countless hours to
make it happen.
 Thanks to ThoughtWorks for the beautiful and bigger venue.
www.SecurityXploded.com
Reversing & Malware Analysis Training
This presentation is a part of our Reverse Engineering & Malware Analysis training
program. Currently it is delivered only during our local meet for FREE of cost.
For complete details of this course, visit our Security Training page.
www.SecurityXploded.com
Who am I #1
Amit Malik (sometimes DouBle_Zer0,DZZ)
 Member SecurityXploded
 Security Researcher @ McAfee Labs
 RE, Exploit Analysis/Development, Malware Analysis
 Email: m.amit30@gmail.com
www.SecurityXploded.com
Course Q&A
 Keep yourself up to date with latest security news
 http://www.securityphresh.com
 For Q&A, join our mailing list.
 http://groups.google.com/group/securityxploded
www.SecurityXploded.com
Agenda
 The material in this presentation is a bit complicated so I will be
using the zig-zag approach.
 Recap
 Protections (GS and SAFESEH)
 Client side exploits and Heap Spray
 Protections (DEP)
 Protections (ASLR)
 If time permits then few words on the following:
 Heap buffer overflows
www.SecurityXploded.com
Recap
 In previous session we covered:
 Stack based buffer overflow
○ EIPoverwrite (saved return address)
○ SEH Overwrite
 We also discussed “why we need pop pop ret or other similar
instruction in SEH overflow”
 Now Question: Which one is more reliable or considered to be more
reliable in terms of exploitation ?
 Consider we have overwritten EIP and SEH successfully.
www.SecurityXploded.com
Protections Enforced by OS and
Processor
ASLR
DEP
GS Cookies SAFESEH
SEHOP
Forced ASLR
www.SecurityXploded.com
*Safe unlinking, Heap cookies etc. are also protection methods added into the OS.
Protections for stack based buffer overflow
(Primary)
 Fortunately or Unfortunately both protection schemes are based on
compiler/Linker options.
 * SEHOP is a different protectionscheme based on run time SEH chain validation,It is not based on compiler options
however can be enabled or disabledthrough registry.
GS Cookie
EIP Overwrite ?
SafeSEH (SEHop*)
SEH Overwrite ?
www.SecurityXploded.com
GS Cookie (/GS)
 Put some random value (cookie – 32 bit) on stack before
return address.
 While returning, compare the value of saved cookie, if not
same then we have an overwrite.
 Generate “ Security Exception (if any)”, terminate the
Application.
www.SecurityXploded.com
/GS Cookie Cont...
Function Start:
Function end:
Cookie check function (see “function
end” in below picture.)
www.SecurityXploded.com
/GS Cookie Bypass
 Generate exception before cookie check
 Code dependent – if some overwritten variables are used before
function return.
 Overwrite stack up to the end, further overwrite will generate
exception
 Back to the question which exploitation (EIP or SEH) is more
reliable ?
 SEH method is considered to be a bit more safe and reliable regardless
of this bypassing technique.
www.SecurityXploded.com
/GS Cookie Bypass Cont..
Leverage the implementation. Did you see something ?
www.SecurityXploded.com
SafeSEH
 Compiler [Linker] /SAFESEH option
 Static list of known good exception handlers for the binary.
 Checks every time when a handler is called against the static list, if not in the list
then handler is invalid and takes preventive measures.
 Load configuration directory stores meta information about safe exception
handlers.
 If any module is not compiled with /SAFESEH then no check is done to ensure
the integrity of the handler for that module.
www.SecurityXploded.com
/SAFESEH Bypassing
 If any loaded module in the vulnerable binary is not /SAFESEH compiled then no
check is done to ensure the integrity of the handler for that module, so we can use
any p/p/r address from that module.
 Use the address that is outside the address range of loaded modules.
 Importance of forward and backward jump.
nseh
seh
payload
payload
nseh
seh
Forward jump Backward
jump
www.SecurityXploded.com
DEP (Data Execution Prevention)
 Two types:
 Software DEP (forget it)
 Hardware DEP (NX/XD enabled processors) – we will be talking
about it in the rest of the session.
 We can’t execute the code from non executable area
anymore.
 We are directly dealing with processer in this case.
www.SecurityXploded.com
DEP (HW) Bypass
 ROP (Return Oriented Programming)
 Use the system/existing code
 How stack works ?
 Main theme
 Either make non executable area executable
 Or allocate new area with executable permissions
 How ?
○ Well, use ROP 
www.SecurityXploded.com
Stack Heap Flipping (Stack Pivoting)
 I think this deservea dedicated slide
 Dependingon the conditionswemay have largeROP payload whilespaceon stack
may be less or may be our entirepayload is on heap.
 Flip the heap on to the stack so that we can get larger room.
 InstructionslikeXCHG ESP[REG], REG[ESP]can be used.
 We can also jump insidethevalid instructionsto changetheir meaning.
 Example:jump onebyte inside“setzal” instruction( FromAdobeU3D exploitin
wild)
www.SecurityXploded.com
DEP (HW) Bypass (DEMO)
 Methods
 HeapCreate
 VirtualAlloc
 VirtualProtect
 WriteProcessMemory (DEMO – simple, easy, demonstrate the entire
concept – XpSp3)
 Often times the small code chunks in ROP are termed as
“gadgets”
www.SecurityXploded.com
DEP (HW) Bypass (DEMO)
http://vimeo.com/49069964
www.SecurityXploded.com
ASLR
 Address Space Layout Randomization
 Involves randomly positioning the memory areas like base
address of the binary, position of stack and heap.
 Compiler[linker] /DYNAMICBASE option
www.SecurityXploded.com
ASLR Bypass
 Search for Non-ASLR loaded libraries in the vulnerable
application or if possible load one. 
 JRE ?
 Memory leaks
 Brute force
 Heavily depends on vulnerability conditions
www.SecurityXploded.com
Client Side Exploits
 Exploits that targets client applications like browsers,
plugins, media players, readers etc.
 Much more dangerous then any other form of exploits
 Huge impact and landscape
 Provides solid infection vector
 Big malicious infrastructure.
 Botnets, DDOS, Spam etc.
www.SecurityXploded.com
Heap Spray
 A technique used in client side exploits
 IT’S NOT A VULNERABILITY or CLASS OF VUL.
 It’s a technique used for code execution.
 Think about the followings again:
 EIP overwrite
 SEH overwrite
• What we used in the above and why we used that ?
 Heap spray provides very simple method for code execution.
www.SecurityXploded.com
Heap Spray Cont...
 Fortunatelyor unfortunatelyclient sidescripting languageslike javascript, vbscriptetc.
provides methodsto allocateand deallocate memory on the client.
 Which means we can make invalid memory addressesvalid.
Valid address invalid address range
(allocated area)
0x200... 0x400.. 0x500..
Valid address invalid address range
(allocated area)
0x200... 0x300.. 0x500..
Before Allocation
After Allocation
(0x300.. To 0x400.. Is
valid now)
www.SecurityXploded.com
Heap Spray Cont..
 Allocate memory and fill with nop + shellcode
 Overwrite the EIP or SEH with any address within the newly
allocated area (the nop region).
 Here EIP overwrite or SEH overwrite can be by any means.
 Stack buffer overflow, Heap buffer overflow, memory corruption, use
after free etc..
www.SecurityXploded.com
Heap Spray (DEMO – IEPeers
Vulnerability (IE6, IE7)
www.SecurityXploded.com
http://vimeo.com/49070337
Heap Spray (Stability Comments)
 Use intelligent guesses
 Stability depends on the exploitation conditions
 Fragmented heap, choose little higher addresses.
 Large number of allocations, choose little lower addresses 
www.SecurityXploded.com
Reference
 Complete Reference Guide for Reversing & Malware Analysis Training
www.SecurityXploded.com
Thank You !
www.SecurityXploded.com

Weitere ähnliche Inhalte

Andere mochten auch

Reversing & malware analysis training part 8 malware memory forensics
Reversing & malware analysis training part 8   malware memory forensicsReversing & malware analysis training part 8   malware memory forensics
Reversing & malware analysis training part 8 malware memory forensicsAbdulrahman Bassam
 
Reversing & malware analysis training part 7 unpacking upx
Reversing & malware analysis training part 7   unpacking upxReversing & malware analysis training part 7   unpacking upx
Reversing & malware analysis training part 7 unpacking upxAbdulrahman Bassam
 
Reversing & malware analysis training part 6 practical reversing (i)
Reversing & malware analysis training part 6   practical reversing (i)Reversing & malware analysis training part 6   practical reversing (i)
Reversing & malware analysis training part 6 practical reversing (i)Abdulrahman Bassam
 
SEH overwrite and its exploitability
SEH overwrite and its exploitabilitySEH overwrite and its exploitability
SEH overwrite and its exploitabilityFFRI, Inc.
 
YEAR 5 TEACHER'S RESOURCE BOOK
YEAR 5 TEACHER'S RESOURCE BOOKYEAR 5 TEACHER'S RESOURCE BOOK
YEAR 5 TEACHER'S RESOURCE BOOKNani Hanani
 
Reversing & malware analysis training part 9 advanced malware analysis
Reversing & malware analysis training part 9   advanced malware analysisReversing & malware analysis training part 9   advanced malware analysis
Reversing & malware analysis training part 9 advanced malware analysisAbdulrahman Bassam
 

Andere mochten auch (6)

Reversing & malware analysis training part 8 malware memory forensics
Reversing & malware analysis training part 8   malware memory forensicsReversing & malware analysis training part 8   malware memory forensics
Reversing & malware analysis training part 8 malware memory forensics
 
Reversing & malware analysis training part 7 unpacking upx
Reversing & malware analysis training part 7   unpacking upxReversing & malware analysis training part 7   unpacking upx
Reversing & malware analysis training part 7 unpacking upx
 
Reversing & malware analysis training part 6 practical reversing (i)
Reversing & malware analysis training part 6   practical reversing (i)Reversing & malware analysis training part 6   practical reversing (i)
Reversing & malware analysis training part 6 practical reversing (i)
 
SEH overwrite and its exploitability
SEH overwrite and its exploitabilitySEH overwrite and its exploitability
SEH overwrite and its exploitability
 
YEAR 5 TEACHER'S RESOURCE BOOK
YEAR 5 TEACHER'S RESOURCE BOOKYEAR 5 TEACHER'S RESOURCE BOOK
YEAR 5 TEACHER'S RESOURCE BOOK
 
Reversing & malware analysis training part 9 advanced malware analysis
Reversing & malware analysis training part 9   advanced malware analysisReversing & malware analysis training part 9   advanced malware analysis
Reversing & malware analysis training part 9 advanced malware analysis
 

Ähnlich wie Reversing & malware analysis training part 11 exploit development advanced

Reversing & Malware Analysis Training Part 11 - Exploit Development [Advanced]
Reversing & Malware Analysis Training Part 11 - Exploit Development [Advanced]Reversing & Malware Analysis Training Part 11 - Exploit Development [Advanced]
Reversing & Malware Analysis Training Part 11 - Exploit Development [Advanced]securityxploded
 
Reversing malware analysis training part11 exploit development advanced
Reversing malware analysis training part11 exploit development advancedReversing malware analysis training part11 exploit development advanced
Reversing malware analysis training part11 exploit development advancedCysinfo Cyber Security Community
 
Advanced Malware Analysis Training Session 2 - Botnet Analysis Part 1
Advanced Malware Analysis Training Session 2 - Botnet Analysis Part 1  Advanced Malware Analysis Training Session 2 - Botnet Analysis Part 1
Advanced Malware Analysis Training Session 2 - Botnet Analysis Part 1 securityxploded
 
Reversing & malware analysis training part 1 lab setup guide
Reversing & malware analysis training part 1   lab setup guideReversing & malware analysis training part 1   lab setup guide
Reversing & malware analysis training part 1 lab setup guideAbdulrahman Bassam
 
Reversing & malware analysis training part 2 introduction to windows internals
Reversing & malware analysis training part 2   introduction to windows internalsReversing & malware analysis training part 2   introduction to windows internals
Reversing & malware analysis training part 2 introduction to windows internalsAbdulrahman Bassam
 
Reversing & malware analysis training part 1 lab setup guide
Reversing & malware analysis training part 1   lab setup guideReversing & malware analysis training part 1   lab setup guide
Reversing & malware analysis training part 1 lab setup guidesecurityxploded
 
Advanced malwareanalysis training session2 botnet analysis part1
Advanced malwareanalysis training session2 botnet analysis part1Advanced malwareanalysis training session2 botnet analysis part1
Advanced malwareanalysis training session2 botnet analysis part1Cysinfo Cyber Security Community
 
Reversing & malware analysis training part 10 exploit development basics
Reversing & malware analysis training part 10   exploit development basicsReversing & malware analysis training part 10   exploit development basics
Reversing & malware analysis training part 10 exploit development basicsAbdulrahman Bassam
 
The Dev, Sec and Ops of API Security - API World
The Dev, Sec and Ops of API Security - API WorldThe Dev, Sec and Ops of API Security - API World
The Dev, Sec and Ops of API Security - API World42Crunch
 
Dont run with scissors
Dont run with scissorsDont run with scissors
Dont run with scissorsMorgan Roman
 
AppSec California 2016 - Making Security Agile
AppSec California 2016 - Making Security AgileAppSec California 2016 - Making Security Agile
AppSec California 2016 - Making Security AgileOleg Gryb
 
Reversing & malware analysis training part 4 assembly programming basics
Reversing & malware analysis training part 4   assembly programming basics Reversing & malware analysis training part 4   assembly programming basics
Reversing & malware analysis training part 4 assembly programming basics Abdulrahman Bassam
 
System Hardening Using Ansible
System Hardening Using AnsibleSystem Hardening Using Ansible
System Hardening Using AnsibleSonatype
 
Shift Left Security
Shift Left SecurityShift Left Security
Shift Left Securitygjdevos
 
[Wroclaw #9] The purge - dealing with secrets in Opera Software
[Wroclaw #9] The purge - dealing with secrets in Opera Software[Wroclaw #9] The purge - dealing with secrets in Opera Software
[Wroclaw #9] The purge - dealing with secrets in Opera SoftwareOWASP
 
#nullblr bachav manual source code review
#nullblr bachav manual source code review#nullblr bachav manual source code review
#nullblr bachav manual source code reviewSantosh Gulivindala
 
Automated Scaling of Microservice Stacks for JavaEE Applications
Automated Scaling of Microservice Stacks for JavaEE ApplicationsAutomated Scaling of Microservice Stacks for JavaEE Applications
Automated Scaling of Microservice Stacks for JavaEE ApplicationsJelastic Multi-Cloud PaaS
 
PVS-Studio: analyzing ReactOS's code
PVS-Studio: analyzing ReactOS's codePVS-Studio: analyzing ReactOS's code
PVS-Studio: analyzing ReactOS's codePVS-Studio
 

Ähnlich wie Reversing & malware analysis training part 11 exploit development advanced (20)

Reversing & Malware Analysis Training Part 11 - Exploit Development [Advanced]
Reversing & Malware Analysis Training Part 11 - Exploit Development [Advanced]Reversing & Malware Analysis Training Part 11 - Exploit Development [Advanced]
Reversing & Malware Analysis Training Part 11 - Exploit Development [Advanced]
 
Reversing malware analysis training part11 exploit development advanced
Reversing malware analysis training part11 exploit development advancedReversing malware analysis training part11 exploit development advanced
Reversing malware analysis training part11 exploit development advanced
 
Advanced Malware Analysis Training Session 2 - Botnet Analysis Part 1
Advanced Malware Analysis Training Session 2 - Botnet Analysis Part 1  Advanced Malware Analysis Training Session 2 - Botnet Analysis Part 1
Advanced Malware Analysis Training Session 2 - Botnet Analysis Part 1
 
Reversing & malware analysis training part 1 lab setup guide
Reversing & malware analysis training part 1   lab setup guideReversing & malware analysis training part 1   lab setup guide
Reversing & malware analysis training part 1 lab setup guide
 
Reversing & malware analysis training part 2 introduction to windows internals
Reversing & malware analysis training part 2   introduction to windows internalsReversing & malware analysis training part 2   introduction to windows internals
Reversing & malware analysis training part 2 introduction to windows internals
 
Reversing & malware analysis training part 1 lab setup guide
Reversing & malware analysis training part 1   lab setup guideReversing & malware analysis training part 1   lab setup guide
Reversing & malware analysis training part 1 lab setup guide
 
Advanced malwareanalysis training session2 botnet analysis part1
Advanced malwareanalysis training session2 botnet analysis part1Advanced malwareanalysis training session2 botnet analysis part1
Advanced malwareanalysis training session2 botnet analysis part1
 
Reversing & malware analysis training part 10 exploit development basics
Reversing & malware analysis training part 10   exploit development basicsReversing & malware analysis training part 10   exploit development basics
Reversing & malware analysis training part 10 exploit development basics
 
The Dev, Sec and Ops of API Security - API World
The Dev, Sec and Ops of API Security - API WorldThe Dev, Sec and Ops of API Security - API World
The Dev, Sec and Ops of API Security - API World
 
Dont run with scissors
Dont run with scissorsDont run with scissors
Dont run with scissors
 
AppSec California 2016 - Making Security Agile
AppSec California 2016 - Making Security AgileAppSec California 2016 - Making Security Agile
AppSec California 2016 - Making Security Agile
 
Bb Tequila Coding Style (Draft)
Bb Tequila Coding Style (Draft)Bb Tequila Coding Style (Draft)
Bb Tequila Coding Style (Draft)
 
Reversing & malware analysis training part 4 assembly programming basics
Reversing & malware analysis training part 4   assembly programming basics Reversing & malware analysis training part 4   assembly programming basics
Reversing & malware analysis training part 4 assembly programming basics
 
System Hardening Using Ansible
System Hardening Using AnsibleSystem Hardening Using Ansible
System Hardening Using Ansible
 
Shift Left Security
Shift Left SecurityShift Left Security
Shift Left Security
 
[Wroclaw #9] The purge - dealing with secrets in Opera Software
[Wroclaw #9] The purge - dealing with secrets in Opera Software[Wroclaw #9] The purge - dealing with secrets in Opera Software
[Wroclaw #9] The purge - dealing with secrets in Opera Software
 
Php
PhpPhp
Php
 
#nullblr bachav manual source code review
#nullblr bachav manual source code review#nullblr bachav manual source code review
#nullblr bachav manual source code review
 
Automated Scaling of Microservice Stacks for JavaEE Applications
Automated Scaling of Microservice Stacks for JavaEE ApplicationsAutomated Scaling of Microservice Stacks for JavaEE Applications
Automated Scaling of Microservice Stacks for JavaEE Applications
 
PVS-Studio: analyzing ReactOS's code
PVS-Studio: analyzing ReactOS's codePVS-Studio: analyzing ReactOS's code
PVS-Studio: analyzing ReactOS's code
 

Kürzlich hochgeladen

What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfPrecisely
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfMounikaPolabathina
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESmohitsingh558521
 

Kürzlich hochgeladen (20)

What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdf
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
 

Reversing & malware analysis training part 11 exploit development advanced

  • 2. Disclaimer The Content, Demonstration, Source Code and Programs presented here is "AS IS" without any warranty or conditions of any kind. Also the views/ideas/knowledge expressed here are solely of the trainer’s only and nothing to do with the company or the organization in which the trainer is currently working. However in no circumstances neither the trainer nor SecurityXploded is responsible for any damage or loss caused due to use or misuse of the information presented here. www.SecurityXploded.com
  • 3. Acknowledgement  Special thanks to Null & Garage4Hackers community for their extended support and cooperation.  Thanks to all the Trainers who have devoted their precious time and countless hours to make it happen.  Thanks to ThoughtWorks for the beautiful and bigger venue. www.SecurityXploded.com
  • 4. Reversing & Malware Analysis Training This presentation is a part of our Reverse Engineering & Malware Analysis training program. Currently it is delivered only during our local meet for FREE of cost. For complete details of this course, visit our Security Training page. www.SecurityXploded.com
  • 5. Who am I #1 Amit Malik (sometimes DouBle_Zer0,DZZ)  Member SecurityXploded  Security Researcher @ McAfee Labs  RE, Exploit Analysis/Development, Malware Analysis  Email: m.amit30@gmail.com www.SecurityXploded.com
  • 6. Course Q&A  Keep yourself up to date with latest security news  http://www.securityphresh.com  For Q&A, join our mailing list.  http://groups.google.com/group/securityxploded www.SecurityXploded.com
  • 7. Agenda  The material in this presentation is a bit complicated so I will be using the zig-zag approach.  Recap  Protections (GS and SAFESEH)  Client side exploits and Heap Spray  Protections (DEP)  Protections (ASLR)  If time permits then few words on the following:  Heap buffer overflows www.SecurityXploded.com
  • 8. Recap  In previous session we covered:  Stack based buffer overflow ○ EIPoverwrite (saved return address) ○ SEH Overwrite  We also discussed “why we need pop pop ret or other similar instruction in SEH overflow”  Now Question: Which one is more reliable or considered to be more reliable in terms of exploitation ?  Consider we have overwritten EIP and SEH successfully. www.SecurityXploded.com
  • 9. Protections Enforced by OS and Processor ASLR DEP GS Cookies SAFESEH SEHOP Forced ASLR www.SecurityXploded.com *Safe unlinking, Heap cookies etc. are also protection methods added into the OS.
  • 10. Protections for stack based buffer overflow (Primary)  Fortunately or Unfortunately both protection schemes are based on compiler/Linker options.  * SEHOP is a different protectionscheme based on run time SEH chain validation,It is not based on compiler options however can be enabled or disabledthrough registry. GS Cookie EIP Overwrite ? SafeSEH (SEHop*) SEH Overwrite ? www.SecurityXploded.com
  • 11. GS Cookie (/GS)  Put some random value (cookie – 32 bit) on stack before return address.  While returning, compare the value of saved cookie, if not same then we have an overwrite.  Generate “ Security Exception (if any)”, terminate the Application. www.SecurityXploded.com
  • 12. /GS Cookie Cont... Function Start: Function end: Cookie check function (see “function end” in below picture.) www.SecurityXploded.com
  • 13. /GS Cookie Bypass  Generate exception before cookie check  Code dependent – if some overwritten variables are used before function return.  Overwrite stack up to the end, further overwrite will generate exception  Back to the question which exploitation (EIP or SEH) is more reliable ?  SEH method is considered to be a bit more safe and reliable regardless of this bypassing technique. www.SecurityXploded.com
  • 14. /GS Cookie Bypass Cont.. Leverage the implementation. Did you see something ? www.SecurityXploded.com
  • 15. SafeSEH  Compiler [Linker] /SAFESEH option  Static list of known good exception handlers for the binary.  Checks every time when a handler is called against the static list, if not in the list then handler is invalid and takes preventive measures.  Load configuration directory stores meta information about safe exception handlers.  If any module is not compiled with /SAFESEH then no check is done to ensure the integrity of the handler for that module. www.SecurityXploded.com
  • 16. /SAFESEH Bypassing  If any loaded module in the vulnerable binary is not /SAFESEH compiled then no check is done to ensure the integrity of the handler for that module, so we can use any p/p/r address from that module.  Use the address that is outside the address range of loaded modules.  Importance of forward and backward jump. nseh seh payload payload nseh seh Forward jump Backward jump www.SecurityXploded.com
  • 17. DEP (Data Execution Prevention)  Two types:  Software DEP (forget it)  Hardware DEP (NX/XD enabled processors) – we will be talking about it in the rest of the session.  We can’t execute the code from non executable area anymore.  We are directly dealing with processer in this case. www.SecurityXploded.com
  • 18. DEP (HW) Bypass  ROP (Return Oriented Programming)  Use the system/existing code  How stack works ?  Main theme  Either make non executable area executable  Or allocate new area with executable permissions  How ? ○ Well, use ROP  www.SecurityXploded.com
  • 19. Stack Heap Flipping (Stack Pivoting)  I think this deservea dedicated slide  Dependingon the conditionswemay have largeROP payload whilespaceon stack may be less or may be our entirepayload is on heap.  Flip the heap on to the stack so that we can get larger room.  InstructionslikeXCHG ESP[REG], REG[ESP]can be used.  We can also jump insidethevalid instructionsto changetheir meaning.  Example:jump onebyte inside“setzal” instruction( FromAdobeU3D exploitin wild) www.SecurityXploded.com
  • 20. DEP (HW) Bypass (DEMO)  Methods  HeapCreate  VirtualAlloc  VirtualProtect  WriteProcessMemory (DEMO – simple, easy, demonstrate the entire concept – XpSp3)  Often times the small code chunks in ROP are termed as “gadgets” www.SecurityXploded.com
  • 21. DEP (HW) Bypass (DEMO) http://vimeo.com/49069964 www.SecurityXploded.com
  • 22. ASLR  Address Space Layout Randomization  Involves randomly positioning the memory areas like base address of the binary, position of stack and heap.  Compiler[linker] /DYNAMICBASE option www.SecurityXploded.com
  • 23. ASLR Bypass  Search for Non-ASLR loaded libraries in the vulnerable application or if possible load one.   JRE ?  Memory leaks  Brute force  Heavily depends on vulnerability conditions www.SecurityXploded.com
  • 24. Client Side Exploits  Exploits that targets client applications like browsers, plugins, media players, readers etc.  Much more dangerous then any other form of exploits  Huge impact and landscape  Provides solid infection vector  Big malicious infrastructure.  Botnets, DDOS, Spam etc. www.SecurityXploded.com
  • 25. Heap Spray  A technique used in client side exploits  IT’S NOT A VULNERABILITY or CLASS OF VUL.  It’s a technique used for code execution.  Think about the followings again:  EIP overwrite  SEH overwrite • What we used in the above and why we used that ?  Heap spray provides very simple method for code execution. www.SecurityXploded.com
  • 26. Heap Spray Cont...  Fortunatelyor unfortunatelyclient sidescripting languageslike javascript, vbscriptetc. provides methodsto allocateand deallocate memory on the client.  Which means we can make invalid memory addressesvalid. Valid address invalid address range (allocated area) 0x200... 0x400.. 0x500.. Valid address invalid address range (allocated area) 0x200... 0x300.. 0x500.. Before Allocation After Allocation (0x300.. To 0x400.. Is valid now) www.SecurityXploded.com
  • 27. Heap Spray Cont..  Allocate memory and fill with nop + shellcode  Overwrite the EIP or SEH with any address within the newly allocated area (the nop region).  Here EIP overwrite or SEH overwrite can be by any means.  Stack buffer overflow, Heap buffer overflow, memory corruption, use after free etc.. www.SecurityXploded.com
  • 28. Heap Spray (DEMO – IEPeers Vulnerability (IE6, IE7) www.SecurityXploded.com http://vimeo.com/49070337
  • 29. Heap Spray (Stability Comments)  Use intelligent guesses  Stability depends on the exploitation conditions  Fragmented heap, choose little higher addresses.  Large number of allocations, choose little lower addresses  www.SecurityXploded.com
  • 30. Reference  Complete Reference Guide for Reversing & Malware Analysis Training www.SecurityXploded.com