[X] Choose Font Here

Semantic URL Attacks

ကၽြန္ေတာ္ ဒီ POST ေလးကို ေရးျဖစ္တာကေတာ့ Essential PHP Security ဆိုတဲ့ စာအုပ္ေလးကို ဖတ္ၾကည့္မိရာကေနျပီး

အသံုး၀င္ေစမယ့္ အေၾကာင္းအရာေလး ျဖစ္ေနတာေၾကာင့္ အားလံုးသိေအာင္ ျပန္ share လိုက္ပါတယ္။ အေၾကာင္းေလးကေတာ့

Browser ရဲ ့Address Bar မွာ ေပၚေနတဲ့ URL မွာ pass လုပ္တဲ့ data ေတြကို modify လုပ္ျပီး Hack လုပ္တဲ့ sample တစ္ခုပဲ

ျဖစ္ပါတယ္။

 

တစ္ခ်ိဳ ့web site ေတြမွာ ဆိုရင္ Login ဝင္ျပီးရင္ ကိုယ့္ရဲ ့ Information Details ကို ၾကည့္လို ့ရပါတယ္။

ဥပမာ သင့္ရဲ ့ Application ထဲမွာ user Chris က Link တစ္ခု ကို click လိုက္ရင္ Browser ရဲ ့ URL မွာ ဒီလို ျဖစ္သြားတယ္ဆိုပါစို ့။

