SlideShare a Scribd company logo
Return Oriented Programming  (ROP) Based Exploits  - Part I
Return Oriented Programming  (ROP) Based Exploits  - Part I
Exploit - ex·ploitto use selfishly for one's own ends
Exploit DiscoveryBig space in computer security Exploits are discovered by Security Researchers and Hackers alikeZero day attacks are a result of newly created exploits or un-patched vulnerabilities
Exploit MitigationWindows XP Sp2 was the first widespread OS to incorporate exploit mitigationProtected stack metadata (Visual studio compiler/ GS flag)Protected heap metadata (RtlHeap Safe Unlinking)SafeSEH (Compile time execution handler registration)Software, Hardware enforced Data Execution Prevention (DEP)Windows Vista implements Address Space Layout Randomization (ASLR)
Break the mitigationBlackHat PresentationsSecurity ForumsBlogs
Whose responsibility is it to mitigate ?Heap ProtectionSEH Chain validationDEPASLRStack CookiesSafe SEH
DEP  - Data Execution PreventionWhen an attempt is made to execute code from a DEP protected data page,an access violation (STATUS_ACCESS_VIOLATION (0xc0000005)) will occur. In most cases, this will result in process termination (unhandled exception).
DEP  - Data Execution PreventionWithout DEP OnWith DEP On
ProblemWith DEP on, code from the stack won’t work
Work-AroundWe need to build a chain of instructions.  We need to jump from one part of the chain to the other part of the chain without ever executing a single bit from our DEP protected region.  Or, to use a better term, we need to return from one instruction to the address of the next instructionEach instruction (series of instructions) in our chain will be called a "gadget".  Each gadget will return to the next gadget ( = to the address of the next gadget, placed on the stack), or will call the next address directly.We will need to use existing instructions (instructions in executable areas within the process)and put them in such an order (and "chain" them together) so they would produce what we need and put data in registers and/or on the stack
LetterThe chocolate bombs you sent, bombs they are in size . Received them, yesterday. Planted the rose plant, bomb was delicious … had to mention again. Set to go for shopping, 5 p.m. tomorrow. The chocolate bombs you sent, bombs they are in size . Received them, yesterday. Planted the rose plant, bomb was delicious … had to mention again. Set to go for shopping, 5 p.m. tomorrow. ThebombsReceivedyesterday PlantedbombSet5 p.m. tomorrow
Don’t sleep yet
GadgetWe need to take a value from the stack, put it in EAX, and increase it with 0×80
GadgetWe need to take a value from the stack, put it in EAX, and increase it with 0×80-- - - - - - - - -- -- - - -  - --- -  - -- -- - - - - - - - -- -- - - -  - --- -  - -- -- - - - - - - - -- -- - - -  - --- -  - -- WindowsFunction_1()ADD EBX, 30TEST AL, ALPOP EAXRETPOP EAXRETADD EAX, 80POP EBXRET-- - - - - - - - -- -- - - -  - --- -  - -- -- - - - - - - - -- -- - - -  - --- -  - -- -- - - - - - - - -- -- - - -  - --- -  - -- WindowsFunction_2()INC EAXADD EAX, 80POP EBXRET-- - - - - - - - -- -- - - -  - --- -  - -- -- - - - - - - - -- -- - - -  - --- -  - -- -- - - - - - - - -- -- - - -  - --- -  - --
Gadget		  Stack address 	Stack value ESP points here -> 	  0010F730 		10026D56 (pointer to POP EAX + RET)   		  0010F734                           50505050 (this will be popped into EAX)   		  0010F738 		1002DC24 (pointer to ADD EAX,80  + POP EBX + RET)   		  0010F73C 		DEADBEEF (this will be popped into EBX, padding)
Windows Function Calls to bypass DEPVirtualAlloc(MEM_COMMIT + PAGE_READWRITE_EXECUTE) + copy memory.  This will allow you to create a new executable memory region, copy your shellcode to it, and execute itHeapCreate(HEAP_CREATE_ENABLE_EXECUTE) + HeapAlloc() + copy memory. SetProcessDEPPolicy()NtSetInformationProcess()VirtualProtect(PAGE_READ_WRITE_EXECUTE). This function will change the access protection level of a given memory page, allowing you to mark the location where your shellcode resides as executable.WriteProcessMemory()
Windows Function Calls to bypass DEPEach one of those functions requires the stack or registers to be set up in a specific way.when an API is called, it will assume that the parameters to the function are placed at the top of the stack (= at ESP)
How to chainDemo
Finding ROP gadgetsThere are 2 approaches to finding gadgets that will help you building the ROP chain :    You can specifically search for instructions and see if they are followed by a RET.      The instructions between the one you are looking for, and the RET instruction (which will     end the gadget) should not break the gadget.     You can look for all RET instructions and then walk back, see if the previous instructions     include the instruction you are looking for. pvefindaddr
First part of the ExploitTesting ROP with a Windows APIVirtualProtect()Demo
Now you can sleep 
Thank You
Imageshttp://s280.photobucket.com/albums/kk176/sabbath_X/?action=view&current=Pumpkin_ Grin_lll_by_midnightINK.jpg&newest=1http://www.indiamike.com/india/attachments/7595d1210760693-what-the-strange-questions-for-india-experts-chilli-and-lemon.jpghttp://www.animevice.com/profile/kao/all-images/84-142612/albert_wesker___reside nt_evil_by_megakay/83-203102/http://la-vie-bohem.deviantart.com/art/Yawn-115528201?q=boost%3Apopular+yawn+baby&qo=32http://SillyScreamingQueen.deviantart.com/art/Sleepy-54882830?q=boost%3Apopular+sleepy&qo=6

