![]() |
|
[Insight] SQL Injection using login querys - Printable Version +- Hack Forums (https://hackforums.net) +-- Forum: Hacks, Exploits, and Various Discussions (https://hackforums.net/forumdisplay.php?fid=45) +--- Forum: Grayhat • Purple Team • Hybrid Security (https://hackforums.net/forumdisplay.php?fid=449) +---- Forum: Beginner Hacking (https://hackforums.net/forumdisplay.php?fid=4) +----- Forum: Hacking Tutorials (https://hackforums.net/forumdisplay.php?fid=47) +----- Thread: [Insight] SQL Injection using login querys (/showthread.php?tid=4737763) |
[Insight] SQL Injection using login querys - -zERAiT - Mar 19, 2015 ![]() SQL Injection using Login Queries Table of content
Setting up your own vulnerable environment index.php PHP Code zerait.sql PHP Code Injection using SQL querys When a user enters a username and password, a SQL query is created and executed to search on the database to verify them. The query below searches in the table "users" where name is "admin" and password is "admin123". If the entries matches, the user is authenticated and logged in. PHP Code Since we want to get acces to the site, and don't have an idea what the password is, we're going to try to bypass this by injecting SQL code in the input fields. The code has to be injected in a way that the SQL statement should generate a valid result, otherwise it wont result in recieving authentication. PHP Code In the query above we're guessing that the username is "admin" and as you can see we used "' or '1'='1" as our password. The password "' or '1'='1" is true cause 1=1 so the authentication never happens. We're bypassing the password field in the query above, this can also be done in the username field as you can see below. PHP Code "' or '1'='1" is not the only SQL code you can use, I'll provide a list below. Spoiler (Click to View) If you have any questions, feel free to post them below or PM me directly. Thanks for viewing my thread.🤝 ![]() |