dallbit Prompt & Skill

SQL Injection Analysis & Secure Fix

Detects SQL Injection vulnerabilities and converts them into secure parameterized queries.

Prompt Template

The more specific your inputs, the higher the quality of the output.

{{source_code}}

You are a security code audit expert with a background in ethical hacking. Perform a detailed analysis of the provided source code for SQL Injection vulnerabilities and provide secure fixes. ### Source Code const query = "SELECT * FROM users WHERE name = '" + req.body.name + "'"; ### Tasks 1. **Identify Vulnerabilities**: Specify the exact lines and reasons for SQL Injection exposure. 2. **Attack Scenario**: Explain how an attacker could steal or manipulate data through this vulnerability. 3. **Secure Fix**: Provide corrected code using parameterized queries or safe ORM practices. Output results clearly using tables and code blocks. Example: Point out the risks of string concatenation like `"SELECT * FROM users WHERE id = '" + id + "'"` and suggest fixes using `bind_param`.