More Related Content

What's hot (20)

TXT
Exploit techniques - a quick review
Ce.Se.N.A. Security
 
TXT
Mona cheatsheet
Ce.Se.N.A. Security
 
PDF
[2012 CodeEngn Conference 06] pwn3r - Secuinside 2012 CTF 예선 문제풀이
Code Engn
 
PDF
One Shellcode to Rule Them All: Cross-Platform Exploitation
Quinn Wilton
 
PPT
Virtual platform
sean chen
 
PPTX
NTUSTxTDOH 資訊安全基礎工作坊 基礎逆向教育訓練
Sheng-Hao Ma
 
PDF
I/O, You Own: Regaining Control of Your Disk in the Presence of Bootkits
CrowdStrike
 
PDF
Qemu JIT Code Generator and System Emulation
National Cheng Kung University
 
PPTX
Exploit Research and Development Megaprimer: DEP Bypassing with ROP Chains
Ajin Abraham
 
PDF
[嵌入式系統] MCS-51 實驗 - 使用 IAR (2)
Simen Li
 
PDF
2021.laravelconf.tw.slides2
LiviaLiaoFontech
 
PPTX
Software to the slaughter
Quinn Wilton
 
PDF
from Binary to Binary: How Qemu Works
Zhen Wei
 
PDF
Specializing the Data Path - Hooking into the Linux Network Stack
Kernel TLV
 
PDF
Interpreter, Compiler, JIT from scratch
National Cheng Kung University
 
ODP
Runtime Symbol Resolution
Ken Kawamoto
 
PPT
Unit 5
siddr
 
PDF
No instrumentation Golang Logging with eBPF (GoSF talk 11/11/20)
Pixie Labs
 
PDF
PHP 7 OPCache extension review
julien pauli
 
PPTX
Exploit Research and Development Megaprimer: Unicode Based Exploit Development
Ajin Abraham
 
Exploit techniques - a quick review
Ce.Se.N.A. Security
 
Mona cheatsheet
Ce.Se.N.A. Security
 
[2012 CodeEngn Conference 06] pwn3r - Secuinside 2012 CTF 예선 문제풀이
Code Engn
 
One Shellcode to Rule Them All: Cross-Platform Exploitation
Quinn Wilton
 
Virtual platform
sean chen
 
NTUSTxTDOH 資訊安全基礎工作坊 基礎逆向教育訓練
Sheng-Hao Ma
 
I/O, You Own: Regaining Control of Your Disk in the Presence of Bootkits
CrowdStrike
 
Qemu JIT Code Generator and System Emulation
National Cheng Kung University
 
Exploit Research and Development Megaprimer: DEP Bypassing with ROP Chains
Ajin Abraham
 
[嵌入式系統] MCS-51 實驗 - 使用 IAR (2)
Simen Li
 
2021.laravelconf.tw.slides2
LiviaLiaoFontech
 
Software to the slaughter
Quinn Wilton
 
from Binary to Binary: How Qemu Works
Zhen Wei
 
Specializing the Data Path - Hooking into the Linux Network Stack
Kernel TLV
 
Interpreter, Compiler, JIT from scratch
National Cheng Kung University
 
Runtime Symbol Resolution
Ken Kawamoto
 
Unit 5
siddr
 
No instrumentation Golang Logging with eBPF (GoSF talk 11/11/20)
Pixie Labs
 
PHP 7 OPCache extension review
julien pauli
 
Exploit Research and Development Megaprimer: Unicode Based Exploit Development
Ajin Abraham
 

Viewers also liked (6)

PDF
Advanced exploit development
Dan H
 
PDF
Return-Oriented Programming: Exploits Without Code Injection
guest9f4856
 
PDF
Sintsov advanced exploitation in win32
DefconRussia
 
PDF
Advanced Exploit Development (Updated on 28 January, 2016)
Dan H
 
PDF
IOT Exploitation
Cysinfo Cyber Security Community
 
