Skip to content

Demo: Java app vulnerable to SQL injection#2

Open
Kirill89 wants to merge 1 commit into
mainfrom
demo/sql-injection-vulnerability
Open

Demo: Java app vulnerable to SQL injection#2
Kirill89 wants to merge 1 commit into
mainfrom
demo/sql-injection-vulnerability

Conversation

@Kirill89
Copy link
Copy Markdown
Member

Summary

  • Adds an intentionally vulnerable Java demo app for SQL injection testing/demos
  • UserLogin.login concatenates username/password into a Statement query
  • ProductSearch.searchByName / deleteById concatenate input into LIKE and DELETE queries
  • Minimal Maven pom.xml with sqlite-jdbc dependency

Test plan

  • Confirm classes compile under Java 11 (mvn compile)
  • Verify SAST / Mobb picks up the SQL injection sinks in both files
  • Sanity-check the suggested fixes use PreparedStatement with bound parameters

⚠️ This code is deliberately vulnerable and is for demo/testing only. Do not deploy.

🤖 Generated with Claude Code

Intentionally vulnerable code for security testing/demo purposes.
UserLogin and ProductSearch concatenate user input directly into
SQL statements via java.sql.Statement.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.

1 participant