SlideShare a Scribd company logo
CNIT 127: Exploit Development




Ch 5: Introduction to Heap Overflows
Updated 3-14-21
What is a Heap?
Memory Map
• In gdb, the "info proc map" command
shows how memory is used


• Programs have a stack, one or more
heaps, and other segments


• malloc() allocates space on the heap


• free() frees the space
Heap and Stack
Heap Structure
Size of previous chunk
Size of this chunk
Pointer to next chunk
Pointer to previous chunk
Data


Size of previous chunk
Size of this chunk
Pointer to next chunk
Pointer to previous chunk
Data


Size of previous chunk
Size of this chunk
Pointer to next chunk
Pointer to previous chunk
Data
A Simple Example (Proj ED 205)
A Simple Example
Viewing the Heap in gdb
Exploit and Crash
Crash in gdb
Targeted Exploit
The Problem With the Heap
EIP is Hard to Control
• The Stack contains stored EIP values


• The Heap usually does not


• However, it has addresses that are used
for writes


– To fill in heap data


– To rearrange chunks when free() is called
Action of Free()
• Must write to the forward and reverse pointers


• If we can overflow a chunk, we can control
those writes


• Write to arbitrary RAM


– Image from mathyvanhoef.com, link Ch 5b
Target RAM Options
• Saved return address on the Stack


– Like the Buffer Overflows we did previously


• Global Offset Table


– Used to find shared library functions


• Destructors table (DTORS)


– Called when a program exits


• C Library Hooks
Target RAM Options
• "atexit" structure (link Ch 4n)


• Any function pointer


• In Windows, the default unhandled
exception handler is easy to find and
exploit
CNIT 127 Ch 5: Introduction to heap overflows

More Related Content

PDF
Ch 5: Introduction to heap overflows
PPTX
06 how to write a map reduce version of k-means clustering
PDF
Building blocks for aggregate programming of self-organising applications
ODP
Deep Learning meetup
ODP
Hubba Deep Learning
PPTX
Ronalao termpresent
PDF
Q4 2016 GeoTrellis Presentation
PPTX
Leveraging Intra-Node Parallelization in HPCC Systems
Ch 5: Introduction to heap overflows
06 how to write a map reduce version of k-means clustering
Building blocks for aggregate programming of self-organising applications
Deep Learning meetup
Hubba Deep Learning
Ronalao termpresent
Q4 2016 GeoTrellis Presentation
Leveraging Intra-Node Parallelization in HPCC Systems

What's hot (20)

PDF
Hadoop combiner and partitioner
PPTX
First Flink Bay Area meetup
PDF
Apache Storm Tutorial
PDF
Pain points with M3, some things to address them and how replication works
DOCX
14 lab-planing
PPTX
WMTS Performance Tests
PPTX
Improved Reliable Streaming Processing: Apache Storm as example
PDF
Apache Flink internals
PPTX
Build 2017 - B8037 - Explore the next generation of innovative UI in the Visu...
PPTX
An introduction to G1 collector for busy developers
PDF
Accumulo Summit 2016: Introducing Accumulo Collections: A Practical Accumulo ...
PPT
Improving Efficiency of Machine Learning Algorithms using HPCC Systems
PPTX
Debunking Common Myths in Stream Processing
PPT
pMatlab on BlueGene
PPTX
IEEE CLOUD \'11
PDF
KDB+/R Integration
PDF
running Tensorflow in Production
PDF
Finding OOMS in Legacy Systems with the Syslog Telegraf Plugin
PDF
FTM tree
Hadoop combiner and partitioner
First Flink Bay Area meetup
Apache Storm Tutorial
Pain points with M3, some things to address them and how replication works
14 lab-planing
WMTS Performance Tests
Improved Reliable Streaming Processing: Apache Storm as example
Apache Flink internals
Build 2017 - B8037 - Explore the next generation of innovative UI in the Visu...
An introduction to G1 collector for busy developers
Accumulo Summit 2016: Introducing Accumulo Collections: A Practical Accumulo ...
Improving Efficiency of Machine Learning Algorithms using HPCC Systems
Debunking Common Myths in Stream Processing
pMatlab on BlueGene
IEEE CLOUD \'11
KDB+/R Integration
running Tensorflow in Production
Finding OOMS in Legacy Systems with the Syslog Telegraf Plugin
FTM tree
Ad