PDF
Linux Exploit Research
Dan H
 
Advanced exploit development
Dan H
 
Return-Oriented Programming: Exploits Without Code Injection
guest9f4856
 
Sintsov advanced exploitation in win32
DefconRussia
 
Advanced Exploit Development (Updated on 28 January, 2016)
Dan H
 
Linux Exploit Research
Dan H
 
Ad

Similar to Return Oriented Programming (ROP) Based Exploits - Part I (20)

PPT
[CCC-28c3] Post Memory Corruption Memory Analysis
Moabi.com
 
PDF
CyberLink LabelPrint 2.5 Exploitation Process
Thomas Gregory
 
PPT
Writing Metasploit Plugins
amiable_indian
 
KEY
Post Exploitation Bliss: Loading Meterpreter on a Factory iPhone, Black Hat U...
Vincenzo Iozzo
 
PDF
Heap overflows for humans – 101
Craft Symbol
 
PDF
[HITB Malaysia 2011] Exploit Automation
Moabi.com
 
PDF
[Kiwicon 2011] Post Memory Corruption Memory Analysis
Moabi.com
 
PDF
[Ruxcon 2011] Post Memory Corruption Memory Analysis
Moabi.com
 
PDF
Unix executable buffer overflow
Ammarit Thongthua ,CISSP CISM GXPN CSSLP CCNP
 
PPTX
Taking advantage of the Amazon Web Services (AWS) Family
Ben Hall
 
PDF
Penetration Testing for Easy RM to MP3 Converter Application and Post Exploit
JongWon Kim
 
PPTX
Computer Science Assignment Help
Programming Homework Help
 
PPTX
Playing With (B)Sqli
Chema Alonso
 
PPTX
Exploit Development: EzServer Buffer Overflow oleh Tom Gregory
zakiakhmad
 
PPTX
Exploit Development with Python
Thomas Gregory
 
PDF
Low Level Exploits
hughpearse
 
PDF
Buffer Overflow - Smashing the Stack
ironSource
 
PDF
SEH overwrite and its exploitability
FFRI, Inc.
 
ODP
Code Red Security
Amr Ali
 
PDF
ruby2600 - an Atari 2600 emulator written in Ruby
Carlos Duarte do Nascimento
 
[CCC-28c3] Post Memory Corruption Memory Analysis
Moabi.com
 
CyberLink LabelPrint 2.5 Exploitation Process
Thomas Gregory
 
Writing Metasploit Plugins
amiable_indian
 
Post Exploitation Bliss: Loading Meterpreter on a Factory iPhone, Black Hat U...
Vincenzo Iozzo
 
Heap overflows for humans – 101
Craft Symbol
 
[HITB Malaysia 2011] Exploit Automation
Moabi.com
 
[Kiwicon 2011] Post Memory Corruption Memory Analysis
Moabi.com
 
[Ruxcon 2011] Post Memory Corruption Memory Analysis
Moabi.com
 
Unix executable buffer overflow
Ammarit Thongthua ,CISSP CISM GXPN CSSLP CCNP
 
Taking advantage of the Amazon Web Services (AWS) Family
Ben Hall
 
Penetration Testing for Easy RM to MP3 Converter Application and Post Exploit
JongWon Kim
 
Computer Science Assignment Help
Programming Homework Help
 
Playing With (B)Sqli
Chema Alonso
 
Exploit Development: EzServer Buffer Overflow oleh Tom Gregory
zakiakhmad
 
Exploit Development with Python
Thomas Gregory
 
Low Level Exploits
hughpearse
 
Buffer Overflow - Smashing the Stack
ironSource
 
SEH overwrite and its exploitability
FFRI, Inc.
 
Code Red Security
Amr Ali
 
ruby2600 - an Atari 2600 emulator written in Ruby
Carlos Duarte do Nascimento
 
Ad

More from n|u - The Open Security Community (20)

PDF
Hardware security testing 101 (Null - Delhi Chapter)
n|u - The Open Security Community
 
PPTX
SSRF exploit the trust relationship
n|u - The Open Security Community
 
PDF
Metasploit primary
n|u - The Open Security Community
 
PDF
Api security-testing
n|u - The Open Security Community
 
PDF
Introduction to TLS 1.3
n|u - The Open Security Community
 
PDF
Gibson 101 -quick_introduction_to_hacking_mainframes_in_2020_null_infosec_gir...
n|u - The Open Security Community
 
PDF
Talking About SSRF,CRLF
n|u - The Open Security Community
 
PPTX
Building active directory lab for red teaming
n|u - The Open Security Community
 
PPTX
Owning a company through their logs
n|u - The Open Security Community
 
PPTX
Introduction to shodan
n|u - The Open Security Community
 
PDF
Detecting persistence in windows
n|u - The Open Security Community
 
PPTX
Frida - Objection Tool Usage
n|u - The Open Security Community
 
