Question

Write a testing program (in C) that contains a heap buffer overflow vulnerability. (Provide an example...

  1. Write a testing program (in C) that contains a heap buffer overflow vulnerability. (Provide an example in the project. Copy/paste is fine. No Screenshot). Again, you do not have to exploit it.
    1. Show what the heap layout looks like and explain how to exploit it.

(Include a diagram)

    • Include the following items:
  1. Each chunk of memory allocated by malloc() and their metadata.
  2. Their sizes in bytes.
  3. The overflow direction in the heap.
  4. The size of the overflowing buffer to reach and overwrite the metadata.
  5. Overflow data that is meaningful for an exploit (this can be general).

Please answer all parts of the question

Homework Answers

Answer #1

// Heap overflow can be achieved in one way by allocating large memory

//either a large chunkof memory or continuous allocation

#include<stdio.h>

int main()

{

    for (int i=0; i<20000000; i++)

    {

       // Allocating memory without freeing it

       int *ptr = (int *)malloc(sizeof(int));

    }

}

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions