-
پاسخ : باگ یاهو !
البته این لینکی که دادید قر و قاطی شده. ولی به هر حال اسم این آسیب پذیری URL Redirect هستش که درجه خطرناک بودنش از 1000 چیزی حول و حوش 100 هم نمیشه . در واقع آنچنان هم خطر ناک نیست.
اوه یاهو اینقد باگ داره که دیگه کسی XSS هم رو یاهو پیدا کنه گزارش نمیکنه.
راستی یه چیز با نمک اون صفحه یاهو که ریدایرکت میکنه سورسشو دارم.
کد:
<?php
/*
Behavior matrix:
y! referrer error status rd type int action ext action
----------- ------------ ------- ---------- ----------
yes 403 ad warn redirect
yes 403 nav warn redirect
yes 403 none standard standard
yes 410 ad warn redirect
yes 410 nav warn redirect
yes 410 none standard standard
no 403 ad warn warn
no 403 nav warn warn
no 403 none standard standard
no 410 ad warn warn
no 410 nav warn warn
no 410 none standard standard
actions:
- redirect: continue with the redirect.
- warn: output failure notice and show link to destination.
- standard: regular 403 or 410 error message.
*/
define('FORBIDDEN', '403');
define('EXPIRED', '410');
// subroutines
function is_yahoo_url ($referrer) {
if ($referrer == FALSE) return FALSE;
$parsed = parse_url($referrer);
return (array_key_exists('host', $parsed) &&
preg_match("/\.yahoo\.com$/", strtolower($parsed['host'])));
}
function extract_rd ($uri) {
if ($uri == FALSE) return FALSE;
if (preg_match('/\/(\?|\*[\-\*]?)(.+)$/', $uri, $matches)) {
$type = $matches[1];
$dest = $matches[2];
if ($type == "*" or $type == "?") {
## anchor decode
$dest = preg_replace("/%23/", "#", $dest);
}
elseif ($type == "**") {
## full url decode
$dest = urldecode($dest);
}
$dest = preg_replace("/(https?|ftp)%3a\/\//i", "$1://", $dest);
// avoid cross-site scripting
$dest = yiv_get_url($dest);
return $dest;
}
return FALSE;
}
function output_error ($code, $uri, $rd = FALSE) {
$template = file_get_contents("./rd_error.html");
$year = date("Y");
$uri = htmlentities($uri); // avoid cross-site scripting
if ($code == FORBIDDEN or $code == EXPIRED) {
if ($code == FORBIDDEN) {
$status = "Forbidden";
$message =
<<<MESSAGE
You don't have permission to access <code>$uri</code> on this server.
MESSAGE;
}
else {
$status = "Gone";
$message =
<<<MESSAGE
The requested resource:
<p>
<code>$uri</code>
<p>
is no longer available on this server and there is no forwarding address.
<p>
Please remove all references to this resource.
MESSAGE;
}
if ($rd !== FALSE) {
$message =
<<<MESSAGE
<b><font size=+1>This link is not authorized by Yahoo!</font></b>
<p>
If you would like to continue to this link's intended destination
<em>at your own risk</em>, click <a href="$rd">here</a>.
MESSAGE;
}
}
else {
$status = "Server Error";
$message = "This server is unable to process your request.";
}
print str_replace(array('$year', '$code', '$status', '$message'),
array($year, $code, $status, $message),
$template);
}
function redirect ($dest) {
header("Location: $dest");
print <<<BODY
<html><body>The document as moved <a href="$dest">here</a>.</body></html>
BODY;
}
// main ()
$ip = getenv('REMOTE_ADDR');
$referrer = getenv('HTTP_REFERER');
$status = getenv('REDIRECT_STATUS');
$uri = getenv('REQUEST_URI');
$dest = extract_rd($uri);
if ($status == FALSE) $status = FORBIDDEN;
if (is_yahoo_url($referrer)) {
if ($dest !== FALSE &&
!ynet_db_is_yahoo_internal_addr($ip)) {
redirect($dest);
}
else {
output_error($status, $uri, $dest);
}
}
else {
output_error($status, $uri, $dest);
}
?>
جهت مشاهده لینک ها باید ثبت نام کنید یا لاگین کنید.
-
-
01-28-2007 02:29 PM
# ADS
تبلیغات در جوملا فارسی
علاقه مندی ها (Bookmarks)