SLIDE 29 Title ¡
BitRewrite: ¡In ¡a ¡nutshell
§ redirect ¡func%on ¡pointers ¡and ¡return ¡addresses ¡
- rewrite ¡func%on ¡pointers ¡in ¡memory ¡
- move ¡call ¡instruc%ons ¡to ¡springboard ¡
§ validate ¡transfer ¡targets ¡with ¡bit ¡tes%ng ¡instruc%ons
29 chao.100871.net
¡call ¡eax ¡call ¡eax ¡ret ¡ret next: next: ¡mov ¡eax,foo ¡mov ¡eax,foo foo: foo: ¡... ¡... ¡... ¡...
¡ret ¡ret foo: foo: ¡jmp ¡next_sb-‑2 ¡jmp ¡next_sb-‑2 next: next: foo_sb: foo_sb: ¡jmp ¡foo ¡jmp ¡foo ¡jmp ¡back ¡jmp ¡back ¡call ¡eax ¡call ¡eax next_sb: next_sb: ¡mov ¡eax,foo_sb ¡mov ¡eax,foo_sb ¡... ¡... ¡jnz ¡error ¡jnz ¡error ¡test ¡[esp],M_R ¡test ¡[esp],M_R ¡jnz ¡error ¡jnz ¡error ¡test ¡eax,M_F ¡test ¡eax,M_F ¡... ¡... ¡... ¡... ¡test ¡eax,8 ¡test ¡eax,8 ¡jz ¡error ¡jz ¡error Direct ¡control ¡transfer Indirect ¡control ¡transfer M_F ¡= ¡0x8000007 M_R ¡= ¡0x800000f ¡ ¡ ¡ ¡ ¡ ¡or M_R ¡= ¡0xC00000f M_F ¡= ¡0x8000007 M_R ¡= ¡0x800000f ¡ ¡ ¡ ¡ ¡ ¡or M_R ¡= ¡0xC00000f