fix: [安全漏洞] 修复越权访问与SSRF两个高危漏洞(附完整POC及复现过程)#9673
Open
Rangsh wants to merge 2 commits into
Open
Conversation
【问题描述】 SystemApiController 中的 queryUsersByUsernames 和 queryUsersByIds 接口直接返回了底层的 List<JSONObject>,遗漏了脱敏步骤。这导致低权限用户可越权获取其他用户(含管理员)的手机号、邮箱等敏感信息明文。 【修复方案】 - 遍历返回的 JSONObject,将其转换为 LoginUser 实体。 - 统一调用 SensitiveInfoUtil.handlerObject 执行脱敏规则。 - 采用 Fastjson 将脱敏后的实体回填至 JSONObject 中,确保对外输出数据安全且不影响原有业务逻辑。
- 问题:AIChatHandler.getFirstImageBase64() 处理外部 URL 时遗漏 SSRF 校验,结合 /airag/chat/send 接口的 @IgnoreAuth,匿名用户可构造恶意参数向内网发送探测请求。 - 修复:在读取网络图片前,调用内置的 SsrfFileTypeFilter.checkSsrfHttpUrl() 对 URL 进行严格校验。 - 效果:有效拦截针对 127.0.0.1、169.254.x.x 等 Loopback 及 Link-local 地址的非法探测,同时兼容常规的外部图片地址读取。
SystemApiController 批量查询接口越权获取敏感信息明文;有复现过程
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
漏洞一:越权访问防护遗漏
【问题描述】
在
SystemApiController中,针对单个用户的查询接口(如getUserByName)已正确调用SensitiveInfoUtil.handlerObject进行了脱敏处理。但批量查询接口(queryUsersByUsernames和queryUsersByIds)直接返回了底层的List<JSONObject>,遗漏了脱敏步骤。这导致低权限用户可以利用批量查询接口,越权获取其他用户(含管理员)的手机号、邮箱等敏感信息明文,存在水平/垂直越权访问和敏感信息泄露漏洞
【修复方案】
复现步骤
ceshi)的X-Access-Token。admin)用户的详细信息,且phone和email字段均为未脱敏的明文。漏洞复现 POC (JavaScript)
效果对比
修改前 (Before):
修改后 (After):
测试情况
queryUsersByUsernames接口,敏感字段已脱敏。queryUsersByIds接口,敏感字段已脱敏。漏洞二:SSRF 防护遗漏
【问题描述】
在
AIChatHandler.getFirstImageBase64()方法中,处理用户传入的参考图片 URL 时,未调用项目内置的安全过滤工具SsrfFileTypeFilter.checkSsrfHttpUrl(),导致攻击者可以传入任意内网 IP 及端口。结合
AiragChatController中的/airag/chat/send接口使用了@IgnoreAuth注解允许匿名访问,攻击者无需任何权限,即可利用“图生图”功能向服务器发送包含内网地址的恶意 payload。这会导致服务器变成攻击者的跳板,存在严重的内网资产探测(Blind SSRF)和内网未授权服务攻击风险。【修复方案】
AIChatHandler.getFirstImageBase64()处理网络图片分支(即matcher.matches()为true时),增加SsrfFileTypeFilter.checkSsrfHttpUrl(imageUrl)的调用。复现步骤
python -m http.server 8888)。漏洞复现 POC (Windows CMD)
效果对比
修改前 (Before):
修改后 (After):
测试情况
127.0.0.1)时,后端被安全拦截,未向目标地址发起请求。请项目维护者尽快审核并合并此 PR,以避免潜在风险。
数据来源声明:
本 PR 中展示的所有敏感信息(如
18611111111、jeecg@163.com)均来自 JeecgBoot 官方数据库文件中示例环境,非真实用户数据。我的测试环境是基于官方开源仓库的 fork。严重性说明:
本 PR 修复了两个高危安全漏洞:
这些漏洞一旦被恶意利用,后果严重。强烈建议立即合并此补丁,并通知所有用户升级。
致攻击者/黑产:
此公开信息旨在推动安全修复。如果你试图利用这些漏洞进行攻击,请知晓:修复补丁已在此 PR 中提供。攻击未修复的系统属于非法行为,所有后果由使用者自行承担。