(http://example.org/private.php?user=chris) user Chris click လိုက္တဲ့ Link ကေတာ့ သူ ့ရဲ ့Information ကို Details ၾကည့္လို ့

ရတဲ့ Link ျဖစ္ပါတယ္။

အဲ့ဒီအခ်ိန္မွာ Chris က သူ ့ရဲ ့သူငယ္ခ်င္း Zack ရဲ ့Information ေတြကို ၾကည့္ခ်င္စိတ္ေပါက္လာတယ္ဆိုပါစို ့။

အဲ့ဒီေတာ့ သူက URL မွာ manually ပဲ အဲ့ဒီလုိ http://example.org/private.php?user=zack ေျပာင္းျပီး enter

ေခါက္လိုက္တယ္ဆိုရင zack ရဲ ့Information Details ကို ျမင္ရမွာျဖစ္ပါတယ္။

ဒီလို ျဖစ္ရတာကေတာ့ forum ရဲ ့method မွာ GET ကိုသံုးထားတာေၾကာင့္ ျဖစ္ပါတယ္။ GET ကို သံုးထားေတာ့ user က

URL မွာ pass လုပ္လိုက္တဲ့ Data ေတြကို ျမင္ေနရတာျဖစ္ပါတယ္။ ဒါေလးကို ေရွာင္ခ်င္တယ္ဆိုရင္ေတာ့

method ကို POST ကို သံုးလို ့ရပါတယ္။ GET/POST ေတြ အေၾကာင္းကို Details သိခ်င္တယ္ဆိုရင္ ဒီ Link ေလးမွာ

ျပန္ဖတ္လို ့ရပါတယ္။

 

ေနာက္တစ္ခုကေတာ့ web base email system ေတြမွာ password ကို Reset ခ်တာနဲ ့ပတ္သက္ျပီးေတာ့ URL Hacking ေလးတစ္ခုအေၾကာင္းျဖစ္ပါတယ္။

Hack လုပ္တဲ့ပံုစံက ဒီလိုေလးပါ။ User Chris က web based email application ကို login ၀င္လိုက္ပါတယ္။ အဲ့ဒီအခ်ိန္မွာ သူက

သူ ့ရဲ ့ password ကို reset ခ်ခ်င္တယ္ဆိုပါစို ့။

ဒီ application ရဲ ့structure ကေတာ့ password ကို reset ခ်ခ်င္တယ္ ဆိုရင္ေတာ့ Security Question ကို ေျဖျပီး

Alternative mail တစ္ခုကို ေပးရပါတယ္။ ျပီးရင္ေတာ့ submit ကို Click လိုက္ပါ။ ကိုယ့္ရဲ ့ Alternative mail ထဲကို new password

ေရာက္သြားပါလိမ့္မယ္။

Form ရဲ ့code ေလးကေတာ့ ဒီလိုေလးပါ။


<form action="reset.php" method="GET">
<input type="hidden" name="user" value="chris" />
<p>Please specify the email address where you want your new password sent:</p>
<input type="text" name="email" /><br />
<input type="submit" value="Send Password" />
</form>



ဒီေနရာမွာ သတိထားျပီးၾကည့္ရမွာကေတာ့ Login ၀င္ျပီးသားျဖစ္ေနလို ့ <input type=”hidden” name=”user” value=”chris” >

ဆိုျပီး Login ၀င္ထားတဲ့ user ကုိ hidden field ထဲကို auto ထည့္ေပးထားပါတယ္။

User က email ကို chris@example.com ဆိုျပီးျဖည့္ေပးျပီး submit ကို click လုိက္တယ္္ဆိုရင္ URL မွာ ဒီလို ျဖစ္သြားပါလိမ့္မယ္။

http://example.org/reset.php?user=chris&email=chris%40example.org

ဒီလိုလုပ္ျပီးရင္ New password သည္ chris@example.org ဆိုတဲ့ mail ထဲကို send ေပးလိုက္ပါလိမ့္မယ္။

အဲ့ဒီအခ်ိန္မွာ User Chris က တစ္ျခားသူတစ္ေယာက္ရဲ ့ password ကို Reset ခ်ျပီးသူ ့ရဲ ့ chris@example.org ထဲကို

send ခ်င္တယ္ဆိုရင္ ဒီလို http://example.org/reset.php?user=zack&email =chris%40example.org

လို ့ရိုက္ျပီး RUN လိုက္တာနဲ ့Zack ရဲ ့New password က Chris ရဲ ့Alternative mail ျဖစ္တဲ့ chris@example.org ထဲကို

ေရာက္သြားျပီျဖစ္ပါတယ္။ ေသျပီဆရာပါပဲ။ ဒါေလးေတြကို ဒီ code ေလးသံုးျပီး avoid လုပ္လို ့ရပါတယ္။


<?php

session_start();

$clean = array();
$email_pattern = '/^[^@\s<&>]+@([-a-z0-9]+\.)+[a-z]{2,}$/i';

if (preg_match($email_pattern, $_POST['email']))
{
$clean['email'] = $_POST['email'];
$user = $_SESSION['user'];
$new_password = md5(uniqid(rand(), TRUE));

if ($_SESSION['verified'])
{
/* Update Password */

mail($clean['email'], 'Your New Password', $new_password);
}
}

?>



ဒီ sample ေလးအရ $_SERSION ဆိုတဲ့ sersion variable ကို သံုး ထားတဲ့ အတြက္ current login ၀င္ထားတဲ့ user ကပဲ

သူ ့password ကို Reset ခ်လို ့ရပါတယ္။ ဒီေနရာသံုးသြားတာေတြကေတာ့ $_SERSION[‘verified’] ကေတာ့ verification

question ေတြ answer လုပ္ျပီးသားဆိုတာကို check တာျဖစ္ပါတယ္။ $_SERSION[‘user’] ကေတာ့ verification question ေတြကို

ေျပာထားတဲ့ user နဲ ့sersion ထဲေရာက္ေနတဲ့ user တူလား စစ္ထားတာျဖစ္ပါတယ္။ ကၽြန္ေတာ္ကေတာ့ တတ္ႏိုင္သေလာက္

ရွင္းေအာင္ေရးထားပါတယ္။ တကယ္လို ့နားမလည္ရင္ ျပန္ေမးလို ့ရပါတယ္။ စာေရးရင္ရွင္းေအာင္မေရးတတ္တာ

ကၽြန္ေတာ့္အားနည္းခ်က္တစ္ခုျဖစ္ပါတယ္။

 

တျခား PHP Post ေတြအားလုံး ကို ႏွစ္သက္ရာ ေရြးဖတ္ ခ်င္တယ္ဆိုရင္ ဒီ Link ေလးကို Click လိုက္ပါ။

 

 

 

Comments (0)
Write comment
Your Contact Details:
Comment:
[b] [i] [u] [url] [quote] [code] [img]   
:D:angry::angry-red::evil::idea::love::x:no-comments::ooo::pirate::?::(
:sleep::););)):0
Security
Please input the anti-spam code that you can read in the image.

Login Form

Categories Table View

JoomlaWatch Stats 1.2.9 by Matej Koval

Facebook Share

Share on facebook

Accordion FAQ

mod_joomtouch

Version Iphone

Version Iphone by JoomTouch