Similar to CNIT 127 Ch 5: Introduction to heap overflows (20)

PDF
CNIT 127 Ch 5: Introduction to heap overflows
PDF
127 Ch 2: Stack overflows on Linux
PDF
CNIT 127: Ch 2: Stack overflows on Linux
PDF
(Berkeley CS186 guest lecture) Big Data Analytics Systems: What Goes Around C...
PDF
Move from C to Go
PDF
CNIT 127 Ch 2: Stack overflows on Linux
PDF
127 Ch 2: Stack overflows on Linux
PDF
CNIT 127 Ch 2: Stack overflows on Linux
PPTX
This gives a brief detail about big data
PDF
sysprog2 Part2
PDF
CNIT 127: Ch 2: Stack Overflows in Linux
PDF
PraveenBOUT++
PPTX
introduction to Complete Map and Reduce Framework
PPTX
COMPLETE MAP AND REDUCE FRAMEWORK INTRODUCTION
PDF
Accelerate Reed-Solomon coding for Fault-Tolerance in RAID-like system
PDF
Partitioning SKA Dataflows for Optimal Graph Execution
PPTX
Hadoop performance optimization tips
PDF
Perl at SkyCon'12
PPTX
Lecture2-MapReduce - An introductory lecture to Map Reduce
PPTX
19-7960-07-notes.pptx
CNIT 127 Ch 5: Introduction to heap overflows
127 Ch 2: Stack overflows on Linux
CNIT 127: Ch 2: Stack overflows on Linux
(Berkeley CS186 guest lecture) Big Data Analytics Systems: What Goes Around C...
Move from C to Go
CNIT 127 Ch 2: Stack overflows on Linux
127 Ch 2: Stack overflows on Linux
CNIT 127 Ch 2: Stack overflows on Linux
This gives a brief detail about big data
sysprog2 Part2
CNIT 127: Ch 2: Stack Overflows in Linux
PraveenBOUT++
introduction to Complete Map and Reduce Framework
COMPLETE MAP AND REDUCE FRAMEWORK INTRODUCTION
Accelerate Reed-Solomon coding for Fault-Tolerance in RAID-like system
Partitioning SKA Dataflows for Optimal Graph Execution
Hadoop performance optimization tips
Perl at SkyCon'12
Lecture2-MapReduce - An introductory lecture to Map Reduce
19-7960-07-notes.pptx
Ad

More from Sam Bowne (20)

