Pwn勉強会(Stack day 1)
- Disassembler
- udcli / ndisasm
- objdump
- METASM / Hopper / IDA Pro
- Assembler
- Debugger
- Pwn toolkit
Python(Pwntools)とRuby(METASM? ctfライブラリ?)好きな方を選んで作業を進めてもらう.
Shellcode
1
2
3 #include
4 typedef void func();
5 int main() {
6 char buf[1024];
7 fread(buf, 1, 4096, stdin);
8 ((func *)buf)();
9 }
x86/x86-64 ABI
チートシート
System call
システムコールの呼び出し方
Shellcode(no /bin/sh)
1
2
3 #include
4 typedef void func();
5 int main() {
6 char buf[1024];
7 fread(buf, 1, 4096, stdin);
8 ((func *)buf)();
9 }
Return-to-plt
1
2 #include
3 #include
4 char buf2[128];
5 int f() {
6 char buf[32];
7 system("sleep 1");
8 gets(buf);
9 return 0;
10 }
11 int main() { return f(); }
ASLR
ASLRについて説明
Return-to-libc
1
2 #include
3 int f() {
4 char buf[32];
5 write(1, buf, 64);
6 read(0, buf, 1024);
7 return 0;
8 }
9 int main() { return f(); }
Return-to-plt revisited(x86-64) with tiny ROP
1
2 #include
3 #include
4 char buf2[128];
5 int f() {
6 char buf[32];
7 system("sleep 1");
8 gets(buf);
9 return 0;
10 }
11 int main() { return f(); }
ROP
1
2 #include
3 int f() {
4 char buf[32];
5 read(0, buf, 1024);
6 return 0;
7 }
8 int main() { return f(); }
実践
適当な問題を探す