vulnhub靶机测试--CH4INRULZ_v1.0.1

信息收集

主机发现

在这里插入图片描述

端口扫描

在这里插入图片描述
四个端口。有两个开启http服务。

目录扫描

1.80端口:
在这里插入图片描述

2.8011端口:
在这里插入图片描述

漏洞发现及利用

1.先走80端口:
主页没有什么信息。

访问其他目录:

/LICENSE:
在这里插入图片描述
无用信息。

/robots(.txt)

在这里插入图片描述

/development:
在这里插入图片描述
一个登陆点,暂时搁置。

/vendor/:
在这里插入图片描述
目录遍历,但是没有有用的信息。

2.再看看8011端口:

只有一个目录,api:

在这里插入图片描述

这个API将用于与Frank的服务器通信
但它还在开发中。

依次打开这四条路径,只有第三个可以打开:
在这里插入图片描述
没有file参数?文件包含?

GET方式不行,POST:
在这里插入图片描述
存在文件包含漏洞。

还有一点API还在开发中(api路径),那么是否有备份文件。
在这里插入图片描述
文件泄露:
在这里插入图片描述
一句很重要的提示,给出了development登陆点的账号密码,但是密码加密了。

使用工具进行破解:

在这里插入图片描述
好的,去登陆:
在这里插入图片描述

*这是我未完成的工具清单

-上传工具(已完成,但需要安全审查)

说明有上传点(/development/uploader/):
在这里插入图片描述

这下文件上传和文件包含都有了。

但是不知道文件上传的位置啊。

先通过文件包含获得更多的信息。

包含配置文件:

/etc/apache2/sites-enabled/000-default

在这里插入图片描述
发现这个路径。

先成功上传一个文件:
在这里插入图片描述
发现路径为upload.php

使用文件包含获得源码:

file=php://filter/read=convert.base64encode/resource=/var/www/development/uploader/upload.php

<?php
$target_dir = "FRANKuploads/";
$target_file = $target_dir . basename($_FILES["fileToUpload"]["name"]);
$uploadOk = 1;
$imageFileType = strtolower(pathinfo($target_file,PATHINFO_EXTENSION));
// Check if image file is a actual image or fake image
if(isset($_POST["submit"])) {
    
    
    $check = getimagesize($_FILES["fileToUpload"]["tmp_name"]);
    if($check !== false) {
    
    
        echo "File is an image - " . $check["mime"] . ".";
        $uploadOk = 1;
    } else {
    
    
        echo "File is not an image.";
        $uploadOk = 0;
    }
}
// Check if file already exists
if (file_exists($target_file)) {
    
    
    echo "Sorry, file already exists.";
    $uploadOk = 0;
}
// Check file size
if ($_FILES["fileToUpload"]["size"] > 500000) {
    
    
    echo "Sorry, your file is too large.";
    $uploadOk = 0;
}
// Allow certain file formats
if($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg"
&& $imageFileType != "gif" ) {
    
    
    echo "Sorry, only JPG, JPEG, PNG & GIF files are allowed.";
    $uploadOk = 0;
}
// Check if $uploadOk is set to 0 by an error
if ($uploadOk == 0) {
    
    
    echo "Sorry, your file was not uploaded.";
// if everything is ok, try to upload file
} else {
    
    
    if (move_uploaded_file($_FILES["fileToUpload"]["tmp_name"], $target_file)) {
    
    
        echo "The file ". basename( $_FILES["fileToUpload"]["name"]). " has been uploaded to my uploads path.";
    } else {
    
    
        echo "Sorry, there was an error uploading your file.";
    }
}
?>


获得了文件的保存目录,并且通过审计。

对问价的后缀以及内容进行了判断。

上传图片马:
在这里插入图片描述

反弹shell

这里我用了一些php反弹shell的脚本都失败了,最后使用了kali自带的脚本,将其中的ip地址和端口修改即可:

脚本路径:

在这里插入图片描述
在这里插入图片描述

提权

查看内核信息:
在这里插入图片描述

使用脏牛进行提权:
在这里插入图片描述
编译:

gcc -pthread dirty.c -o exp -lcrypt

执行,切换用户:
在这里插入图片描述

总结

跟之前做的一个靶机很像,也是文件包含+文件上传。

这次通过.bak获得源码。

猜你喜欢

转载自blog.csdn.net/qq_45742511/article/details/115185843