pwnable.kr-bof-Writeup
MarkdownPad Document
*:first-child {
margin-top: 0 !important;
}
body>*:last-child {
margin-bottom: 0 !important;
}
/* BLOCKS
=============================================================================*/
p, blockquote, ul, ol, dl, table, pre {
margin: 15px 0;
}
/* HEADERS
=============================================================================*/
h1, h2, h3, h4, h5, h6 {
margin: 20px 0 10px;
padding: 0;
font-weight: bold;
-webkit-font-smoothing: antialiased;
}
h1 tt, h1 code, h2 tt, h2 code, h3 tt, h3 code, h4 tt, h4 code, h5 tt, h5 code, h6 tt, h6 code {
font-size: inherit;
}
h1 {
font-size: 28px;
color: #000;
}
h2 {
font-size: 24px;
border-bottom: 1px solid #ccc;
color: #000;
}
h3 {
font-size: 18px;
}
h4 {
font-size: 16px;
}
h5 {
font-size: 14px;
}
h6 {
color: #777;
font-size: 14px;
}
body>h2:first-child, body>h1:first-child, body>h1:first-child+h2, body>h3:first-child, body>h4:first-child, body>h5:first-child, body>h6:first-child {
margin-top: 0;
padding-top: 0;
}
a:first-child h1, a:first-child h2, a:first-child h3, a:first-child h4, a:first-child h5, a:first-child h6 {
margin-top: 0;
padding-top: 0;
}
h1+p, h2+p, h3+p, h4+p, h5+p, h6+p {
margin-top: 10px;
}
/* LINKS
=============================================================================*/
a {
color: #4183C4;
text-decoration: none;
}
a:hover {
text-decoration: underline;
}
/* LISTS
=============================================================================*/
ul, ol {
padding-left: 30px;
}
ul li > :first-child,
ol li > :first-child,
ul li ul:first-of-type,
ol li ol:first-of-type,
ul li ol:first-of-type,
ol li ul:first-of-type {
margin-top: 0px;
}
ul ul, ul ol, ol ol, ol ul {
margin-bottom: 0;
}
dl {
padding: 0;
}
dl dt {
font-size: 14px;
font-weight: bold;
font-style: italic;
padding: 0;
margin: 15px 0 5px;
}
dl dt:first-child {
padding: 0;
}
dl dt>:first-child {
margin-top: 0px;
}
dl dt>:last-child {
margin-bottom: 0px;
}
dl dd {
margin: 0 0 15px;
padding: 0 15px;
}
dl dd>:first-child {
margin-top: 0px;
}
dl dd>:last-child {
margin-bottom: 0px;
}
/* CODE
=============================================================================*/
pre, code, tt {
font-size: 12px;
font-family: Consolas, "Liberation Mono", Courier, monospace;
}
code, tt {
margin: 0 0px;
padding: 0px 0px;
white-space: nowrap;
border: 1px solid #eaeaea;
background-color: #f8f8f8;
border-radius: 3px;
}
pre>code {
margin: 0;
padding: 0;
white-space: pre;
border: none;
background: transparent;
}
pre {
background-color: #f8f8f8;
border: 1px solid #ccc;
font-size: 13px;
line-height: 19px;
overflow: auto;
padding: 6px 10px;
border-radius: 3px;
}
pre code, pre tt {
background-color: transparent;
border: none;
}
kbd {
-moz-border-bottom-colors: none;
-moz-border-left-colors: none;
-moz-border-right-colors: none;
-moz-border-top-colors: none;
background-color: #DDDDDD;
background-image: linear-gradient(#F1F1F1, #DDDDDD);
background-repeat: repeat-x;
border-color: #DDDDDD #CCCCCC #CCCCCC #DDDDDD;
border-image: none;
border-radius: 2px 2px 2px 2px;
border-style: solid;
border-width: 1px;
font-family: "Helvetica Neue",Helvetica,Arial,sans-serif;
line-height: 10px;
padding: 1px 4px;
}
/* QUOTES
=============================================================================*/
blockquote {
border-left: 4px solid #DDD;
padding: 0 15px;
color: #777;
}
blockquote>:first-child {
margin-top: 0px;
}
blockquote>:last-child {
margin-bottom: 0px;
}
/* HORIZONTAL RULES
=============================================================================*/
hr {
clear: both;
margin: 15px 0;
height: 0px;
overflow: hidden;
border: none;
background: transparent;
border-bottom: 4px solid #ddd;
padding: 0;
}
/* TABLES
=============================================================================*/
table th {
font-weight: bold;
}
table th, table td {
border: 1px solid #ccc;
padding: 6px 13px;
}
table tr {
border-top: 1px solid #ccc;
background-color: #fff;
}
table tr:nth-child(2n) {
background-color: #f8f8f8;
}
/* IMAGES
=============================================================================*/
img {
max-width: 100%
}
-->
pwnable.kr-bof-Writeup
在http://pwnable.kr/bin/bof.c得到C代码如下:
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
void func(int key){
char overflowme[];
printf("overflow me : ");
gets(overflowme); // smash me!
if(key == 0xcafebabe){
system("/bin/sh");
}
else{
printf("Nah..\n");
}
}
int main(int argc, char* argv[]){
func(0xdeadbeef);
return ;
}
在http://pwnable.kr/bin/bof下载文件bof,die查壳如下,无壳,为elf文件 
由题目中的提示Nana told me that buffer overflow is one of the most common software vulnerability. Is that true?可知此题的漏洞为缓冲区溢出,分析C代码: 
- 直接把bof拖到IDA中,通过查找关键字符串跳转到关键函数func:

- 双击a1与s查看地址如下,则二者的地址相差+0x00000008 - (-0x0000002C) = 0x34 = 52


- 因为0xCAFEBABE(即IDA中的-889275714)为小端存储,则可以在get(&s)处可构造输入 '0'*52+0xBE0xBA0xFE0xCA,在Linux中检验,可以得到flag为:daddy, I just pwned a buFFer :)

