Write an exploit / attack for the scanf function.

Assignment Help Operating System
Reference no: EM13943224

Write an exploit / attack for the scanf function. Explain how the given buffer overflow attack works. Hint: write second program that spits out input.

Deliverables: - discussion of the buffer overflow attack.

                        - stack diagram of the given code execution.

                                    -- valid input.

                                    --invalid input (input that causes function bar to be called.

                        - exploit of scanf.

                        - brief discussion on how to prevent buffer overflows.

#include <stdio.h>

#include <string.h>

void foo (const char * input)

{

            char buf [50];

            printf ("My stack looks like: \n%p\n%p\n%p\n%p\n%p\n%p\n%p\n\n");

strcpy (buf,"I am Bender. Please Insert Girder");

strcat (buf,input);

printf ("%s\n",buf);

printf ("My stack looks like: \n%p\n%p\n%p\n%p\n%p\n%p\n%p\n\n");

return;

}

void bar ()

{

            printf ("Auug! I've been hacked!\n");

            return;

}

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

{

            scanf("%s",buf);

            printf ("address of foo: %p\n",foo);

            printf ("address of bar: %p\n", bar);

            foo (buf);

            return 0;

}

Example Stack Diagram:

Stack diagram for the strcat function at the beginning of function foo.

Hexadecimal Stack

Value Interpretation

0x1

 

0xfeea8380

 

0x212ab6

 

(nil)

The 50-character buffer

(nil)

"

(nil)

"

(nil)

"

(nil)

"

(nil)

"

(nil)

"

(nil)

"

(nil)

"

(nil)

"

(nil)

"

(nil)

"

0xfeea000

 

0x262690

 

0x34235c0

 

0x8048704

 

0xfeea83a8

 

0xfeea8430

 

Oxfeea8418

 

0x80484eb

Return address from foo to main

Reference no: EM13943224

Questions Cloud

Determine maximum load that helicopter can lift : The helicopter can produce a maximum downward air speed ( v = 24 m/s ) in a slipstream of a diameter ( D = 9 m). Knowing that the weight of the helicopter and the crew is ( 15 kN ) and assuming air density rho = 1.21 kg/m^3 ), determine the maximu..
The radiative heat transfer coefficient : A black body of finite dimension at 1000K is inserted into an infinite medium at 300 K. Given Stefan Boltzman constant as 1.8*10-5 W/m2K4, the radiative heat transfer coefficient is ------
Write paper on american with disabilities act and employment : Write research paper on Americans with Disabilities Act & Employment. Investigating the Relationship between the Americans with Disabilities Act and the declining rate of employment for people with disabilities since 1990.
Analyzing the business decision or problem : In this section you should in write in your own words a brief description of the business and the decision or problem that needs to be addressed.
Write an exploit / attack for the scanf function. : Write an exploit / attack for the scanf function. Explain how the given buffer overflow attack works. Hint: write second program that spits out input.
Pseudocode to represent the logic of a program : Draw a flowchart or write pseudocode to represent the logic of a program that allows the user to enter two values. The program outputs the product of the two values.  In order to complete this assignment.
Volume necessary to reduce the exiting concentration : Question -3 -the first order reaction A-(B is carried out in tubular reactor in which volumetric flow rate is constant . derive an equation relating to the reactor volume to the entering and exiting concentration of A .
What is the present value of the tax shield : Assume a world with corporate tax rate of 50% and no personal taxes. Company U has no debt, an operating income of $48m, a return on equity %20, and 3m shares outstanding. Company U decides to borrow $60m at and interest rate of 10% and use the proce..
Implied by the two outstanding debt issues : Vedder, Inc., has 7.9 million shares of common stock outstanding. The current share price is $62.90, and the book value per share is $5.90. Vedder also has two bond issues outstanding.  Assume that the overall cost of debt is the weighted average of ..

Reviews

Write a Review

Operating System Questions & Answers

  Circuit switch and packet switch environment

Provide two examples of a circuit switch and packet switch environment. Base one example on a circuit switch and the other on a packet switch.

  Circular-wait scheme with various deadlock-avoidance scheme

Compare the circular-wait scheme with thevarious deadlock-avoidance schemes  banker's algorithm)

  Google app engine development server

What is the advantage of testing the web application on Google App Engine development server before uploading the application into Google Cloud?

  What type of information is kept in a rom

What type of information is kept in a ROM, and how does that information originally get into the memory?

  Difference between an exclusive lock and a shared lock

Describe the difference between an exclusive lock and a shared lock. Define deadlock and how can it be avoided? How can it be resolved once it occurs?

  What is the subnet mask

Give the network number, local broadcast and the usable IP address ranges for the 5000th, 50000th & 150000th networks

  Q1 - technical essay describe and critically evaluate the

q1 - technical essay describe and critically evaluate the similarities between the windows and unix operating systems

  Create an introductory section on define risk

Question 1: Create an introductory section where you clearly DEFINE RISK. Question 2: Research and Pick ONE organization that can you conduct a risk assessment on.

  Propose the computing and data communications elements

Propose the computing and data communications elements needed to satisfy the system requirements defined in the given case. You must specify the criteria for evaluating the hardware, software and data communications requirements of your system.

  Election algorithm for bidirectional rings

The ring algorithm supposes that the links are unidirectional and that every procedure sends its message to the neighbor on the right. The main data structure used through the algorithm is the active list,

  Determine major computer components

Suppose you have decided to buy a personal computer system for personal use and wish to be able to do the following tasks on the computer,

  Can a dll be mapped into two process virtual address spaces

Can a DLL be mapped into two process' virtual address spaces at different virtual ad- dresses? If so, what problems arise? Can they be solved? If not, what can be done to eliminate them?

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd