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) 这道 ...
随机推荐
- 无需扫描即可查找和攻击域SQL Server (SPN)
无扫描SQL Server发现简介 当您没有凭据或正在寻找不在域中的SQL Server时,使用各种扫描技术来查找SQL Server可能非常有用.但是,此过程可能很嘈杂,耗时,并且可能由于子网未知, ...
- 2016 最新的 树莓派3 Raspberry Pi 3 上手评测 图解教程 新手必看!(VNC 安装,启动,关闭)
1.png . 官方教程: INSTALLING OPERATING SYSTEM IMAGES: https://www.raspberrypi.org/documentation/installa ...
- VSCode & outline & source code
VSCode & outline & source code Dart 源码学习 outline 速览 dart-core List class instance-methods ht ...
- Windows Server2012 r2 nginx反向代理图片服务器
1.下载nginx http://nginx.org/en/download.html,本人下载的1.18.0版本 2.下载 Windows Service Wrapper(winsw.exe) v ...
- 开启算法之路,还原题目,用debug调试搞懂每一道题
文章简述 大家好,本篇是个人的第 3 篇文章. 承接第一篇文章<手写单链表基础之增,删,查!附赠一道链表题>,在第一篇文章中提过,在刷算法题之前先将基础知识过一遍,这样对后面的做算法题是很 ...
- nginx反向代理理解
实际开发中,会有不同的环境: - 开发环境:自己的电脑- 测试环境:提供给测试人员使用的环境- 预发布环境:数据是和生成环境的数据一致,运行最新的项目代码进去测试- 生产环境:项目最终发布上线的环境 ...
- 设置mysql的字符集永远为UTF-8
1.在虚拟机/usr路径下创建一个文件命名为:mysql.cnf cd /usr touch mysql.cnf 2.在该文件中使用vim命令插入配置文本 vim mysql.cnf 按i键进入编辑模 ...
- HarmonyOS三方件开发指南(13)-SwipeLayout侧滑删除
鸿蒙入门指南,小白速来!0基础学习路线分享,高效学习方法,重点答疑解惑--->[课程入口] 目录:1. SwipeLayout组件功能介绍2. SwipeLayout使用方法3. SwipeLa ...
- RabbitMQ之死信队列
1:何为死信队列 死信队列也是一个正常的队列,可以被消费. 但是,死信队列的消息来源于其他队列的转发. 2:如何触发死信队列 1:消息超时 2:队列长度达到极限 3:消息被拒绝消费,并不再重进队列,且 ...
- MySQL学习笔记(五)
倒数第二天!冲冲冲!!! 一.索引 一个表里面可以有多个索引. 1. 索引的作用:约束与加速查找 无索引:从前到后依次查找 有索引:会为索引列创造一个额外文件(以某种格式存储).在使用索引进行查找时, ...