October 24, 2026 · 3 min read

SQL Injection
වසර 27ක් පැරණි Security Vulnerability එකක් තවමත් ලෝකයේ ප්රධාන Security අවදානම් 10 අතරට (OWASP Top 10) එන්නේ ඇයි? ඇයි මේ පැරණි Vulnerability එක තවමත් ප්රශ්නයක් වෙන්නේ? SQL Injection කියන්නේ මොකක්ද?
Encoding vs Encryption vs Hashing: Are They All the Same?
Imagine you are sending data through an API, downloading a file, or logging into a website. Whenever we talk about data processing and security in these situations, we often come across three terms: Encoding, Encryption, and Hashing. But do you know the difference between them?
Encoding vs Encryption vs Hashing තුනම එකම දේද?
අපි API එකක් හරහා data යවනවා. File එකක් download කරනවා. Website එකක login වෙනවා කියල හිතන්න. මේ හැම තැනකම data processing සහ security ගැන කතා කරනකොට Encoding, Encryption සහ Hashing කියන terms තුන අහන්න ලැබෙනවා. නමුත් මේ තුනේ වෙනස දන්නවාද?
Why Is a 27 Year Old Security Vulnerability Still Among the World's Top 10 Security Risks (OWASP Top 10)?
Why is this old vulnerability still a problem?
What is SQL Injection?
The OWASP Top 10 is a globally recognized list that highlights the 10 major risks in Web Application Security.
If a developer does not handle User Input and database querying securely, an attacker can manipulate SQL Queries to gain unauthorized access to a Database. This is called SQL Injection.
story
In 2015, British telecommunications company TalkTalk suffered a Cyber Attack that exposed the personal data of 156,959 customers. As a result, TalkTalk lost more than 101,000 customers and had to pay a record Government fine of £400,000 (177,620,120 LKR).
The most surprising part? The person behind it was a young 16 year old boy named Daniel Kelley.
story end
What happens when a SQL Injection attack occurs?
Data can be stolen. Information can be modified. Data can be deleted. Data leaks can occur. Services can be disrupted, and the company's reputation can be damaged.
Not all of these consequences occur with every SQL Injection vulnerability. The impact depends on the application's security and Database Permissions.
Why does this happen?
The main reason is the unsafe inclusion of User Input directly into SQL Code.
For example, when building a Query using String Concatenation, User Input can become part of the SQL Code itself.
To explain further, imagine sending a User ID of 10 to an API. The Service Layer passes this ID to the Repository Layer. If a developer directly concatenates the ID into an SQL Query using String Concatenation, malicious input could change the meaning of the Query.
Additionally, granting the Database more Permissions than necessary increases the risk.
How can SQL Injection be prevented?
One of the main solutions is to use Prepared Statements or Parameterized Queries.
These separate SQL Code from User Input. This reduces the risk of input changing the meaning of the Query.
In addition, restricting Database Permissions is important.
How do we test after fixing it?
Simply changing the Code does not confirm that the vulnerability has been fixed.
story continue
Because our young Daniel Kelley used SQLmap, a common open source tool, to crack the Database.
story end
Therefore, write Unit Tests and Integration Tests. We can also use Security Testing Tools such as OWASP ZAP to test the Application in an authorized Test Environment.
As developers, ensuring that the Code we write works is just as important as ensuring that it is secure, especially in AI native development.