强撸CMU之15-213

强撸CMU之15-213

一直找不到CSAPP第三版的英文版pdf,现在国内终于有影印版了,果断入手

Introduction to Computer Systems

CMU的招牌课程之一,官网的资源很详细了,还有视频看(虽然没字幕,不过可以调语速

Lab

Data Lab

Bomb Lab

peda 调试,耐着性子看懂汇编代码就可以了,没什么好说的

Attack Lab

需要你攻击程序的缓冲区溢出漏洞,使其以指定参数到达指定函数
前三关的攻击对象没加任何保护,随便怼
后两关其实就是第二第三关被加了栈地址随机化和栈内容不可执行两个保护
如果只有前者,可以通过 nop 滑到目的地
现在有了后者,就只能用 ROP (Return-Oriented Programming) 了

  • Level 1:
    修改返回地址就可以了
    payload = offset + address of touch1()
    通过汇编代码可知 offset 的大小是 40 个字节

  • Level 2:
    还要插入传递参数的代码
    payload = offset + address of injected code + address of touch2() + injected code

  • Level 3:
    还要插入字符串
    payload = offset + address of injected code + address of touch3() + injected code + string
    (其中 string 是你的 cookie 的字符串形式(要额外补 '\0'))

  • Level 4:
    pop %rdi 对应的字节码是很少见的,所以需要通过多条指令来达到一条指令的目的
    payload = offset + address of gadget 1 + cookie + address of gadget 2 + address of touch2()

  • Level 5:
    难点在于获取 string 的地址(因为被随机化了),此处可先用 mov %rsp,%rax 获取栈顶地址,然后加减一定偏移量使其指向 string(可用 add/ inc/ lea 达到增加的目的,用 lea 的话,要先把偏移量插进栈里,再 pop 到寄存器里,然后才可以 lea
    64 位与 32 位的 add 都没找到,恰好找到了 8 位的 add位数越少,年代越久远,字节码越短,出现可能性越大
    payload = offset1 + address of gadget 1 + address of gadget 2 + address of gadget 3 + address of touch3() + offset2 + string

Architecture Lab

Cache Lab

Performance Lab

Shell Lab

Proxy Lab


CASPP

这门课的课本就是大名鼎鼎的CSAPP,我看到是第三版,下面是读书笔记

Chapter 1: A Tour of Computer Systems

Part I Program Structure and Execution

Chapter 2: Representing and Manipulating Information

Chapter 3: Machine-Level Representation of Programs

Chapter 4: Processor Architecture

Chapter 5: Optimizing Program Performance

Chapter 6: The Memory Hierarchy

Part II Running Programs on a System

Chapter 7: Linking

Chapter 8: Exceptional Control Flow

Chapter 9: Virtual Memory

Part III Interaction and Communication between Programs

Chapter 10: System-Level I/O

Chapter 11: Network Programming

Chapter 12: Concurrent Programming

A: Error Handling


2 thoughts on “强撸CMU之15-213

  1. 3.10.1 “The value of a function pointer is the address of the first instruction in the machine-code representation of the function.“只针对书中示例函数吧。

Leave a Reply to 忆兔 Cancel reply