1. Trang chủ
  2. » Công Nghệ Thông Tin

Buffer Overflow Exploits doc

16 285 0
Tài liệu được quét OCR, nội dung có thể không chính xác
Tài liệu đã được kiểm tra trùng lặp

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 16
Dung lượng 87,5 KB

Các công cụ chuyển đổi và chỉnh sửa cho tài liệu này

Nội dung

Bufter Overflow Exploits CS-480b Dick SteTlik... Side Effects ° The side effects of a buffer overflow may Cause.. ° the program may work strangely ° the program may fail ° the program

Trang 1

Bufter Overflow Exploits

CS-480b Dick SteTlik

Trang 2

° Anyfime we pu

structure than it

Trang 3

Side Effects

° The side effects of a buffer overflow may

Cause

° the program may work strangely

° the program may fail

° the program may continue without any noticeable problems

Trang 4

°® What data e

that gets ove

Trang 5

/errun a statIc butte

hurts Fhe) na tle to

control |

mc .

Trang 7

strcpy()

if you know the size of the destination buffer:

if (strlen(src) >= dst_size {/* throw an error */ } else { strcpy(dst, src); }

ae

strncpy(dst, src, dst_size-1);

dst[dst_size -1] = ‘\0’; /* just to be safe */

oe

/* allocate the destination buffer when you need it */ dst = (char *)malloc(strlen(src) +1);

srtcpy(dst, src)

Trang 8

strcat( )

/* same as srtcpy( ) but cancatenates source string to end of a buffer */ /* safer alternative is to use strncat( ) ; still need to insure you don’t */

/* overrun the destination buffer * /

strncat(dst,.src, dst_size - strlen(dst) -1);

Trang 9

I

Trang 10

re is no really portable way aro , sometimes a snprintf() *

provided that lets you 1001) 1arACf€rs {O CODy: ˆ

in(int argc , char **arg

Isage[1024]:-

Trang 13

on main(int cliolor or

-_ Char iO =

erence printf("%s\

Trang 14

gets( )

strcpy( )

strcat( )

sprintf( )

scanÍ( )

sscanf( )

fscanf( )

viscanf( )

vsscanf( )

streadd( )

strecpy( )

functions to be wary otf:

strtrns( ) realpath( )

syslog( ) getopt( )

getopt long(.) getpass( )

getchar( ) fgetc( )

getc( )

read( )

beopy()

fgets( ) memcpy( ) snprintf( ) strccpy( ) strcadd( ) strncpy( ) vsnprinff( )

Trang 15

heap overflows

Trang 16

stack overflows

Ngày đăng: 15/03/2014, 17:20

w