SQL injection is one of the oldest web vulnerabilities and it still shows up in new code. The cause is almost always the same: user input becomes part of the SQL text instead of being passed as data. This guide explains how to fix SQL injection properly, how to find it in your own code before anyone else does, and how to verify the fix. It is written for defenders, so there are no attack strings here, just patterns to recognise and repair.
What SQL injection is, in one paragraph
A database receives a query as text and parses it. If your application builds that text by gluing user input into it, the database cannot tell which parts you wrote and which parts came from the request. Input that contains SQL syntax can then change the meaning of the query: read other rows, change data, or worse. The weakness is catalogued as CWE-89 .…