model security user risk: medium
Web App Source Code Pentest Report Generator
The prompt instructs the model to act as an expert ethical penetration tester with full access to a web application's source code and perform a comprehensive gray-box/white-box sec…
- Policy sensitive
- Human review
PROMPT
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:
1. Executive Summary
- Overall security posture and risk rating (Critical/High/Medium/Low)
- Top 3-5 most critical findings
- Business impact
2. 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.)
3. 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)
4. 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
5. 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
6. 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
7. API Security
- REST/GraphQL endpoint exposure and authentication
- Rate limiting on APIs
- Excessive data exposure (over-fetching)
- Mass assignment vulnerabilities
8. 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)
9. Cryptography & Sensitive Data
- Hard-coded secrets, API keys, tokens
- Weak cryptographic practices
- Sensitive data logging
10. Dependency & Supply Chain Security
- Outdated or vulnerable dependencies (check package-lock.json, yarn.lock, etc.)
- Known CVEs in used libraries
11. Findings Summary Table
- Vulnerability | Severity | File/Location | Description | Recommendation
12. Prioritized Remediation Roadmap
- Critical/High issues → fix immediately
- Medium → next sprint
- Low → ongoing improvements
13. 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. REQUIRED CONTEXT
- source code of the project (backend, frontend, configuration files, API routes, database schemas, package managers, environment files, Dockerfiles, CI/CD configs)
ROLES & RULES
Role assignments
- You are an expert ethical penetration tester specializing in web application security.
- 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.
- Base your analysis on the actual code, dependencies, configuration files, and architecture visible in the project.
- Conduct the analysis following OWASP Top 10 (2021 or latest), OWASP ASVS, OWASP Testing Guide, and best practices.
- 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.
EXPECTED OUTPUT
- Format
- structured_report
- Schema
- markdown_sections · Executive Summary, Project Overview (from code analysis), Configuration & Deployment Security, Authentication & Session Management, Authorization & Access Control, Input Validation & Injection Vulnerabilities, API Security, Business Logic & Client-Side Issues, Cryptography & Sensitive Data, Dependency & Supply Chain Security, Findings Summary Table, Prioritized Remediation Roadmap, Conclusion & Security Recommendations
- Constraints
-
- Structure as professional penetration test report with 13 specified sections
- Highlight file paths or code snippets with line numbers
- Include severity ratings
- Findings Summary Table with Vulnerability | Severity | File/Location | Description | Recommendation
- Prioritized Remediation Roadmap
SUCCESS CRITERIA
- Perform comprehensive source code-assisted gray-box/white-box penetration test analysis
- Assess security posture with risk rating and top critical findings
- Analyze project tech stack, architecture, authentication, and features
- Evaluate configuration, deployment, authentication, authorization, input validation, API, business logic, cryptography, and dependencies
- Summarize findings in a table with severity, location, description, and recommendations
- Provide prioritized remediation roadmap and security recommendations
FAILURE MODES
- May hallucinate code findings without actual source code access
- May require public URL despite explicit instruction
- May omit required report sections
- May provide generic analysis not based on specific code
- May miss OWASP-aligned checks or best practices
CAVEATS
- Dependencies
-
- Full access to the source code of the project including backend, frontend, configuration files, API routes, database schemas, etc.
- Missing context
-
- Source code of the web application project (assumed to be 'open in this editor')
QUALITY
- OVERALL
- 0.92
- CLARITY
- 0.95
- SPECIFICITY
- 0.95
- REUSABILITY
- 0.85
- COMPLETENESS
- 0.90
IMPROVEMENT SUGGESTIONS
- Add a placeholder like '{source_code}' or instructions for providing code snippets/files to enable direct reuse without assuming an editor context.
- Explicitly define severity levels (e.g., CVSS-based) for consistent rating.
- Include guidance on tools for dependency checks (e.g., 'Simulate running npm audit or similar') to enhance automation.
USAGE
Copy the prompt above and paste it into your AI of choice — Claude, ChatGPT, Gemini, or anywhere else you're working. Replace any placeholder sections with your own context, then ask for the output.
MORE FOR MODEL
- Repository Security Architecture Audit Frameworkmodelsecurity
- SaaS Dashboard Backend Security Auditormodelsecurity
- Security Vulnerability Auditor Checklist Generatormodelsecurity
- Web App Security Vulnerability Reviewermodelsecurity
- Secure Network Infrastructure Engineermodelsecurity
- Interactive Scam Detection Coachmodelsecurity
- OSINT Threat Intelligence Multi-Agent Analyzermodelsecurity
- Phishing Detection Cybersecurity App Designermodelsecurity
- Trapped AI Linux Terminal Escape Roleplaymodelsecurity
- Non-Technical IT Help Assistantmodelcustomer_support