Module 10 ( Intro Buffer OverFlow)

Architecture Fundamentals (Numbers)

Number System
Base
Used digits

Binary

2

0,1

Octal

8

0,1,2,3,4,5,6,7

Decimal

10

0,1,2,3,4,5,6,7,8,9

Hexadecimal

16

0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F

EX

Binary
Hexadecimal

0000

0

0x0

0001

1

0x1

0010

2

0x2

0011

3

0x3

0100

4

0x4

0101

5

0x5

0110

6

0x6

0111

7

0x7

11111

15

0xf

BUFFER OVERFLOW

WHAT ARE BUFFERS?

Buffers are memory storage regions that temporarily hold data while it is being transferred from one location to another

CAUSE

Buffer overflow is triggered by user input

In the case of buffer overflow vulnerabilities, the developer must check the input length before using any functions that might cause an overflow to happen

These attacks are caused by vulnerable functions in C

The following five common unsafe functions that can lead to a buffer overflow vulnerability:

MEMORY LAYOUT

The buffer space grows towards the Base Pointer (BP) and Instruction Pointer (IP) from lower memory to higher memory

Below Base Pointer (BP) there will be Instruction Pointer (IP)/Return Address

The stack components of the program are always stored above the Base Pointer (BP)

Intro to BOF

Buffer Oveflow

Ex Code

  • Step1: open Immuntiy Debbuger

  • Step2 run the app

  • Step3

Main Code

Register

Security Implementations

  • What is the vulnerable Functions?

    • gets

    • scanf

    • sprintf

    • Strcpy

  • what is the security implementations ?

    • ASLR , Dep Canary...

  • How to bypass it ?

    • SHE, ret to libc , etc...

Last updated