构造输入时需要注意用 cat - 维持shell;
2017-2-7 19:52;05
pwnable.kr-bof-Writeup的更多相关文章
- pwnable.kr bof之write up
这一题与前两题不同,用到了静态调试工具ida 首先题中给出了源码: #include <stdio.h> #include <string.h> #include <st ...
- 【pwnable.kr】bof
pwnable从入门到放弃,第三题. Download : http://pwnable.kr/bin/bofDownload : http://pwnable.kr/bin/bof.c Runnin ...
- pwnable.kr之bof
打开题目: 先下载题目给我们的两个文件,查看文件信息: 发现没有执行的权限,所以先增加文件bof的执行权限,执行: 没发现啥,然后查看代码, #include <stdio.h> #inc ...
- pwnable.kr simple login writeup
这道题是pwnable.kr Rookiss部分的simple login,需要我们去覆盖程序的ebp,eip,esp去改变程序的执行流程 主要逻辑是输入一个字符串,base64解码后看是否与题目 ...
- 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第二天
3.bof 这题就是简单的数组越界覆盖,直接用gdb 调试出偏移就ok from pwn import * context.log_level='debug' payload='A'*52+p32(0 ...
- pwnable.kr的passcode
前段时间找到一个练习pwn的网站,pwnable.kr 这里记录其中的passcode的做题过程,给自己加深印象. 废话不多说了,看一下题目, 看到题目,就ssh连接进去,就看到三个文件如下 看了一下 ...
- pwnable.kr col之write up
Daddy told me about cool MD5 hash collision today. I wanna do something like that too! ssh col@pwnab ...
- pwnable.kr brainfuck之write up
I made a simple brain-fuck language emulation program written in C. The [ ] commands are not impleme ...
- pwnable.kr login之write up
main函数如下: auth函数如下: 程序的流程如下: 输入Authenticate值,并base64解码,将解码的值代入md5_auth函数中 mad5_auth()生成其MD5值并与f87cd6 ...
随机推荐
- 详解C/C++中的的:#pragma pack(push) 、#pragma pack(pop) 和#pragma pack()
前言 我们知道结构体内存对齐字节可以通过#pragma pack(n) 的方式来指定. 但是,有没有想过一个问题,某些时候我想4字节对齐,有些时候我又想1字节或者8字节对齐,那么怎么解决这个问题呢? ...
- Python入门8 —— 逻辑运算符补充
一:优先级:not > and > or 1.not与紧跟其后的那个条件是不可分割的 2.如果条件语句全部由纯and.或纯or链接,按照从左到右的顺序依次计算即可 print(True a ...
- office2019与Visio2016不能共存解决办法
我们电脑已经安装office2019,可是安装visio2016就会安装不了.只要两个软件同时安装就可以解决了,简单粗暴. 首先把电脑的offic或者visio都卸载了,删除干净. 然后先打开visi ...
- mysql 中LIKE 与FIND_IN_SET 与关联表left join 速度效率比较
有一张表Table有IDStr字段,如下只显示二个字段还有很多其他字段 方式一 字段逗号分割,直接用UserIDStr字段,里面存多个ID用逗号分割 UUID UserIDStr 1111 1,2,3 ...
- TODO:如何模拟cpu打满,磁盘打满,网卡打满
背景: 测试活动中,需要构造cpu打满.磁盘打满.网卡打满的场景 场景1:cpu打满 环境信息: 虚拟机,物理核数16个,每个物理核的虚拟核数1个,虚拟核数16个: [root@vm10-0-0-8 ...
- linux 中对 mysql 数据库的基本命令
显示数据库列表 show databases; 显示库中的数据表 use mysql: // 打开库 show tables; 建库 create database 库名; 建库是设置好字符编码: c ...
- 题解 P4289 【[HAOI2008]移动玩具】
题目地址:https://www.luogu.com.cn/problem/P4289 题解原地址:https://createsj.blog.luogu.org/solution-p4289 让我们 ...
- 【NOI2002】银河英雄传说
[NOI2002]银河英雄传说 这道题暴力模拟会TLE,因为它是并查集的一个应用…… #include<bits/stdc++.h> using namespace std; ],q[], ...
- pybind11简介
python调用C/C++有不少的方法,如boost.python, swig, ctypes, pybind11等,这些方法有繁有简,而pybind11的优点是对C++ 11支持很好,API比较简单 ...
- anniversary party_hdu1520
本来以为是一道很简单的提,可以分分钟解决(实际上就是很简单) 然而一直报错,找半天,竟然要多组输入(还是太菜了) 所以每组需要先初始化, 这是一道树形DP的简单题,具体思路就是我选这个上司就不能选他的 ...