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 :)

最新文章

  1. 基于Metronic的Bootstrap开发框架经验总结(5)--Bootstrap文件上传插件File Input的使用
  2. go排序
  3. 系统空闲时间判断&amp;命名验证
  4. codeforces 723D: Lakes in Berland
  5. js文件的装载和执行
  6. 用CSS变形创建圆形导航
  7. 不对称密钥密码体系之RSA
  8. PHP中用mysqli面向对象打开连接关闭mysql数据库
  9. 【微信公众号】将微信公众号消息里的FromUserName即OpenID转成UnionID
  10. Vue框架axios请求(类似于ajax请求)
  11. qt连接数据库Sqlite
  12. day47-python爬虫学习二
  13. JAVA服务cpu占用高排查
  14. django xadmin多对多字段过滤(含filter的反向查询)
  15. Eclipse 刚检出的项目 Build path 的时候提示 No action available
  16. #HTTP协议学习# (一)request 和response 解析
  17. PAT甲题题解-1031. Hello World for U (20)-字符串处理,水
  18. linux后台运行jar程序
  19. Beta发布
  20. staltStack安装配置

热门文章

  1. 关于Google Chrome的使用小技巧!
  2. ECharts Pie All In One
  3. STAR 法则
  4. Apache HTTP Server &amp; WS (websockets)
  5. Google Meet &amp; gmail &amp; video conference
  6. server sent events
  7. 线上 S1 故障是什么, 线上 S1 故障, 运维故障分级, 运维, 故障分级, P1 级别故障, 故障, P1 , S1
  8. 「NGK每日快讯」2021.2.4日NGK公链第93期官方快讯!
  9. 纯js日历插件
  10. Python基础之:数字字符串和列表