FastAPI-Admin - [Vulnerability Report] - Stored XSS in Category function.
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 35/100
调研方向
通过提供的管理员登录 URL 和 Category 创建流程复现该报告,然后跟踪 Category Name 的存储位置,以及它在列表或详情视图中的渲染位置。完成的标准是:打开这些视图时,提供的 SVG payload 不再执行,同时现有的 Category 数据仍能安全显示。
由索引模型根据 Issue 内容生成。
描述
A stored XSS vulnerability was discovered in the Category module of FastAPI-Admin. Malicious JavaScript code injected into a form field (e.g. Category Name) is stored in the backend and rendered without proper sanitization. When an admin or any user visits the category list or detail view, the script executes in their browser context.
Steps To Reproduce:
- Use browser to visit (https://fastapi-admin-pro.long2ice.io/admin/login): admin/123456
- Navigate to category and click on create button
3.insert <svg onload=alert(document.cookie)> in name field, click save, then browser popup cookie.
Mitigation & Recommendation:
### To prevent stored XSS and reduce the attack surface:
1. Input Sanitization:
• Sanitize all user-supplied input before storage using libraries like bleach in Python to strip/escape dangerous HTML/JavaScript content.
2. Output Encoding:
• Ensure all dynamic content is properly HTML-encoded before rendering into templates or views.
• Apply context-aware encoding (e.g., HTML, JS, URL) based on where the data is rendered.
3. Set HttpOnly on Cookies:
- 主要语言
- Python
- 星标
- 3.8k
- 派生
- 466
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
- 提供 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 没有贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
fastapi-admin/fastapi-admin 的其他 Issue
-
难度 1/5 1 小时以内 新手友好度 62/100
fastapi-admin/fastapi-admin#187 ·
-
难度 4/5 3-5 天 新手友好度 30/100
fastapi-admin/fastapi-admin#197 ·
-
难度 5/5 一周以上 新手友好度 20/100
fastapi-admin/fastapi-admin#196 ·
-
难度 5/5 一周以上 新手友好度 10/100
fastapi-admin/fastapi-admin#194 · 2 条评论 ·
-
支持代理站吗未关闭
难度 5/5 一周以上 新手友好度 20/100
fastapi-admin/fastapi-admin#193 ·
查看 fastapi-admin/fastapi-admin 的全部 Issue
相似的 Issue
-
难度 1/5 1 小时以内 新手友好度 88/100
-
难度 1/5 1 小时以内 新手友好度 92/100
QuantEcon/lecture-python-programming#642 ·
维护者通常 1 天内回复
-
area/config area/profiles comp/cli needs-decision P3 sweeper:risk-compatibility type/feature
难度 2/5 1-3 小时 新手友好度 82/100
NousResearch/hermes-agent#133697 ·
维护者通常 1 天内回复
-
enhancement needs-triage
难度 1/5 1 小时以内 新手友好度 72/100
维护者通常 1 天内回复
-
core
难度 2/5 1-3 小时 新手友好度 88/100
vectorize-io/hindsight#5279 ·
维护者通常 1 天内回复