PDF
OSQuery - Monitoring System Process
n|u - The Open Security Community
 
PDF
DevSecOps Jenkins Pipeline -Security
n|u - The Open Security Community
 
PDF
Extensible markup language attacks
n|u - The Open Security Community
 
PPTX
Linux for hackers
n|u - The Open Security Community
 
PDF
Android Pentesting
n|u - The Open Security Community
 
Hardware security testing 101 (Null - Delhi Chapter)
n|u - The Open Security Community
 
SSRF exploit the trust relationship
n|u - The Open Security Community
 
Api security-testing
n|u - The Open Security Community
 
Introduction to TLS 1.3
n|u - The Open Security Community
 
Gibson 101 -quick_introduction_to_hacking_mainframes_in_2020_null_infosec_gir...
n|u - The Open Security Community
 
Talking About SSRF,CRLF
n|u - The Open Security Community
 
Building active directory lab for red teaming
n|u - The Open Security Community
 
Owning a company through their logs
n|u - The Open Security Community
 
Introduction to shodan
n|u - The Open Security Community
 
Detecting persistence in windows
n|u - The Open Security Community
 
Frida - Objection Tool Usage
n|u - The Open Security Community
 
OSQuery - Monitoring System Process
n|u - The Open Security Community
 
DevSecOps Jenkins Pipeline -Security
n|u - The Open Security Community
 
Extensible markup language attacks
n|u - The Open Security Community
 

Recently uploaded (20)

PDF
July Patch Tuesday
Ivanti
 
PDF
How Startups Are Growing Faster with App Developers in Australia.pdf
India App Developer
 
PPTX
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
PDF
Exolore The Essential AI Tools in 2025.pdf
Srinivasan M
 
PDF
POV_ Why Enterprises Need to Find Value in ZERO.pdf
darshakparmar
 
PDF
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 
PPTX
WooCommerce Workshop: Bring Your Laptop
Laura Hartwig
 
PPTX
COMPARISON OF RASTER ANALYSIS TOOLS OF QGIS AND ARCGIS
Sharanya Sarkar
 
PDF
Jak MŚP w Europie Środkowo-Wschodniej odnajdują się w świecie AI
dominikamizerska1
 
PDF
Empower Inclusion Through Accessible Java Applications
Ana-Maria Mihalceanu
 
PDF
Transcript: New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
PDF
HCIP-Data Center Facility Deployment V2.0 Training Material (Without Remarks ...
mcastillo49
 
PPTX
AUTOMATION AND ROBOTICS IN PHARMA INDUSTRY.pptx
sameeraaabegumm
 
PDF
From Code to Challenge: Crafting Skill-Based Games That Engage and Reward
aiyshauae
 
PDF
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
PDF
CIFDAQ Weekly Market Wrap for 11th July 2025
CIFDAQ
 
PDF
Fl Studio 24.2.2 Build 4597 Crack for Windows Free Download 2025
faizk77g
 
PDF
Achieving Consistent and Reliable AI Code Generation - Medusa AI
medusaaico
 
PDF
Smart Trailers 2025 Update with History and Overview
Paul Menig
 
PDF
Mastering Financial Management in Direct Selling
Epixel MLM Software
 
July Patch Tuesday
Ivanti
 
How Startups Are Growing Faster with App Developers in Australia.pdf
India App Developer
 
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
Exolore The Essential AI Tools in 2025.pdf
Srinivasan M
 
POV_ Why Enterprises Need to Find Value in ZERO.pdf
darshakparmar
 
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 
WooCommerce Workshop: Bring Your Laptop
Laura Hartwig
 
COMPARISON OF RASTER ANALYSIS TOOLS OF QGIS AND ARCGIS
Sharanya Sarkar
 
Jak MŚP w Europie Środkowo-Wschodniej odnajdują się w świecie AI
dominikamizerska1
 
Empower Inclusion Through Accessible Java Applications
Ana-Maria Mihalceanu
 
Transcript: New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
HCIP-Data Center Facility Deployment V2.0 Training Material (Without Remarks ...
mcastillo49
 
AUTOMATION AND ROBOTICS IN PHARMA INDUSTRY.pptx
sameeraaabegumm
 
From Code to Challenge: Crafting Skill-Based Games That Engage and Reward
aiyshauae
 
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
CIFDAQ Weekly Market Wrap for 11th July 2025
CIFDAQ
 
Fl Studio 24.2.2 Build 4597 Crack for Windows Free Download 2025
faizk77g
 
Achieving Consistent and Reliable AI Code Generation - Medusa AI
medusaaico
 
Smart Trailers 2025 Update with History and Overview
Paul Menig
 
Mastering Financial Management in Direct Selling
Epixel MLM Software
 

Return Oriented Programming (ROP) Based Exploits - Part I