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的更多相关文章

  1. pwnable.kr第二天

    3.bof 这题就是简单的数组越界覆盖,直接用gdb 调试出偏移就ok from pwn import * context.log_level='debug' payload='A'*52+p32(0 ...

  2. 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 ...

  3. 【pwnable.kr】 brainfuck

    pwnable.kr第二关第一题: ========================================= Download : http://pwnable.kr/bin/bfDownl ...

  4. pwnable.kr第三题bof

    Running at : nc pwnable.kr 9000 IDA查看 1 unsigned int __cdecl func(int a1) 2 { 3 char s; // [esp+1Ch] ...

  5. pwnable.kr的passcode

    前段时间找到一个练习pwn的网站,pwnable.kr 这里记录其中的passcode的做题过程,给自己加深印象. 废话不多说了,看一下题目, 看到题目,就ssh连接进去,就看到三个文件如下 看了一下 ...

  6. pwnable.kr brainfuck之write up

    I made a simple brain-fuck language emulation program written in C. The [ ] commands are not impleme ...

  7. pwnable.kr详细通关秘籍(二)

    i春秋作家:W1ngs 原文来自:pwnable.kr详细通关秘籍(二) 0x00 input 首先看一下代码: 可以看到程序总共有五步,全部都满足了才可以得到flag,那我们就一步一步来看 这道题考 ...

  8. 【pwnable.kr】 unlink

    pwnable.kr 第一阶段的最后一题! 这道题目就是堆溢出的经典利用题目,不过是把堆块的分配与释放操作用C++重新写了一遍,可参考<C和C++安全编码一书>//不是广告 #includ ...

  9. 【pwnable.kr】 codemap

    pwnable新的一题. download: http://pwnable.kr/bin/codemap.exe ssh codemap@pwnable.kr -p2222 (pw:guest) 这道 ...

随机推荐

  1. vue中怎么动态生成form表单

    form-create 是一个可以通过 JSON 生成具有动态渲染.数据收集.验证和提交功能的表单生成组件.支持3个UI框架,并且支持生成任何 Vue 组件.内置20种常用表单组件和自定义组件,再复杂 ...

  2. Canvas & encryption image src

    Canvas & encode image src 使用 Canvas 加密图片,防盗链 前端黑科技 https://telegram.org/ binary encode ??? https ...

  3. Github history viewer

    Github history viewer https://github.githistory.xyz/ https://github.com/pomber/git-history https://c ...

  4. React Learning Paths

    React Learning Paths React Expert React in Action The assessment may cover: Components Events and Bi ...

  5. taro defaultProps

    taro defaultProps https://nervjs.github.io/taro/docs/best-practice.html#给组件设置-defaultprops import Ta ...

  6. taro 三端开发

    taro 三端开发 wx 小程序, alipay 小程序,H5 https://taro-docs.jd.com/taro/docs/GETTING-STARTED.html#h5 https://t ...

  7. Nodejs 使用 TypeScript

    安装依赖 λ yarn add typescript types/node concurrently nodemon wait-on -D 初始化一个 tsconfig.json λ ./node_m ...

  8. 用Python实现一个“百度翻译”

    import requests import json s = input("请输入你要翻译的内容:") headers = {"User-Agent":&qu ...

  9. Angular的工作原理

    来源:https://www.cnblogs.com/moriah/p/6096998.html <!doctype html> <html ng-app> <head& ...

  10. Mybites学习

    参考链接:https://www.cnblogs.com/dongying/p/4073259.html <select <!-- 1. id (必须配置) id是命名空间中的唯一标识符, ...