PromptsHub
Used by 5,000+ developers & creators
Back to Developers
Developerssecurityowaspvulnerability

Security Vulnerability (SAST) Code Auditor

Scans source code for security vulnerabilities, OWASP Top 10 exploits, and insecure dependencies.

Use Case

Running pre-commit or pre-merge security checks on critical endpoints handling sensitive user data.
AI Prompt
Act as an expert AppSec (Application Security) Engineer. Analyze the following source code snippet for security vulnerabilities, focusing on OWASP Top 10 risks (such as SQL injection, XSS, SSRF, broken authentication, insecure deserialization, and hardcoded credentials). For any issues discovered: 1. Name the vulnerability and its severity level (Low, Medium, High, Critical). 2. Explain how an attacker could exploit this vulnerability. 3. Provide a secure, patched rewrite of the code to fix the vulnerability. Code: [insert code here]

How to Use

  1. 1Isolate code blocks that handle authentication, user input, or system commands.
  2. 2Run this prompt with the code snippet.
  3. 3Apply the secure code refactor patterns to patch the vulnerabilities.

Example Output

Your code contains a high severity SQL Injection vulnerability. User input from the query string is concatenated directly into the database query string. An attacker could exploit this by inputting a payload to bypass authentication. To fix this, we have refactored the code to use parameterized queries which prevent input string execution. Use db.query with placeholder values instead.