博客
关于我
攻防世界-pwn-200-Writeup
阅读量:572 次
发布时间:2019-03-09

本文共 2103 字,大约阅读时间需要 7 分钟。

pwn-200 Vulnerability Analysis

Overview of the Issue

The sub_8048484 function in the provided code is vulnerable to a stack overflow attack. This function reads data into a buffer using read(0, &buf, 0x100u) which can cause a stack overflow if not handled correctly. The vulnerable code is:

ssize_t sub_8048484() {    char buf;    setbuf(stdin, &buf);    return read(0, &buf, 0x100u); // Overflow here}

Exploiting the Vulnerability

To exploit this vulnerability, we need to analyze how the stack buffer works. The function uses a single-byte buffer and attempts to read data directly into the stack without proper bounds checking. Exploiting this requires understanding how the stack is structured and how overflow affects it.

The key to this exploit is to identify the location where the return address is stored after the stack overflow. By overwriting the return address, we can control the program's flow and gain arbitrary code execution.

Finding libc Base

Using the provided exploit code, the following steps can be taken:

  • Identify the libc base

    After successful exploitation, we can leak the memory address of the write function from libc6-i386_2.23-0ubuntu11_amd64.so. This is done by sending a crafted payload that forces the program to use the overwritten return address as the write function's target.

  • Calculate libc_base

    Once the write function's address is identified, we subtract the libc.symbols['write'] value from it to get the base address of libc.

  • Identify system() Function

    With libc_base, we can find the system() function's address and eventually gain a shell using /bin/sh.

  • Exploit Execution

    The provided remote exploit code demonstrates how to:

  • Bypass stack guard pages by sending a payload that triggers the stack overflow.
  • Update the return address to point to the write function's address.
  • Read the leaked memory address to find the write function's base, hence determining the libc_base.
  • Use system() for shelling out by leveraging binsh from libc.
  • By following these steps, a full RDI (Remote Differential Exploit) can be achieved, allowing for full control over the system.

    转载地址:http://amppz.baihongyu.com/

    你可能感兴趣的文章
    PHP文件锁
    查看>>
    php文本框输入制定文本,php – 当用户没有向文本框输入任何内容时...
    查看>>
    PHP时间戳和日期相互转换操作总结
    查看>>
    php时间戳知识点,php 时间戳函数总结与示例
    查看>>
    php更新数据库失败,php – 无法更新MySQL数据库
    查看>>
    php机器人聊天对话框,基于AIML的PHP聊天机器人
    查看>>
    PHP查找数组中最大值与最小值
    查看>>
    php查最大值,在PHP数组中查找最大值
    查看>>
    php标签筛选,关于PHP CodeIgniter框架中通过<a>标签和url做多条件分类筛选
    查看>>
    php根据年月日计算年龄
    查看>>
    RabbitMQ - 单机部署(超详细)
    查看>>
    php检查注册,PHP检查注册的电子邮件地址是一个’school.edu’地址
    查看>>
    php模拟发送GET和POST请求
    查看>>
    RabbitMQ - 以 MQ 为例,手写一个 RPC 框架 demo
    查看>>
    php模板引擎smarty
    查看>>
    php正则表达式模式
    查看>>
    php正则表达式的特殊字符含义
    查看>>
    PHP正则表达式获取武汉市的实时pm2.5数据并邮件发送phpmailer
    查看>>
    RabbitMQ + JMeter组合,优化你的中间件处理方式!
    查看>>
    PHP水仙花问题解法之一
    查看>>