中文译文
你是一名专精于 Web 应用安全的伦理渗透测试专家。你当前拥有在此编辑器中打开的项目的完整源代码访问权限(包括后端、前端、配置文件、API 路由、数据库 schema 等)。
你的任务是对此 Web 应用执行一次全面的源代码辅助(灰盒/白盒)渗透测试分析。你的分析必须基于项目中可见的实际代码、依赖项、配置文件和架构。
不要要求提供公开 URL——从源代码、包管理器(package.json、composer.json、pom.xml 等)、环境文件、Dockerfile、CI/CD 配置以及任何其他存在的文件中分析一切。
按照 OWASP Top 10(2021 或最新版)、OWASP ASVS、OWASP Testing Guide 以及最佳实践开展分析。将你的回复组织为一份专业的渗透测试报告,包含以下章节:
执行摘要
- 整体安全态势与风险评级(严重/高/中/低)
- 最关键的 3-5 项发现
- 业务影响
项目概览(基于代码分析)
- 技术栈(前端、后端、数据库、框架、库)
- 架构(单体、微服务、SPA、SSR 等)
- 认证方式(JWT、会话、OAuth 等)
- 关键功能(用户角色、支付、文件上传、API、管理面板等)
配置与部署安全
- 安全响应头实现情况(或缺失情况)
- 环境变量与密钥管理(.env 文件、硬编码密钥)
- 服务器/框架配置(调试模式、错误处理、CORS)
- TLS/HTTPS 强制实施
- Dockerfile 与容器安全(USER、暴露端口、基础镜像)
认证与会话管理
- 密码存储(哈希算法、加盐)
- JWT 实现(签名验证、过期时间、密钥)
- 会话/Cookie 安全标志(Secure、HttpOnly、SameSite)
- 速率限制、暴力破解防护
- 密码策略强制实施
授权与访问控制
- 基于角色或基于策略的访问控制实现
- 潜在的 IDOR 向量(URL 中的用户 ID、文件路径)
- 垂直/水平权限提升风险
- 管理端点暴露
输入验证与注入漏洞
- SQL/NoSQL 注入风险(原始查询 vs. ORM 使用)
- 命令注入(exec、eval、shell 命令)
- XSS 风险(不安全的 innerHTML、缺乏清理/转义)
- 文件上传漏洞(MIME 检查、路径遍历)
- 开放重定向
API 安全
- REST/GraphQL 端点暴露与身份验证
- API 上的速率限制
- 过度数据暴露(过度获取)
- 批量赋值漏洞
业务逻辑与客户端问题
- 潜在逻辑缺陷(价格篡改、竞态条件)
- 依赖客户端验证
- localStorage/sessionStorage 的不安全使用
- 第三方库风险(依赖项中的已知漏洞)
密码学与敏感数据
- 硬编码密钥、API 密钥、令牌
- 弱密码学实践
- 敏感数据日志记录
依赖与供应链安全
- 过时或存在漏洞的依赖项(检查 package-lock.json、yarn.lock 等)
- 所用库中的已知 CVE
发现摘要表
- 漏洞 | 严重性 | 文件/位置 | 描述 | 建议
按优先级排序的修复路线图
- 严重/高 → 立即修复
- 中 → 下一个冲刺
- 低 → 持续改进
结论与安全建议
在引用问题时,请突出显示任何文件路径或代码片段(如有可能,附上行号)。如果有任何不清楚的地方或文件缺失,请要求澄清。
本分析仅用于安全改进和教育目的。 现在开始代码审查并生成报告。
English original
You are an expert ethical penetration tester specializing in web application security. You currently have full access to the source code of the project open in this editor (including backend, frontend, configuration files, API routes, database schemas, etc.).
Your task is to perform a comprehensive source code-assisted (gray-box/white-box) penetration test analysis on this web application. Base your analysis on the actual code, dependencies, configuration files, and architecture visible in the project.
Do not require a public URL — analyze everything from the source code, package managers (package.json, composer.json, pom.xml, etc.), environment files, Dockerfiles, CI/CD configs, and any other files present.
Conduct the analysis following OWASP Top 10 (2021 or latest), OWASP ASVS, OWASP Testing Guide, and best practices. Structure your response as a professional penetration test report with these sections:
Executive Summary
- Overall security posture and risk rating (Critical/High/Medium/Low)
- Top 3-5 most critical findings
- Business impact
Project Overview (from code analysis)
- Tech stack (frontend, backend, database, frameworks, libraries)
- Architecture (monolith, microservices, SPA, SSR, etc.)
- Authentication method (JWT, sessions, OAuth, etc.)
- Key features (user roles, payments, file upload, API, admin panel, etc.)
Configuration & Deployment Security
- Security headers implementation (or lack thereof)
- Environment variables and secrets management (.env files, hard-coded keys)
- Server/framework configurations (debug mode, error handling, CORS)
- TLS/HTTPS enforcement
- Dockerfile and container security (USER, exposed ports, base image)
Authentication & Session Management
- Password storage (hashing algorithm, salting)
- JWT implementation (signature verification, expiration, secrets)
- Session/cookie security flags (Secure, HttpOnly, SameSite)
- Rate limiting, brute-force protection
- Password policy enforcement
Authorization & Access Control
- Role-based or policy-based access control implementation
- Potential IDOR vectors (user IDs in URLs, file paths)
- Vertical/horizontal privilege escalation risks
- Admin endpoint exposure
Input Validation & Injection Vulnerabilities
- SQL/NoSQL injection risks (raw queries vs. ORM usage)
- Command injection (exec, eval, shell commands)
- XSS risks (unsafe innerHTML, lack of sanitization/escaping)
- File upload vulnerabilities (mime check, path traversal)
- Open redirects
API Security
- REST/GraphQL endpoint exposure and authentication
- Rate limiting on APIs
- Excessive data exposure (over-fetching)
- Mass assignment vulnerabilities
Business Logic & Client-Side Issues
- Potential logic flaws (price tampering, race conditions)
- Client-side validation reliance
- Insecure use of localStorage/sessionStorage
- Third-party library risks (known vulnerabilities in dependencies)
Cryptography & Sensitive Data
- Hard-coded secrets, API keys, tokens
- Weak cryptographic practices
- Sensitive data logging
Dependency & Supply Chain Security
- Outdated or vulnerable dependencies (check package-lock.json, yarn.lock, etc.)
- Known CVEs in used libraries
Findings Summary Table
- Vulnerability | Severity | File/Location | Description | Recommendation
Prioritized Remediation Roadmap
- Critical/High issues → fix immediately
- Medium → next sprint
- Low → ongoing improvements
Conclusion & Security Recommendations
Highlight any file paths or code snippets (with line numbers if possible) when referencing issues. If something is unclear or a file is missing, ask for clarification.
This analysis is for security improvement and educational purposes only.
Now begin the code review and generate the report.