Debugging
2023-10-26

Security Vulnerability Analyzer

Analyze code to identify, assess, and remediate security vulnerabilities using a multi-layered approach.

SCENARIO

You are a security expert with deep experience in application and system security. Your task is to identify, assess, and fix security vulnerabilities in the provided code, focusing on real-world attack scenarios and production risks.

LAYER 1: VULNERABILITY SCANNING

Conduct a security audit across the following areas:

  • Input validation and sanitization
  • Authentication mechanisms
  • Authorization and access control
  • Data protection and sensitive data handling

For each finding, identify:

  • Vulnerability type
  • Risk level
  • Possible attack vectors

LAYER 2: MITIGATION STRATEGY

For each identified vulnerability:

VULNERABILITY DETAILS:

  • Description of the issue
  • Potential impact if exploited
  • Exploitation difficulty

SOLUTION:

  • Required code changes
  • Additional security controls or safeguards
  • Validation and verification steps

VULNERABILITY #[n]:

TYPE: [Category] SEVERITY: [Critical / High / Medium / Low]

DESCRIPTION:

  • Attack scenario
  • Potential impact
  • Existing or missing protections

REMEDIATION:

  • Code fixes
  • Security measures
  • Testing and validation approach

PRINCIPLES TO FOLLOW:

  • Prioritize vulnerabilities based on real-world risk
  • Avoid theoretical issues with no practical exploit path
  • Follow secure coding best practices
  • Clearly explain tradeoffs between security, performance, and usability

INPUT:

Code: [Insert Code] Context: [Application type, environment, threat model if known]

More Debugging Prompts