ethical hacking

dodan
EthicalHackingAssignment5-V21.docx

Ethical Hacking Lab 5

Buffer Overflow and Steganography

Determine the conditions for a buffer overflow to occur and use Steganography to demonstrate the manner to hide messages within a picture or other media.

Given the program below:

#include <stdio.h>

#include <string.h>

void foo(int a, int b, int c)

{

int tmp;

a=2;

tmp = b+c*a;

}

int main(int argc, char * argv[])

{

int pass = 0;   

char buff[15];

   

foo(3,4,5);

    printf("\n Enter the password : \n");

    gets(buff);

    if(strcmp(buff, "testpilot"))

    {

        printf ("\n Wrong Password \n");

    }

    else

    {

        printf ("\n Correct Password \n");

        pass = 1;

    }

    if(pass)

    {

       /* Now Give root or admin rights to user*/

        printf ("\n Root privileges given to the user \n");

    }

    return 0;

}

Assume the program is in a file called: test.c

It is compiled and linked using gcc test.c –a test

and is executed as ./test

Show the activation records up to where the arrow indicates:

Parameter right-to-left local variables top-to-bottom word size is 32 bits

Show what input, other than testpilot will give root privileges.

___________________________________________________________________________

What are DEP and ASLR?

___________________________________________________________________________

___________________________________________________________________________

___________________________________________________________________________

___________________________________________________________________________

___________________________________________________________________________

How do these techniques prevent attacks on the system?

___________________________________________________________________________

___________________________________________________________________________

___________________________________________________________________________

___________________________________________________________________________

___________________________________________________________________________

Given the following original and stego images

Determine

The maximum percentage of changed bits _____________________

The actual number of changed bits ___________________________

Using the original image, but now using single bit (lsb) and only hiding the letter c,

The maximum percentage of changed bits _____________________

The actual number of changed bits ___________________________