software security, implementation flaws, and memory …cs161/sp10/slides/1.22.implflaw.pdf ·...

21
Software Security, Implementation Flaws, and Memory Safety 1/22/2010

Upload: ngotuyen

Post on 11-Apr-2018

229 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: Software Security, Implementation Flaws, and Memory …cs161/sp10/slides/1.22.implflaw.pdf · Software Security, Implementation Flaws, and ... The zero-day attack that exploited IE

Software Security,Implementation Flaws,

and Memory Safety

1/22/2010

Page 2: Software Security, Implementation Flaws, and Memory …cs161/sp10/slides/1.22.implflaw.pdf · Software Security, Implementation Flaws, and ... The zero-day attack that exploited IE
Page 3: Software Security, Implementation Flaws, and Memory …cs161/sp10/slides/1.22.implflaw.pdf · Software Security, Implementation Flaws, and ... The zero-day attack that exploited IE
Page 4: Software Security, Implementation Flaws, and Memory …cs161/sp10/slides/1.22.implflaw.pdf · Software Security, Implementation Flaws, and ... The zero-day attack that exploited IE

#293 HRE-THR 850 1930

ALICE SMITH

COACH

SPECIAL INSTRUX: NONE

Page 5: Software Security, Implementation Flaws, and Memory …cs161/sp10/slides/1.22.implflaw.pdf · Software Security, Implementation Flaws, and ... The zero-day attack that exploited IE

#293 HRE-THR 850 1930

ALICE SMITHHHHHHHHHHH

HHACH

SPECIAL INSTRUX: NONE

Page 6: Software Security, Implementation Flaws, and Memory …cs161/sp10/slides/1.22.implflaw.pdf · Software Security, Implementation Flaws, and ... The zero-day attack that exploited IE

#293 HRE-THR 850 1930

ALICE SMITH

FIRST

SPECIAL INSTRUX: GIVE

PAX EXTRA CHAMPAGNE.

Page 7: Software Security, Implementation Flaws, and Memory …cs161/sp10/slides/1.22.implflaw.pdf · Software Security, Implementation Flaws, and ... The zero-day attack that exploited IE

char name[20];

void vulnerable() {gets(name);

}

Page 8: Software Security, Implementation Flaws, and Memory …cs161/sp10/slides/1.22.implflaw.pdf · Software Security, Implementation Flaws, and ... The zero-day attack that exploited IE

char name[20];char instrux[80] = "none";

void vulnerable() {gets(name);

}

Page 9: Software Security, Implementation Flaws, and Memory …cs161/sp10/slides/1.22.implflaw.pdf · Software Security, Implementation Flaws, and ... The zero-day attack that exploited IE

char line[512];char command[] = "/usr/bin/finger";

void main() {gets(line);...execv(command, ...);

}

Page 10: Software Security, Implementation Flaws, and Memory …cs161/sp10/slides/1.22.implflaw.pdf · Software Security, Implementation Flaws, and ... The zero-day attack that exploited IE

char name[20];int seatinfirstclass = 0;

void vulnerable() {gets(name);

}

Page 11: Software Security, Implementation Flaws, and Memory …cs161/sp10/slides/1.22.implflaw.pdf · Software Security, Implementation Flaws, and ... The zero-day attack that exploited IE

char name[20];int authenticated = 0;

void vulnerable() {gets(name);

}

Page 12: Software Security, Implementation Flaws, and Memory …cs161/sp10/slides/1.22.implflaw.pdf · Software Security, Implementation Flaws, and ... The zero-day attack that exploited IE

void vulnerable() {char buf[64];gets(buf);...

}

Page 13: Software Security, Implementation Flaws, and Memory …cs161/sp10/slides/1.22.implflaw.pdf · Software Security, Implementation Flaws, and ... The zero-day attack that exploited IE

void still_vulnerable() {char buf = malloc(64);gets(buf);...

}

Page 14: Software Security, Implementation Flaws, and Memory …cs161/sp10/slides/1.22.implflaw.pdf · Software Security, Implementation Flaws, and ... The zero-day attack that exploited IE

void safe() {char buf[64];fgets(buf, sizeof buf, stdin);...

}

Page 15: Software Security, Implementation Flaws, and Memory …cs161/sp10/slides/1.22.implflaw.pdf · Software Security, Implementation Flaws, and ... The zero-day attack that exploited IE

void vulnerable() {char buf[64];if (fgets(buf, 64, stdin) == NULL)return;

printf(buf);}

Page 16: Software Security, Implementation Flaws, and Memory …cs161/sp10/slides/1.22.implflaw.pdf · Software Security, Implementation Flaws, and ... The zero-day attack that exploited IE

void vulnerable(int len, char *data) {char buf[64];if (len > 64)return;

memcpy(buf, data, len);}

Page 17: Software Security, Implementation Flaws, and Memory …cs161/sp10/slides/1.22.implflaw.pdf · Software Security, Implementation Flaws, and ... The zero-day attack that exploited IE

void safe(size_t len, char *data) {char buf[64];if (len > 64)return;

memcpy(buf, data, len);}

Page 18: Software Security, Implementation Flaws, and Memory …cs161/sp10/slides/1.22.implflaw.pdf · Software Security, Implementation Flaws, and ... The zero-day attack that exploited IE

void vulnerable(size_t len, char *data) {char *buf = malloc(len+2);memcpy(buf, data, len);buf[len] = '\n';buf[len+1] = '\0';

}

Page 19: Software Security, Implementation Flaws, and Memory …cs161/sp10/slides/1.22.implflaw.pdf · Software Security, Implementation Flaws, and ... The zero-day attack that exploited IE
Page 20: Software Security, Implementation Flaws, and Memory …cs161/sp10/slides/1.22.implflaw.pdf · Software Security, Implementation Flaws, and ... The zero-day attack that exploited IE
Page 21: Software Security, Implementation Flaws, and Memory …cs161/sp10/slides/1.22.implflaw.pdf · Software Security, Implementation Flaws, and ... The zero-day attack that exploited IE