PDF
Introduction to the Class & CISSP Certification
PDF
Cyberwar
PDF
3: DNS vulnerabilities
PDF
8. Software Development Security
PDF
4 Mapping the Application
PDF
3. Attacking iOS Applications (Part 2)
PDF
12 Elliptic Curves
PDF
11. Diffie-Hellman
PDF
2a Analyzing iOS Apps Part 1
PDF
9 Writing Secure Android Applications
PDF
12 Investigating Windows Systems (Part 2 of 3)
PDF
10 RSA
PDF
12 Investigating Windows Systems (Part 1 of 3
PDF
9. Hard Problems
PDF
8 Android Implementation Issues (Part 1)
PDF
11 Analysis Methodology
PDF
8. Authenticated Encryption
PDF
7. Attacking Android Applications (Part 2)
PDF
7. Attacking Android Applications (Part 1)
PDF
5. Stream Ciphers
Introduction to the Class & CISSP Certification
Cyberwar
3: DNS vulnerabilities
8. Software Development Security
4 Mapping the Application
3. Attacking iOS Applications (Part 2)
12 Elliptic Curves
11. Diffie-Hellman
2a Analyzing iOS Apps Part 1
9 Writing Secure Android Applications
12 Investigating Windows Systems (Part 2 of 3)
10 RSA
12 Investigating Windows Systems (Part 1 of 3
9. Hard Problems
8 Android Implementation Issues (Part 1)
11 Analysis Methodology
8. Authenticated Encryption
7. Attacking Android Applications (Part 2)
7. Attacking Android Applications (Part 1)
5. Stream Ciphers

Recently uploaded (20)

PPTX
Renaissance Architecture: A Journey from Faith to Humanism
PPTX
BOWEL ELIMINATION FACTORS AFFECTING AND TYPES
PDF
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
PDF
Computing-Curriculum for Schools in Ghana
PPTX
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
PPTX
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
PDF
Pre independence Education in Inndia.pdf
PDF
TR - Agricultural Crops Production NC III.pdf
PPTX
Final Presentation General Medicine 03-08-2024.pptx
PDF
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
PPTX
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
PDF
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
PDF
Basic Mud Logging Guide for educational purpose
PDF
STATICS OF THE RIGID BODIES Hibbelers.pdf
PDF
Module 4: Burden of Disease Tutorial Slides S2 2025
PPTX
human mycosis Human fungal infections are called human mycosis..pptx
PDF
FourierSeries-QuestionsWithAnswers(Part-A).pdf
PDF
VCE English Exam - Section C Student Revision Booklet
PDF
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
PDF
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
Renaissance Architecture: A Journey from Faith to Humanism
BOWEL ELIMINATION FACTORS AFFECTING AND TYPES
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
Computing-Curriculum for Schools in Ghana
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
Pre independence Education in Inndia.pdf
TR - Agricultural Crops Production NC III.pdf
Final Presentation General Medicine 03-08-2024.pptx
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
Basic Mud Logging Guide for educational purpose
STATICS OF THE RIGID BODIES Hibbelers.pdf
Module 4: Burden of Disease Tutorial Slides S2 2025
human mycosis Human fungal infections are called human mycosis..pptx
FourierSeries-QuestionsWithAnswers(Part-A).pdf
VCE English Exam - Section C Student Revision Booklet
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape

CNIT 127 Ch 5: Introduction to heap overflows

  • 1. CNIT 127: Exploit Development 
 
 Ch 5: Introduction to Heap Overflows Updated 3-14-21
  • 2. What is a Heap?
  • 3. Memory Map • In gdb, the "info proc map" command shows how memory is used • Programs have a stack, one or more heaps, and other segments • malloc() allocates space on the heap • free() frees the space
  • 5. Heap Structure Size of previous chunk Size of this chunk Pointer to next chunk Pointer to previous chunk Data Size of previous chunk Size of this chunk Pointer to next chunk Pointer to previous chunk Data Size of previous chunk Size of this chunk Pointer to next chunk Pointer to previous chunk Data
  • 6. A Simple Example (Proj ED 205)
  • 12. The Problem With the Heap
  • 13. EIP is Hard to Control • The Stack contains stored EIP values • The Heap usually does not • However, it has addresses that are used for writes – To fill in heap data – To rearrange chunks when free() is called
  • 14. Action of Free() • Must write to the forward and reverse pointers • If we can overflow a chunk, we can control those writes • Write to arbitrary RAM – Image from mathyvanhoef.com, link Ch 5b
  • 15. Target RAM Options • Saved return address on the Stack – Like the Buffer Overflows we did previously • Global Offset Table – Used to find shared library functions • Destructors table (DTORS) – Called when a program exits • C Library Hooks
  • 16. Target RAM Options • "atexit" structure (link Ch 4n) • Any function pointer • In Windows, the default unhandled exception handler is easy to find and exploit