CyberSec Notes
  • Bienvenida
    • CyberSec Notes
  • Network Services
    • Port 21 - FTP
    • Port 22 - SSH
    • Port 23 - Telnet
    • Port 25 - SMTP
    • Port 53 - DNS
      • Deploy DNS Server with BIND
    • Port 80/443 - HTTP/HTTPS
      • Wordpress
      • CMS Made Simple (CMSMS)
    • Port 88 - Kerberos
    • Port 386, 636, 3268, 3269 - LDAP
    • Port 445 - SMB
    • Port 1521,1522-1529 - Oracle TNS Listener
    • Port 3128 - Squid
    • Port 5985, 5986 - WinRM
  • Command && Control
    • Sliver C2 [in progress]
  • Ataques en Entornos Windows
    • MalDev
      • AV Evasion
        • Function call obfuscation
      • Code Samples
        • Shellcode Execution C#
        • Shellcode Execution C++
        • Stager HTTP C#
        • Stager HTTP C++
        • Process Inyection C++
        • Process Inyection C#
        • XOR Encrypt C++
    • Directorio Activo
      • Spriying
      • Autenticacion Net-NTLMv2 y tipos de hashes
        • Pass the Hash
        • SMB Relay
      • Autenticación Kerberos
        • Extensiones del protocolo Kerberos (SPNs & PACs)
        • AS_REP Roasting
        • Kerberoasting
        • Silver Ticket Attack
        • Golden Ticket Attack
      • DCSync
      • Mimikatz
      • BloodHound
      • Privilege Escalation
        • PS Credentials in XML format
      • Utils
    • Amsi Bypass
    • Buffer Overflow
      • Stack Based 32 bits [in progress]
        • Windows SLMail 5.5
  • Ataques en Entornos Linux
    • Privilege escalation [in progress]
    • MalDev
      • Simple Reverse Shell
    • Buffer Over Flow
      • Stack Based 32 bits
        • Linux, Vulnerable functions in C programs
    • Persistencia
  • General
    • Host Discovery
    • Reverse Shells Cheet Sheet
    • Pivoting
      • Chisel
      • Port Forwarding
      • Nmap con pivoting
    • Google Dorks [in progress]
    • Denial of Service (DoS)
      • Low and Slow
    • Docker
  • Pentesting Web
    • XML External Entity Injection(XXE)
      • Portswigger Lab #1: Retrieve Files
      • Portswigger Lab #2: Perform SSRF
      • Portswigger Lab #6: Blind XXE to retrieve data via error messages
    • Open Redirect
    • LFI
      • Log Poisoning (Apache, SSH y SMPT)
  • Wireless Pentesting
    • Pre Connection Attacks
      • WEP
      • WPA/WPA2
    • Post Connection Attacks
      • ARP Spoof
    • Fake AP for Captive Portal
Powered by GitBook
On this page
  • Qué es XML
  • Document Type Definition
  • DTD Elements
  • DTD Attributes
  • DTD Entities
  • Explotación
  1. Pentesting Web

XML External Entity Injection(XXE)

PreviousDockerNextPortswigger Lab #1: Retrieve Files

Last updated 1 year ago

Qué es XML

Extensible Markup Language, o también abreviado XML es un lenguaje diseñado para transportar información entre un cliente y un servidor en un formato que va a ser interpretado (una vez es enviado al backend) por una API para realizar alguna tarea. A diferencia de HTML que tiene etiquetas predefinidas, acá se utiliza el nombre que el desarrollador haya elegido ponerle. Las etiquetas están en formato de árbol, por lo que se comienza con una etiqueta raíz y se sigue con las etiquetas hijas, las etiquetas hijas pueden tener hermanas y padres.

Ejemplo de uso

##The XML prolog is optional. If it exists, it must come first in the document. 
<?xml version="1.0" encoding="UTF-8"?>
<note>
  <to>Tove</to>
  <from>Jani</from>
  <heading>Reminder</heading>
  <body>Don't forget me this weekend!</body>
</note> 

Document Type Definition

Abreviados DTD, sirven para definir la estructura y sintaxis de un documento XML, describiendo los elementos, estructura y como se van a anidar las etiquetas en el documento.

DTD Elements

Los elementos de un DTD son básicamente las etiquetas que vamos a estar utilizando, estas pueden contener texto, otros elementos o estar en blanco.

<producto>Heladera</producto>
<precio>14.999</precio>

DTD Attributes

Estos proveen información de los atributos de un elemento.

<data type="message">Some text</data>

DTD Entities

Las entidades sirven para representar información o caracteres especiales en un DTD. Algunos ejemplos son:

Entidad
Valor

&lt;

<

&gt;

>

&amp;

&

Sintaxis

<!ENTITY entity-name "entity-value"> 

Internal Entity

<!ENTITY writer "Donald Duck.">
<!ENTITY copyright "Copyright W3Schools.">


<author>&writer;&copyright;</author>

External Entity

<!ENTITY writer SYSTEM "https://www.w3schools.com/entities.dtd">
<!ENTITY copyright SYSTEM "https://www.w3schools.com/entities.dtd">

<author>&writer;&copyright;</author>

Explotación

La explotación de las entidades externas se la realiza declarando una entidad externa apuntando ya sea a una url o con algun wrapper apuntando a archivos internos de la máquina, por ejemplo:

<!DOCTYPE foo [ <!ENTITY xxe SYSTEM "http://normal-website.com" > ]>
<!DOCTYPE foo [ <!ENTITY xxe SYSTEM "file:///path/to/file" > ]>

XML Introduction
Logo