pwnable.kr第二题collision

1 col@prowl:~$ ls -al
2 total 36
3 drwxr-x--- 5 root col 4096 Oct 23 2016 .
4 drwxr-xr-x 114 root root 4096 May 19 15:59 ..
5 d--------- 2 root root 4096 Jun 12 2014 .bash_history
6 -r-sr-x--- 1 col_pwn col 7341 Jun 11 2014 col
7 -rw-r--r-- 1 root root 555 Jun 12 2014 col.c
8 -r--r----- 1 col_pwn col_pwn 52 Jun 11 2014 flag
9 dr-xr-xr-x 2 root root 4096 Aug 20 2014 .irssi
10 drwxr-xr-x 2 root root 4096 Oct 23 2016 .pwntools-cache
11 col@prowl:~$ cat col.c
12 #include <stdio.h>
13 #include <string.h>
14 unsigned long hashcode = 0x21DD09EC;
15 unsigned long check_password(const char* p){
16 int* ip = (int*)p;
17 int i;
18 int res=0;
19 for(i=0; i<5; i++){
20 res += ip[i];
21 }
22 return res;
23 }
24
25 int main(int argc, char* argv[]){
26 if(argc<2){
27 printf("usage : %s [passcode]\n", argv[0]);
28 return 0;
29 }
30 if(strlen(argv[1]) != 20){
31 printf("passcode length should be 20 bytes\n");
32 return 0;
33 }
34
35 if(hashcode == check_password( argv[1] )){
36 system("/bin/cat flag");
37 return 0;
38 }
39 else
40 printf("wrong passcode.\n");
41 return 0;
42 }
参数构造20位,check_password函数内用int读char,即分成5个数
字符串以‘\x00'结尾,所以用'\x01'来填充,
0x21DD09EC-0x01010101*4=0x1DD905E8
col@prowl:~$ ./col $(python -c "print '\x01' * 16 + '\xE8\x05\xD9\x1D'")
daddy! I just managed to create a hash collision :)
pwnable.kr第二题collision的更多相关文章
- pwnable.kr第二天
3.bof 这题就是简单的数组越界覆盖,直接用gdb 调试出偏移就ok from pwn import * context.log_level='debug' payload='A'*52+p32(0 ...
- pwnable.kr 第一题fd
使用ssh fd@pwnable.kr -p2222连接输入密码guest 1 fd@prowl:~$ ls -al 2 total 40 3 drwxr-x--- 5 root fd 4096 Oc ...
- 【pwnable.kr】 brainfuck
pwnable.kr第二关第一题: ========================================= Download : http://pwnable.kr/bin/bfDownl ...
- pwnable.kr第三题bof
Running at : nc pwnable.kr 9000 IDA查看 1 unsigned int __cdecl func(int a1) 2 { 3 char s; // [esp+1Ch] ...
- pwnable.kr的passcode
前段时间找到一个练习pwn的网站,pwnable.kr 这里记录其中的passcode的做题过程,给自己加深印象. 废话不多说了,看一下题目, 看到题目,就ssh连接进去,就看到三个文件如下 看了一下 ...
- pwnable.kr brainfuck之write up
I made a simple brain-fuck language emulation program written in C. The [ ] commands are not impleme ...
- pwnable.kr详细通关秘籍(二)
i春秋作家:W1ngs 原文来自:pwnable.kr详细通关秘籍(二) 0x00 input 首先看一下代码: 可以看到程序总共有五步,全部都满足了才可以得到flag,那我们就一步一步来看 这道题考 ...
- 【pwnable.kr】 unlink
pwnable.kr 第一阶段的最后一题! 这道题目就是堆溢出的经典利用题目,不过是把堆块的分配与释放操作用C++重新写了一遍,可参考<C和C++安全编码一书>//不是广告 #includ ...
- 【pwnable.kr】 codemap
pwnable新的一题. download: http://pwnable.kr/bin/codemap.exe ssh codemap@pwnable.kr -p2222 (pw:guest) 这道 ...
随机推荐
- 解决springmvc使用@ResponseBody返回String类型字符串中文乱码问题
问题分析: 首先: 确定的是只有当返回值是 String时才会出现中文乱码,而当返回值是Map<String, Object>或者是其它类型时,并没有中文乱码的出现. 然后找原因: 原因是 ...
- Linux kill All In One
Linux kill All In One kill -9 kill $ kill <PID> $ ps -ef | grep node $ sudo kill -9 <PID> ...
- JavaScript Number Type Checker
JavaScript Number Type Checker Number.isInteger // static 方法 Number.isInteger(value) https://develop ...
- website & blogs & about me & contact
website & blogs & about me & contact demos https://davidwalsh.name/about-david-walsh htt ...
- css & clip-path
css & clip-path https://developer.mozilla.org/en-US/docs/Web/CSS/clip-path https://tongqu.me/ tw ...
- WEB 用视频替换GIF动画
原文 download ffmpeg gif to video 转化后文件大小大大降低 $ ffmpeg -i my-animation.gif -b:v 0 -crf 25 -f mp4 -vcod ...
- restful风格的理解
简而言之,就是不同的命令响应不同的操作: 关注点在url中的不同参数,是因为不同的参数才使得不同的method去对应的不同的操作.
- 简单梳理下 Vue3 的新特性
在 Vue3 测试版刚刚发布的时候,我就学习了下 Composition API,但没想到正式版时隔一年多才出来,看了一下发现还是增加了不少新特性的,在这里我就将它们一一梳理一遍. 本文章只详细阐述 ...
- 微信小程序引入ECharts组件
首先打开ECharts网页 https://echarts.apache.org/zh/tutorial.html#%E5%9C%A8%E5%BE%AE%E4%BF%A1%E5%B0%8F%E7%A8 ...
- vue:表格中多选框的处理
效果如下: template中代码如下: <el-table v-loading="listLoading" :data="list" element-l ...