Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

There is a vulnerability in your project - SQL injection #1

Open
toothless-c opened this issue Jan 3, 2024 · 0 comments
Open

There is a vulnerability in your project - SQL injection #1

toothless-c opened this issue Jan 3, 2024 · 0 comments

Comments

@toothless-c
Copy link

Vulnerability exists:
In the where condition section of the searchByKey SQL query statement, concatenating the keyword parameter directly and using it for the SQL LIKE operator can lead to SQL injection attacks
微信截图_20240103123925
Vulnerability recurrence:
image

Repair suggestions:
Use MyBatis's OGNL expression or precompiled parameter binding instead of string concatenation to avoid SQL injection. Here, replace ${keyword} with # {keyword}. MyBatis will automatically handle parameter binding and escape to effectively prevent SQL injection.
At the same time, the LIKE condition is optimized to keep one keyword that can match any position.

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

No branches or pull requests

1 participant