SlideShare a Scribd company logo
1 of 24
Return Oriented Programming  (ROP) Based Exploits  - Part I
Exploit - exĀ·ploit to use selfishly for one's own ends
Exploit Discovery Big space in computer security  Exploits are discovered by Security Researchers and Hackers alike Zero day attacks are a result of newly created exploits or un-patched vulnerabilities
Exploit Mitigation Windows XP Sp2 was the first widespread OS to incorporate exploit mitigation Protected 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 mitigation BlackHat Presentations Security Forums Blogs
Whose responsibility is it to mitigate ? Heap Protection SEH Chain validation DEP ASLR Stack Cookies Safe SEH
DEP  - Data Execution Prevention When 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 Prevention Without DEP On With DEP On
Problem With DEP on, code from the stack wonā€™t work
Work-Around We 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 instruction Each 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
Letter 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.  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
Gadget We need to take a value from the stack, put it in EAX, and increase it with 0Ɨ80
Gadget We need to take a value from the stack, put it in EAX, and increase it with 0Ɨ80 -- - - - - - - - -- -- - - -  - --- -  - --  -- - - - - - - - -- -- - - -  - --- -  - --  -- - - - - - - - -- -- - - -  - --- -  - --  WindowsFunction_1() ADD EBX, 30 TEST AL, AL POP EAX RET POP EAX RET ADD EAX, 80 POP EBX RET -- - - - - - - - -- -- - - -  - --- -  - --  -- - - - - - - - -- -- - - -  - --- -  - --  -- - - - - - - - -- -- - - -  - --- -  - --  WindowsFunction_2() INC EAX ADD EAX, 80 POP EBX RET -- - - - - - - - -- -- - - -  - --- -  - --  -- - - - - - - - -- -- - - -  - --- -  - --  -- - - - - - - - -- -- - - -  - --- -  - --
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 DEP VirtualAlloc(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 it HeapCreate(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 DEP Each 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 chain Demo
Finding ROP gadgets There 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 Exploit Testing ROP with a Windows API VirtualProtect() Demo
Now you can sleep ļŠ
Thank You
Images http://s280.photobucket.com/albums/kk176/sabbath_X/?action=view&current=Pumpkin_ Grin_lll_by_midnightINK.jpg&newest=1 http://www.indiamike.com/india/attachments/7595d1210760693-what-the-strange-questions-for-india-experts-chilli-and-lemon.jpg http://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=32 http://SillyScreamingQueen.deviantart.com/art/Sleepy-54882830?q=boost%3Apopular+sleepy&qo=6

More Related Content

What's hot

Exploit techniques - a quick review
Exploit techniques - a quick reviewExploit techniques - a quick review
Exploit techniques - a quick reviewCe.Se.N.A. Security
Ā 
[2012 CodeEngn Conference 06] pwn3r - Secuinside 2012 CTF ģ˜ˆģ„  ė¬øģ œķ’€ģ“
[2012 CodeEngn Conference 06] pwn3r - Secuinside 2012 CTF ģ˜ˆģ„  ė¬øģ œķ’€ģ“[2012 CodeEngn Conference 06] pwn3r - Secuinside 2012 CTF ģ˜ˆģ„  ė¬øģ œķ’€ģ“
[2012 CodeEngn Conference 06] pwn3r - Secuinside 2012 CTF ģ˜ˆģ„  ė¬øģ œķ’€ģ“GangSeok Lee
Ā 
One Shellcode to Rule Them All: Cross-Platform Exploitation
One Shellcode to Rule Them All: Cross-Platform ExploitationOne Shellcode to Rule Them All: Cross-Platform Exploitation
One Shellcode to Rule Them All: Cross-Platform ExploitationQuinn Wilton
Ā 
Virtual platform
Virtual platformVirtual platform
Virtual platformsean chen
Ā 
NTUSTxTDOH č³‡č؊安å…ØåŸŗē¤Žå·„作坊 åŸŗē¤Žé€†å‘ę•™č‚²čؓē·“
NTUSTxTDOH č³‡č؊安å…ØåŸŗē¤Žå·„作坊 åŸŗē¤Žé€†å‘ę•™č‚²čؓē·“NTUSTxTDOH č³‡č؊安å…ØåŸŗē¤Žå·„作坊 åŸŗē¤Žé€†å‘ę•™č‚²čؓē·“
NTUSTxTDOH č³‡č؊安å…ØåŸŗē¤Žå·„作坊 åŸŗē¤Žé€†å‘ę•™č‚²čؓē·“Sheng-Hao Ma
Ā 
I/O, You Own: Regaining Control of Your Disk in the Presence of Bootkits
I/O, You Own: Regaining Control of Your Disk in the Presence of BootkitsI/O, You Own: Regaining Control of Your Disk in the Presence of Bootkits
I/O, You Own: Regaining Control of Your Disk in the Presence of BootkitsCrowdStrike
Ā 
Exploit Research and Development Megaprimer: DEP Bypassing with ROP Chains
Exploit Research and Development Megaprimer: DEP Bypassing with ROP ChainsExploit Research and Development Megaprimer: DEP Bypassing with ROP Chains
Exploit Research and Development Megaprimer: DEP Bypassing with ROP ChainsAjin Abraham
Ā 
[嵌兄式ē³»ēµ±] MCS-51 åƦ驗 - ä½æē”Ø IAR (2)
[嵌兄式ē³»ēµ±] MCS-51 åƦ驗 - ä½æē”Ø IAR (2)[嵌兄式ē³»ēµ±] MCS-51 åƦ驗 - ä½æē”Ø IAR (2)
[嵌兄式ē³»ēµ±] MCS-51 åƦ驗 - ä½æē”Ø IAR (2)Simen Li
Ā 
2021.laravelconf.tw.slides2
2021.laravelconf.tw.slides22021.laravelconf.tw.slides2
2021.laravelconf.tw.slides2LiviaLiaoFontech
Ā 
Software to the slaughter
Software to the slaughterSoftware to the slaughter
Software to the slaughterQuinn Wilton
Ā 
from Binary to Binary: How Qemu Works
from Binary to Binary: How Qemu Worksfrom Binary to Binary: How Qemu Works
from Binary to Binary: How Qemu WorksZhen Wei
Ā 
Specializing the Data Path - Hooking into the Linux Network Stack
Specializing the Data Path - Hooking into the Linux Network StackSpecializing the Data Path - Hooking into the Linux Network Stack
Specializing the Data Path - Hooking into the Linux Network StackKernel TLV
Ā 
Runtime Symbol Resolution
Runtime Symbol ResolutionRuntime Symbol Resolution
Runtime Symbol ResolutionKen Kawamoto
Ā 
Unit 5
Unit 5Unit 5
Unit 5siddr
Ā 
No instrumentation Golang Logging with eBPF (GoSF talk 11/11/20)
No instrumentation Golang Logging with eBPF (GoSF talk 11/11/20)No instrumentation Golang Logging with eBPF (GoSF talk 11/11/20)
No instrumentation Golang Logging with eBPF (GoSF talk 11/11/20)Pixie Labs
Ā 
PHP 7 OPCache extension review
PHP 7 OPCache extension reviewPHP 7 OPCache extension review
PHP 7 OPCache extension reviewjulien pauli
Ā 
Exploit Research and Development Megaprimer: Unicode Based Exploit Development
Exploit Research and Development Megaprimer: Unicode Based Exploit DevelopmentExploit Research and Development Megaprimer: Unicode Based Exploit Development
Exploit Research and Development Megaprimer: Unicode Based Exploit DevelopmentAjin Abraham
Ā 

What's hot (20)

Exploit techniques - a quick review
Exploit techniques - a quick reviewExploit techniques - a quick review
Exploit techniques - a quick review
Ā 
Mona cheatsheet
Mona cheatsheetMona cheatsheet
Mona cheatsheet
Ā 
[2012 CodeEngn Conference 06] pwn3r - Secuinside 2012 CTF ģ˜ˆģ„  ė¬øģ œķ’€ģ“
[2012 CodeEngn Conference 06] pwn3r - Secuinside 2012 CTF ģ˜ˆģ„  ė¬øģ œķ’€ģ“[2012 CodeEngn Conference 06] pwn3r - Secuinside 2012 CTF ģ˜ˆģ„  ė¬øģ œķ’€ģ“
[2012 CodeEngn Conference 06] pwn3r - Secuinside 2012 CTF ģ˜ˆģ„  ė¬øģ œķ’€ģ“
Ā 
One Shellcode to Rule Them All: Cross-Platform Exploitation
One Shellcode to Rule Them All: Cross-Platform ExploitationOne Shellcode to Rule Them All: Cross-Platform Exploitation
One Shellcode to Rule Them All: Cross-Platform Exploitation
Ā 
Virtual platform
Virtual platformVirtual platform
Virtual platform
Ā 
NTUSTxTDOH č³‡č؊安å…ØåŸŗē¤Žå·„作坊 åŸŗē¤Žé€†å‘ę•™č‚²čؓē·“
NTUSTxTDOH č³‡č؊安å…ØåŸŗē¤Žå·„作坊 åŸŗē¤Žé€†å‘ę•™č‚²čؓē·“NTUSTxTDOH č³‡č؊安å…ØåŸŗē¤Žå·„作坊 åŸŗē¤Žé€†å‘ę•™č‚²čؓē·“
NTUSTxTDOH č³‡č؊安å…ØåŸŗē¤Žå·„作坊 åŸŗē¤Žé€†å‘ę•™č‚²čؓē·“
Ā 
I/O, You Own: Regaining Control of Your Disk in the Presence of Bootkits
I/O, You Own: Regaining Control of Your Disk in the Presence of BootkitsI/O, You Own: Regaining Control of Your Disk in the Presence of Bootkits
I/O, You Own: Regaining Control of Your Disk in the Presence of Bootkits
Ā 
Qemu JIT Code Generator and System Emulation
Qemu JIT Code Generator and System EmulationQemu JIT Code Generator and System Emulation
Qemu JIT Code Generator and System Emulation
Ā 
Exploit Research and Development Megaprimer: DEP Bypassing with ROP Chains
Exploit Research and Development Megaprimer: DEP Bypassing with ROP ChainsExploit Research and Development Megaprimer: DEP Bypassing with ROP Chains
Exploit Research and Development Megaprimer: DEP Bypassing with ROP Chains
Ā 
[嵌兄式ē³»ēµ±] MCS-51 åƦ驗 - ä½æē”Ø IAR (2)
[嵌兄式ē³»ēµ±] MCS-51 åƦ驗 - ä½æē”Ø IAR (2)[嵌兄式ē³»ēµ±] MCS-51 åƦ驗 - ä½æē”Ø IAR (2)
[嵌兄式ē³»ēµ±] MCS-51 åƦ驗 - ä½æē”Ø IAR (2)
Ā 
2021.laravelconf.tw.slides2
2021.laravelconf.tw.slides22021.laravelconf.tw.slides2
2021.laravelconf.tw.slides2
Ā 
Software to the slaughter
Software to the slaughterSoftware to the slaughter
Software to the slaughter
Ā 
from Binary to Binary: How Qemu Works
from Binary to Binary: How Qemu Worksfrom Binary to Binary: How Qemu Works
from Binary to Binary: How Qemu Works
Ā 
Specializing the Data Path - Hooking into the Linux Network Stack
Specializing the Data Path - Hooking into the Linux Network StackSpecializing the Data Path - Hooking into the Linux Network Stack
Specializing the Data Path - Hooking into the Linux Network Stack
Ā 
Interpreter, Compiler, JIT from scratch
Interpreter, Compiler, JIT from scratchInterpreter, Compiler, JIT from scratch
Interpreter, Compiler, JIT from scratch
Ā 
Runtime Symbol Resolution
Runtime Symbol ResolutionRuntime Symbol Resolution
Runtime Symbol Resolution
Ā 
Unit 5
Unit 5Unit 5
Unit 5
Ā 
No instrumentation Golang Logging with eBPF (GoSF talk 11/11/20)
No instrumentation Golang Logging with eBPF (GoSF talk 11/11/20)No instrumentation Golang Logging with eBPF (GoSF talk 11/11/20)
No instrumentation Golang Logging with eBPF (GoSF talk 11/11/20)
Ā 
PHP 7 OPCache extension review
PHP 7 OPCache extension reviewPHP 7 OPCache extension review
PHP 7 OPCache extension review
Ā 
Exploit Research and Development Megaprimer: Unicode Based Exploit Development
Exploit Research and Development Megaprimer: Unicode Based Exploit DevelopmentExploit Research and Development Megaprimer: Unicode Based Exploit Development
Exploit Research and Development Megaprimer: Unicode Based Exploit Development
Ā 

Viewers also liked

Advanced exploit development
Advanced exploit developmentAdvanced exploit development
Advanced exploit developmentDan H
Ā 
Return-Oriented Programming: Exploits Without Code Injection
Return-Oriented Programming: Exploits Without Code InjectionReturn-Oriented Programming: Exploits Without Code Injection
Return-Oriented Programming: Exploits Without Code Injectionguest9f4856
Ā 
Sintsov advanced exploitation in win32
Sintsov   advanced exploitation in win32Sintsov   advanced exploitation in win32
Sintsov advanced exploitation in win32DefconRussia
Ā 
Advanced Exploit Development (Updated on 28 January, 2016)
Advanced Exploit Development (Updated on 28 January, 2016)Advanced Exploit Development (Updated on 28 January, 2016)
Advanced Exploit Development (Updated on 28 January, 2016)Dan H
Ā 
Linux Exploit Research
Linux Exploit ResearchLinux Exploit Research
Linux Exploit ResearchDan H
Ā 

Viewers also liked (6)

Advanced exploit development
Advanced exploit developmentAdvanced exploit development
Advanced exploit development
Ā 
Return-Oriented Programming: Exploits Without Code Injection
Return-Oriented Programming: Exploits Without Code InjectionReturn-Oriented Programming: Exploits Without Code Injection
Return-Oriented Programming: Exploits Without Code Injection
Ā 
Sintsov advanced exploitation in win32
Sintsov   advanced exploitation in win32Sintsov   advanced exploitation in win32
Sintsov advanced exploitation in win32
Ā 
Advanced Exploit Development (Updated on 28 January, 2016)
Advanced Exploit Development (Updated on 28 January, 2016)Advanced Exploit Development (Updated on 28 January, 2016)
Advanced Exploit Development (Updated on 28 January, 2016)
Ā 
IOT Exploitation
IOT Exploitation	IOT Exploitation
IOT Exploitation
Ā 
Linux Exploit Research
Linux Exploit ResearchLinux Exploit Research
Linux Exploit Research
Ā 

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

[CCC-28c3] Post Memory Corruption Memory Analysis
[CCC-28c3] Post Memory Corruption Memory Analysis[CCC-28c3] Post Memory Corruption Memory Analysis
[CCC-28c3] Post Memory Corruption Memory AnalysisMoabi.com
Ā 
CyberLink LabelPrint 2.5 Exploitation Process
CyberLink LabelPrint 2.5 Exploitation ProcessCyberLink LabelPrint 2.5 Exploitation Process
CyberLink LabelPrint 2.5 Exploitation ProcessThomas Gregory
Ā 
Writing Metasploit Plugins
Writing Metasploit PluginsWriting Metasploit Plugins
Writing Metasploit Pluginsamiable_indian
Ā 
Post Exploitation Bliss: Loading Meterpreter on a Factory iPhone, Black Hat U...
Post Exploitation Bliss: Loading Meterpreter on a Factory iPhone, Black Hat U...Post Exploitation Bliss: Loading Meterpreter on a Factory iPhone, Black Hat U...
Post Exploitation Bliss: Loading Meterpreter on a Factory iPhone, Black Hat U...Vincenzo Iozzo
Ā 
Heap overflows for humans ā€“ 101
Heap overflows for humans ā€“ 101Heap overflows for humans ā€“ 101
Heap overflows for humans ā€“ 101Craft Symbol
Ā 
[HITB Malaysia 2011] Exploit Automation
[HITB Malaysia 2011] Exploit Automation[HITB Malaysia 2011] Exploit Automation
[HITB Malaysia 2011] Exploit AutomationMoabi.com
Ā 
[Kiwicon 2011] Post Memory Corruption Memory Analysis
[Kiwicon 2011] Post Memory Corruption Memory Analysis[Kiwicon 2011] Post Memory Corruption Memory Analysis
[Kiwicon 2011] Post Memory Corruption Memory AnalysisMoabi.com
Ā 
[Ruxcon 2011] Post Memory Corruption Memory Analysis
[Ruxcon 2011] Post Memory Corruption Memory Analysis[Ruxcon 2011] Post Memory Corruption Memory Analysis
[Ruxcon 2011] Post Memory Corruption Memory AnalysisMoabi.com
Ā 
Taking advantage of the Amazon Web Services (AWS) Family
Taking advantage of the Amazon Web Services (AWS) FamilyTaking advantage of the Amazon Web Services (AWS) Family
Taking advantage of the Amazon Web Services (AWS) FamilyBen Hall
Ā 
Penetration Testing for Easy RM to MP3 Converter Application and Post Exploit
Penetration Testing for Easy RM to MP3 Converter Application and Post ExploitPenetration Testing for Easy RM to MP3 Converter Application and Post Exploit
Penetration Testing for Easy RM to MP3 Converter Application and Post ExploitJongWon Kim
Ā 
Playing With (B)Sqli
Playing With (B)SqliPlaying With (B)Sqli
Playing With (B)SqliChema Alonso
Ā 
Exploit Development: EzServer Buffer Overflow oleh Tom Gregory
Exploit Development: EzServer Buffer Overflow oleh Tom GregoryExploit Development: EzServer Buffer Overflow oleh Tom Gregory
Exploit Development: EzServer Buffer Overflow oleh Tom Gregoryzakiakhmad
Ā 
Exploit Development with Python
Exploit Development with PythonExploit Development with Python
Exploit Development with PythonThomas Gregory
Ā 
Low Level Exploits
Low Level ExploitsLow Level Exploits
Low Level Exploitshughpearse
Ā 
Buffer Overflow - Smashing the Stack
Buffer Overflow - Smashing the StackBuffer Overflow - Smashing the Stack
Buffer Overflow - Smashing the StackironSource
Ā 
SEH overwrite and its exploitability
SEH overwrite and its exploitabilitySEH overwrite and its exploitability
SEH overwrite and its exploitabilityFFRI, Inc.
Ā 
Code Red Security
Code Red SecurityCode Red Security
Code Red SecurityAmr Ali
Ā 
ruby2600 - an Atari 2600 emulator written in Ruby
ruby2600 - an Atari 2600 emulator written in Rubyruby2600 - an Atari 2600 emulator written in Ruby
ruby2600 - an Atari 2600 emulator written in RubyCarlos Duarte do Nascimento
Ā 

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

[CCC-28c3] Post Memory Corruption Memory Analysis
[CCC-28c3] Post Memory Corruption Memory Analysis[CCC-28c3] Post Memory Corruption Memory Analysis
[CCC-28c3] Post Memory Corruption Memory Analysis
Ā 
CyberLink LabelPrint 2.5 Exploitation Process
CyberLink LabelPrint 2.5 Exploitation ProcessCyberLink LabelPrint 2.5 Exploitation Process
CyberLink LabelPrint 2.5 Exploitation Process
Ā 
Writing Metasploit Plugins
Writing Metasploit PluginsWriting Metasploit Plugins
Writing Metasploit Plugins
Ā 
Post Exploitation Bliss: Loading Meterpreter on a Factory iPhone, Black Hat U...
Post Exploitation Bliss: Loading Meterpreter on a Factory iPhone, Black Hat U...Post Exploitation Bliss: Loading Meterpreter on a Factory iPhone, Black Hat U...
Post Exploitation Bliss: Loading Meterpreter on a Factory iPhone, Black Hat U...
Ā 
Heap overflows for humans ā€“ 101
Heap overflows for humans ā€“ 101Heap overflows for humans ā€“ 101
Heap overflows for humans ā€“ 101
Ā 
[HITB Malaysia 2011] Exploit Automation
[HITB Malaysia 2011] Exploit Automation[HITB Malaysia 2011] Exploit Automation
[HITB Malaysia 2011] Exploit Automation
Ā 
[Kiwicon 2011] Post Memory Corruption Memory Analysis
[Kiwicon 2011] Post Memory Corruption Memory Analysis[Kiwicon 2011] Post Memory Corruption Memory Analysis
[Kiwicon 2011] Post Memory Corruption Memory Analysis
Ā 
[Ruxcon 2011] Post Memory Corruption Memory Analysis
[Ruxcon 2011] Post Memory Corruption Memory Analysis[Ruxcon 2011] Post Memory Corruption Memory Analysis
[Ruxcon 2011] Post Memory Corruption Memory Analysis
Ā 
Unix executable buffer overflow
Unix executable buffer overflowUnix executable buffer overflow
Unix executable buffer overflow
Ā 
Taking advantage of the Amazon Web Services (AWS) Family
Taking advantage of the Amazon Web Services (AWS) FamilyTaking advantage of the Amazon Web Services (AWS) Family
Taking advantage of the Amazon Web Services (AWS) Family
Ā 
Penetration Testing for Easy RM to MP3 Converter Application and Post Exploit
Penetration Testing for Easy RM to MP3 Converter Application and Post ExploitPenetration Testing for Easy RM to MP3 Converter Application and Post Exploit
Penetration Testing for Easy RM to MP3 Converter Application and Post Exploit
Ā 
Computer Science Assignment Help
Computer Science Assignment HelpComputer Science Assignment Help
Computer Science Assignment Help
Ā 
Playing With (B)Sqli
Playing With (B)SqliPlaying With (B)Sqli
Playing With (B)Sqli
Ā 
Exploit Development: EzServer Buffer Overflow oleh Tom Gregory
Exploit Development: EzServer Buffer Overflow oleh Tom GregoryExploit Development: EzServer Buffer Overflow oleh Tom Gregory
Exploit Development: EzServer Buffer Overflow oleh Tom Gregory
Ā 
Exploit Development with Python
Exploit Development with PythonExploit Development with Python
Exploit Development with Python
Ā 
Low Level Exploits
Low Level ExploitsLow Level Exploits
Low Level Exploits
Ā 
Buffer Overflow - Smashing the Stack
Buffer Overflow - Smashing the StackBuffer Overflow - Smashing the Stack
Buffer Overflow - Smashing the Stack
Ā 
SEH overwrite and its exploitability
SEH overwrite and its exploitabilitySEH overwrite and its exploitability
SEH overwrite and its exploitability
Ā 
Code Red Security
Code Red SecurityCode Red Security
Code Red Security
Ā 
ruby2600 - an Atari 2600 emulator written in Ruby
ruby2600 - an Atari 2600 emulator written in Rubyruby2600 - an Atari 2600 emulator written in Ruby
ruby2600 - an Atari 2600 emulator written in Ruby
Ā 

More from n|u - The Open Security Community

Gibson 101 -quick_introduction_to_hacking_mainframes_in_2020_null_infosec_gir...
Gibson 101 -quick_introduction_to_hacking_mainframes_in_2020_null_infosec_gir...Gibson 101 -quick_introduction_to_hacking_mainframes_in_2020_null_infosec_gir...
Gibson 101 -quick_introduction_to_hacking_mainframes_in_2020_null_infosec_gir...n|u - The Open Security Community
Ā 

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

Hardware security testing 101 (Null - Delhi Chapter)
Hardware security testing 101 (Null - Delhi Chapter)Hardware security testing 101 (Null - Delhi Chapter)
Hardware security testing 101 (Null - Delhi Chapter)
Ā 
Osint primer
Osint primerOsint primer
Osint primer
Ā 
SSRF exploit the trust relationship
SSRF exploit the trust relationshipSSRF exploit the trust relationship
SSRF exploit the trust relationship
Ā 
Nmap basics
Nmap basicsNmap basics
Nmap basics
Ā 
Metasploit primary
Metasploit primaryMetasploit primary
Metasploit primary
Ā 
Api security-testing
Api security-testingApi security-testing
Api security-testing
Ā 
Introduction to TLS 1.3
Introduction to TLS 1.3Introduction to TLS 1.3
Introduction to TLS 1.3
Ā 
Gibson 101 -quick_introduction_to_hacking_mainframes_in_2020_null_infosec_gir...
Gibson 101 -quick_introduction_to_hacking_mainframes_in_2020_null_infosec_gir...Gibson 101 -quick_introduction_to_hacking_mainframes_in_2020_null_infosec_gir...
Gibson 101 -quick_introduction_to_hacking_mainframes_in_2020_null_infosec_gir...
Ā 
Talking About SSRF,CRLF
Talking About SSRF,CRLFTalking About SSRF,CRLF
Talking About SSRF,CRLF
Ā 
Building active directory lab for red teaming
Building active directory lab for red teamingBuilding active directory lab for red teaming
Building active directory lab for red teaming
Ā 
Owning a company through their logs
Owning a company through their logsOwning a company through their logs
Owning a company through their logs
Ā 
Introduction to shodan
Introduction to shodanIntroduction to shodan
Introduction to shodan
Ā 
Cloud security
Cloud security Cloud security
Cloud security
Ā 
Detecting persistence in windows
Detecting persistence in windowsDetecting persistence in windows
Detecting persistence in windows
Ā 
Frida - Objection Tool Usage
Frida - Objection Tool UsageFrida - Objection Tool Usage
Frida - Objection Tool Usage
Ā 
OSQuery - Monitoring System Process
OSQuery - Monitoring System ProcessOSQuery - Monitoring System Process
OSQuery - Monitoring System Process
Ā 
DevSecOps Jenkins Pipeline -Security
DevSecOps Jenkins Pipeline -SecurityDevSecOps Jenkins Pipeline -Security
DevSecOps Jenkins Pipeline -Security
Ā 
Extensible markup language attacks
Extensible markup language attacksExtensible markup language attacks
Extensible markup language attacks
Ā 
Linux for hackers
Linux for hackersLinux for hackers
Linux for hackers
Ā 
Android Pentesting
Android PentestingAndroid Pentesting
Android Pentesting
Ā 

Recently uploaded

Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
Ā 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
Ā 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
Ā 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
Ā 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
Ā 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
Ā 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel AraĆŗjo
Ā 
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Principled Technologies
Ā 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesBoston Institute of Analytics
Ā 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingEdi Saputra
Ā 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
Ā 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
Ā 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
Ā 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
Ā 
Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024The Digital Insurer
Ā 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
Ā 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
Ā 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
Ā 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
Ā 

Recently uploaded (20)

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
Ā 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Ā 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
Ā 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Ā 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Ā 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
Ā 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
Ā 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Ā 
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Ā 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
Ā 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Ā 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
Ā 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Ā 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
Ā 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Ā 
Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024
Ā 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Ā 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
Ā 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
Ā 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
Ā 

Return Oriented Programming (ROP) Based Exploits - Part I

  • 1.
  • 2. Return Oriented Programming (ROP) Based Exploits - Part I
  • 3. Exploit - exĀ·ploit to use selfishly for one's own ends
  • 4. Exploit Discovery Big space in computer security Exploits are discovered by Security Researchers and Hackers alike Zero day attacks are a result of newly created exploits or un-patched vulnerabilities
  • 5. Exploit Mitigation Windows XP Sp2 was the first widespread OS to incorporate exploit mitigation Protected 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)
  • 6. Break the mitigation BlackHat Presentations Security Forums Blogs
  • 7. Whose responsibility is it to mitigate ? Heap Protection SEH Chain validation DEP ASLR Stack Cookies Safe SEH
  • 8. DEP - Data Execution Prevention When 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).
  • 9. DEP - Data Execution Prevention Without DEP On With DEP On
  • 10. Problem With DEP on, code from the stack wonā€™t work
  • 11. Work-Around We 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 instruction Each 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
  • 12. Letter 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. 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
  • 14. Gadget We need to take a value from the stack, put it in EAX, and increase it with 0Ɨ80
  • 15. Gadget We need to take a value from the stack, put it in EAX, and increase it with 0Ɨ80 -- - - - - - - - -- -- - - - - --- - - -- -- - - - - - - - -- -- - - - - --- - - -- -- - - - - - - - -- -- - - - - --- - - -- WindowsFunction_1() ADD EBX, 30 TEST AL, AL POP EAX RET POP EAX RET ADD EAX, 80 POP EBX RET -- - - - - - - - -- -- - - - - --- - - -- -- - - - - - - - -- -- - - - - --- - - -- -- - - - - - - - -- -- - - - - --- - - -- WindowsFunction_2() INC EAX ADD EAX, 80 POP EBX RET -- - - - - - - - -- -- - - - - --- - - -- -- - - - - - - - -- -- - - - - --- - - -- -- - - - - - - - -- -- - - - - --- - - --
  • 16. 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)
  • 17. Windows Function Calls to bypass DEP VirtualAlloc(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 it HeapCreate(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()
  • 18. Windows Function Calls to bypass DEP Each 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)
  • 19. How to chain Demo
  • 20. Finding ROP gadgets There 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
  • 21. First part of the Exploit Testing ROP with a Windows API VirtualProtect() Demo
  • 22. Now you can sleep ļŠ
  • 24. Images http://s280.photobucket.com/albums/kk176/sabbath_X/?action=view&current=Pumpkin_ Grin_lll_by_midnightINK.jpg&newest=1 http://www.indiamike.com/india/attachments/7595d1210760693-what-the-strange-questions-for-india-experts-chilli-and-lemon.jpg http://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=32 http://SillyScreamingQueen.deviantart.com/art/Sleepy-54882830?q=boost%3Apopular+sleepy&qo=6