Skip to content

fix: parameterize SQL query in /user endpoint to prevent SQL injection#63

Open
hacktron-app-stg[bot] wants to merge 1 commit into
vuln-demo-multifrom
hacktron/fix-4067728d
Open

fix: parameterize SQL query in /user endpoint to prevent SQL injection#63
hacktron-app-stg[bot] wants to merge 1 commit into
vuln-demo-multifrom
hacktron/fix-4067728d

Conversation

@hacktron-app-stg

Copy link
Copy Markdown

Vulnerability

The /user endpoint was vulnerable to SQL Injection because user input from the id query parameter was concatenated directly into the SQL query string.

Fix

Modified vulnerable-app.js to use parameterized queries with placeholders (?) provided by the mysql library, ensuring that user input is properly escaped and treated as a literal value rather than executable SQL.

Verification

  • Verified syntax correctness of the modified file using node -c.
  • Inspected the diff to ensure a minimal, clean, and correct fix.

Automated fix by Hacktron for finding: https://staging.hacktron.ai/testestesttest/findings/4067728d-d920-494d-9270-c531c4e91d77

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants