You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/generic-hacking/tunneling-and-port-forwarding.md
+24Lines changed: 24 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -816,6 +816,29 @@ Because Tiny Core is stateless, attackers usually:
816
816
• Block outbound connections that originate from `qemu-system*.exe`.
817
817
• Hunt for rare listening ports (2222, 10022, …) binding immediately after a QEMU launch.
818
818
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
+
819
842
---
820
843
821
844
## Other tools to check
@@ -827,6 +850,7 @@ Because Tiny Core is stateless, attackers usually:
827
850
828
851
- [Hiding in the Shadows: Covert Tunnels via QEMU Virtualization](https://trustedsec.com/blog/hiding-in-the-shadows-covert-tunnels-via-qemu-virtualization)
829
852
- [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/)
Copy file name to clipboardExpand all lines: src/network-services-pentesting/pentesting-web/microsoft-sharepoint.md
+25-17Lines changed: 25 additions & 17 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -57,6 +57,15 @@ Sending a crafted `Source` parameter to `ToolPane.aspx` (e.g. `../../../../web.c
57
57
*`<machineKey validationKey="…" decryptionKey="…">` ➜ forge ViewState / ASPXAUTH cookies
58
58
* connection strings & secrets.
59
59
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
+
60
69
## 3. Post-exploitation recipes observed in the wild
61
70
62
71
### 3.1 Exfiltrate every *.config* file (variation-1)
@@ -149,30 +158,28 @@ Recent incident-response investigations (Unit42 “Project AK47”) show how att
149
158
> [!INFO]
150
159
> The same static Tox ID found in X2ANYLOCK appears in leaked LockBit databases, suggesting affiliate overlap.
151
160
152
-
---
161
+
### 3.5 Turning SharePoint loot into lateral movement
153
162
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.
155
166
156
-
| Telemetry | Why it is suspicious |
157
-
|-----------|----------------------|
158
-
|`w3wp.exe → cmd.exe`| Worker process should rarely spawn shell |
| 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
162
168
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.
164
171
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:
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.
170
181
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
+
---
176
183
177
184
## Related tricks
178
185
@@ -189,5 +196,6 @@ proc where parent_process_name="w3wp.exe" and process_name in ("cmd.exe","powers
-[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/)
Copy file name to clipboardExpand all lines: src/pentesting-web/deserialization/exploiting-__viewstate-parameter.md
+25-1Lines changed: 25 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -126,6 +126,29 @@ In cases where `_VIEWSTATEGENERATOR` parameter **isn't sent** by the server you
126
126
--apppath="/" --path="/hello.aspx"
127
127
```
128
128
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:
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:
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
+
129
152
### Test Case: 3 – .Net < 4.5 and EnableViewStateMac=true/false and ViewStateEncryptionMode=true
130
153
131
154
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.
## 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
+
129
145
## CrackMapExec
130
146
131
147
### Dump SAM hashes
@@ -321,9 +337,54 @@ type outpwdump
321
337
322
338
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.
323
339
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:
***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:
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:
* 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
325
386
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/)
0 commit comments