fix(security): 修复 XSS、CSRF、OAuth 账户接管三个高危安全漏洞#183
Draft
mafei2023 wants to merge 1 commit into
Draft
Conversation
1. 修复 ContentRender.tsx 存储型 XSS:将 innerHTML 改为 textContent,防止通过项目描述注入恶意脚本窃取 session cookie 2. 添加 CSRF 防护:Session Cookie 设置 SameSite=Lax,新增后端 CSRF 中间件校验 X-Requested-With 头,前端 axios 和 middleware 自动附加 3. 修复 OAuth 用户名冲突账户接管:冲突时拒绝登录而非禁用已有用户
yyg-max
reviewed
May 31, 2026
Collaborator
There was a problem hiding this comment.
这里是在处理L站用户注销而在cdk系统继续存在的场景
Collaborator
|
请更新你的源分支,并确保能通过 Workflow; |
|
此 PR 长期无活动,将在 14 天后自动关闭。如需继续讨论请回复 |
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.
例行检查
变更内容
修复 3 个高危安全漏洞:
插入,浏览器自动转义。
自定义头。
变更原因
攻击者可利用上述漏洞:通过项目描述注入 XSS 窃取任意用户 session;通过 CSRF 修改他人支付凭据转移收入;通过 OAuth 用户名冲突永久禁用任意用户账户。均为零交互或低交互即可利用的漏洞,需立即修复。
攻击示例
攻击者注册账户后创建项目,项目描述中写入:
当任意用户浏览该项目详情页时,图片加载失败触发 onError,${alt || src} 被直接插入 innerHTML,恶意脚本执行,用户的 session cookie 被发送到攻击者服务器。攻击者使用该 cookie
即可完全接管受害者账户,访问其所有项目、支付配置和领取记录。
攻击者构造恶意页面并诱导已登录用户访问:
用户浏览器自动携带 cookie 提交表单,后端将受害者的支付凭据替换为攻击者的。此后受害者创建的付费项目,所有收入将转入攻击者账户。
目标用户 alice(OAuth ID: 100)已注册。攻击者在 OAuth 提供方获取用户名 alice,然后用该账号登录 CDK。系统检测到用户名冲突,直接将原用户 alice 改名为 alice已注销: {uuid}
并设置 is_active = false。目标用户从此无法登录,且无任何通知或恢复途径。