Think & Verify
What it does
The VulnSage framework uses structured prompts of increasing complexity to detect code vulnerabilities. Key element — Think & Verify strategy with two-phase analysis: explicit documentation of thinking process and subsequent verification with confidence assessment. Reduces answer uncertainty from 20.3% to 9.1% and significantly increases detection accuracy.
When it helps
Apply this technique when analyzing program code for security vulnerabilities, when high accuracy and justified conclusions are required. Especially effective for critical systems where the cost of error is high. Use the Think & Verify approach when you need to reduce uncertainty in model responses and get confidence assessment of conclusions. The method is suitable for situations where transparency of decision-making process is important and self-checking of results is necessary. Ideal for integration into CI/CD.
A prompt you can paste
Generic by design: it applies the technique without knowing your task. Adapt the marked parts.
# Role
You are an AI assistant specialized in cybersecurity and vulnerability detection.
# Task
Analyze the provided code snippet for potential vulnerabilities using the "Think & Verify" methodology.
# Context
The code is intended for [Specify the purpose of the code, e.g., a web application backend, a data processing script, a network utility].
The programming language is [Specify the programming language, e.g., Python, Java, C++, JavaScript].
# Methodology: Think & Verify
## Phase 1: Thinking & Analysis
This phase involves initial reasoning and identification of potential issues.
### Thinking Process:
- **Analyze Code Structure:** Examine the overall architecture, control flow, and key functions of the provided code.
- **Identify Potential Vulnerability Patterns:** Look for common vulnerability types such as:
- Injection flaws (SQL, Command, etc.)
- Broken Authentication and Session Management
- Cross-Site Scripting (XSS)
- Insecure Deserialization
- Sensitive Data Exposure
- Security Misconfiguration
- Using Components with Known Vulnerabilities
- Insufficient Logging & Monitoring
- Access Control issues
- [Add any other specific vulnerability types relevant to the context]
- **Assess Attack Surface:** Determine the parts of the code that are exposed to external input or interaction.
- **Analyze Function Interactions:** Understand how different functions and modules communicate and what data is passed between them.
- **Evaluate Security Controls:** Check for the presence and effectiveness of any implemented security measures (e.g., input validation, sanitization, encryption).
### Initial Findings:
- List any suspicious code segments or patterns observed.
- Note potential areas where inputs are not properly validated or sanitized.
- Highlight any dependencies that might have known vulnerabilities.
- Describe any logical flaws that could be exploited.
## Phase 2: Verification & Confidence Assessment
This phase involves re-evaluating the initial findings and assessing confidence.
### Verification Process:
- **Re-verify Each Identified Risk:** For every potential vulnerability found in Phase 1, critically re-examine the code.
- **Eliminate False Positives:** Discard any identified issues that are not actual vulnerabilities upon closer inspection or due to context.
- **Confirm Interpretation:** Ensure that the interpretation of the code and potential risks is accurate and not based on assumptions.
- **Consider Alternative Interpretations:** Explore if there are other valid ways the code could be interpreted or if the identified risk has mitigating factors not immediately apparent.
- **Check for Mitigating Controls:** Confirm if any identified risks are adequately mitigated by other parts of the code or system configuration.
### Final Assessment:
- **Confirmed Vulnerabilities:** List all confirmed vulnerabilities with a clear description of the issue and the affected code location(s).
- **Severity Level:** Assign a severity level (e.g., Critical, High, Medium, Low) to each confirmed vulnerability.
- **Recommendations for Remediation:** Provide specific, actionable steps to fix each confirmed vulnerability.
- **Confidence Score:** Assign an overall confidence score (0-100%) to the accuracy of the vulnerability detection and assessment.
# Code Snippet to Analyze
[PASTE CODE SNIPPET HERE]
If this one does not fit, the two closest alternatives in the corpus are Anti-Bias Prompting and Tabular Prompting, which target the same failure from a different angle.
Worked example
The same technique applied to a concrete job: review a pull request and report only real defects. Use it as the pattern for your own case rather than as a finished artefact.
# Role You are an expert AI assistant specialized in software security and code review. Your primary function is to detect real defects in code. # Context The task is to review a pull request (PR) and identify only actual defects. This requires a rigorous approach to avoid false positives and ensure the accuracy of the findings. # Technique: Think & Verify (Zero-Shot Vulnerability Detection) You will apply a two-phase structured reasoning process: ## Phase 1: Thinking and Analysis Perform a detailed analysis of the provided code. Document your thought process and initial findings. **Task Breakdown:** - **Analyze Code Structure:** Understand the overall architecture, file organization, and dependencies of the changes in the PR. - **Identify Potential Vulnerabilities:** Scan for common vulnerability patterns (e.g., SQL injection, XSS, insecure deserialization, buffer overflows, race conditions, logic errors). - **Evaluate Attack Surface:** Determine how the changes might expose new attack vectors or increase the existing attack surface. - **Analyze Function Interactions:** Examine how the modified functions interact with other parts of the system, especially concerning data flow and security controls. - **Assess Logic and Implementation:** Scrutinize the business logic and implementation details for flaws, edge cases, and potential misinterpretations. **Output for Phase 1 (`<thinking>` and `<findings>`):**
Get this written for your actual task
Paste what you are trying to do and the corpus will be matched against it directly. Free, no account, about ten seconds.
single retrieval pass
That number is low on purpose, and it is real. It is the raw similarity of one retrieval pass: no specialist read the paper, no judge compared anything, the first plausible match won.
one of which is this page
Picking the right one for a specific task is the work, and it is the work GetDecision does.
| This page | one technique, generic prompt |
| What you just ran | one technique matched to your wording, nothing verified |
| Full run | ten specialists read the papers in full, a judge ranks the top three for your task and shows its reasoning, generation on the model you pick, saved to your history |
See the top three for your taskTen specialists, a judge, and the reasoning shown. Free account, first run included.
Run the full analysis