SQL injections are some of the most often used attacks. They're quite simple and a vulnerbility could actually any web-app. We're talking about SQL Injection when an attacker is able to execute malicious SQL statements.
An attacker could bypass the whole authentication and autherization system and get access to the whole database. This means he could get sensitive data, delete, add or modify data.
When getting on a Webpage, the attacker must find an input field on the site, which executes then a query on the database. To make a SQL injection possible, the website must include the input directly in the SQL input within an SQL statement. An attacker can then insert a payload that will be included as part of the SQL query and run against the database server.
Usually a query to the database looks like this:
SELECT id FROM users WHERE username=’myUsername’ AND password=’MyPassword’
But if a the generation of this request is badly done, the attacker could give the input in the login field for example, that the authentication fails and anybody could get access.
An easy example in a vulnerable generation of a request would be if the attacker inserted this into the password field:
’some_shit’ OR 1=1’
Then the request would look like this:
SELECT id FROM users WHERE username=’myUsername’ AND password= ’some_shit’ OR 1=1’
Since 1=1 is always true, we get autherized and have the possibility to login.
But fortunately the problems on the server-side code can be fixed and prevented easily. Often there are functions in libraries that are actually safe against SQL injections.
SQL injections are a simple but powerful hack. They can be easily prevented and cause much damage.
Thanks for reading, if you're interested in Hacking Basics, leave a upvote and if you want this post to be more detailed leave a comment and tell me :)
I hope that you can understand this meme :D
Cheers!
The first image is from this link.