2005-12-17 12:44:51 by: h4x0r

c-blog2.1测试手记

Font Size: Large | Medium | Small
c-blog2.1测试手记
朋友买了空间支持php但是没有mysql数据库,说是这空间商主要是支持asp脚本的.哎 难道就不能玩php了吗? 嘿嘿 可以用php+access的php程序啊.百度了下发现了c-blog这个程序,它有个php+access版本的.down下了看看,就有了这次测试的结果.

1.暴出物理路径
在看了这个blog后,发现他写的到上没什么太大的bug,文件比较少而且简结. 它的说明上看到了如下:
./include 包含常用类库 编辑器 配置文件
-->/configs/配置文件目录
-->begin.cfg.php 一些常量的宏定义,如路径和数据库等
-->db.cfg.php 数据库配置文件
-->init.cfg.php 导入一些类库,作一些常用的初始化
-->end.cfg.php 程序结束调用文件 完成程序后续作用
而且每个文件都调用了require_once('../include/configs/begin.cfg.php');
这就是我们的重点.看过代码后发现
结果访问init.cfg.php和end.cfg.php可暴出了网站的物理路径.
图1

uploads/200512/17_124548_1.jpg


图2

uploads/200512/17_124603_2.jpg

http://127.0.0.1/cblog/include/configs/init.cfg.php
http://127.0.0.1/cblog/include/configs/end.cfg.php

2.跨站漏洞
c-blog中的用户名没有经过严格的过滤导致跨站漏洞
在登陆其后台后发现在管理员选项中有个登录记录的选项在记录后台登陆的情况. 看看他在代码中是怎么写的哦 嘿嘿

if(!$_POST['username']||!$_POST['password']){
admin_info("请完整输入用户名和密码","index.php"); }
$username=$_POST['username'];
$password=md5($_POST['password']);
if((1==$config['verify'])&&($_POST['verify']!=$_SESSION['session_verify'])){ adminLog ($username,"3");
admin_info("验证码错误,请注意大小写!","index.php"); }
$rs=$conn->GetRow("SELECT username,password from `".TBL_PREFIX."user` where `username` ='".$username."' and `password` ='".$password."'");
if(!$rs){
adminLog($username,"2");
admin_info("错误用户名或密码","index.php");
}else{
$_SESSION['isLogin']=true;
adminLog($username,"1");
后台登陆过程中输入的用户名没有经过任何处理 嘿嘿
那我们就测试下
用户: <Iframe src=http://127.0.0.1/index.php></iframe>
密码:Test
然后在用管理员进入后台查看登陆记录 图3

uploads/200512/17_124630_3.jpg

c-blog用户名对; , /等特殊字符都强制变被/; /, \ 所以构造如下是无法实现的
<Iframe src=http://127.0.0.1/index.php width=”0” height=”0”></iframe>

另外一个跨站就很危险了,在前台有个 “给我留言” 的方便游客给blog主人留言的功能 但是可惜的是c-blog对用户名没有严格过滤 如果我们以
<Iframe src=http://127.0.0.1/index.php></iframe>这个用户留言那么效果就很明显了不止危害管理员了其他人浏览被跨站的blog也能被攻击. 图4

uploads/200512/17_124646_4.jpg

如果有些无聊人士在c-blog上写入恶意的网站那么就成了挂马的攻击器了啊 怕怕 by h4x0r

作者:lis0
Comments Feed Comments Feed: http://www.4evil.org/feed.asp?q=comment&id=382


Post Comment
Smilies
[smile] [confused] [cool] [cry]
[eek] [angry] [wink] [sweat]
[lol] [stun] [razz] [redface]
[rolleyes] [sad] [yes] [no]
[heart] [star] [music] [idea]
Enable UBB Codes
Auto Convert URL
Show Smilies
Hidden Comment
Username:   Password:   Register Now?
Security Code * Please Enter the Security Code