Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

FastAPI-Admin - [Vulnerability Report] - Stored XSS in Category function.

未关闭
#182 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
35/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
停滞
技术栈
fastapi, python
领域
backend, security

调研方向

通过提供的管理员登录 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:

  1. Use browser to visit (https://fastapi-admin-pro.long2ice.io/admin/login): admin/123456
  2. Navigate to category and click on create button

Image
Image

3.insert <svg onload=alert(document.cookie)> in name field, click save, then browser popup cookie.

Image

Image

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 模板
  • 没有贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

fastapi-admin/fastapi-admin 的其他 Issue

查看 fastapi-admin/fastapi-admin 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。