2024-06-05 22:37阅读: 28评论: 0推荐: 0

靶机练习:sunset: midnight

信息收集

扫全端口和服务

image-20240605150656466

image-20240605150908754

80 端口直接访问访问不了: /wp-admin http://sunset-midnight

看到域名先进行域名绑定,编辑 /etc/hosts

ip sunset-midnight

绑定后可正常访问,访问robots.txt 文件

image-20240605151540459

访问 /wp-admin,存在wordpress服务

使用wpscan 扫描 地址

[+] WordPress version 5.4.2 identified (Insecure, released on 2020-06-10).
 | Found By: Rss Generator (Passive Detection)
 |  - http://sunset-midnight/feed/, <generator>https://wordpress.org/?v=5.4.2</generator>
 |  - http://sunset-midnight/comments/feed/, <generator>https://wordpress.org/?v=5.4.2</generator>

[+] WordPress theme in use: twentyseventeen
 | Location: http://sunset-midnight/wp-content/themes/twentyseventeen/
 | Last Updated: 2024-04-02T00:00:00.000Z
 | Readme: http://sunset-midnight/wp-content/themes/twentyseventeen/readme.txt
 | [!] The version is out of date, the latest version is 3.6
 | Style URL: http://sunset-midnight/wp-content/themes/twentyseventeen/style.css?ver=20190507
 | Style Name: Twenty Seventeen
 | Style URI: https://wordpress.org/themes/twentyseventeen/
 | Description: Twenty Seventeen brings your site to life with header video and immersive featured images. With a fo...
 | Author: the WordPress team
 | Author URI: https://wordpress.org/

加参数 -e u 扫描用户,存在用户 admin

wpscan --url http://sunset-midnight -e u

爆破密码没爆出来,又看到xml-rpc开了,看看有没有东西

image-20240605153915838

尝试文件读取,无果

image-20240605155325698

尝试3306 服务,爆破,有账号密码

image-20240605160316587

成功登陆 mariadb

image-20240605162306219

存在 wordpress_db数据库,有wp_users 表,表里有账号与密码密文,尝试使用hash-identifier判断,判断不出来是什么密码

拿shell

root有更改数据表的权限,可更改密码为123456

image-20240605191825776

回到web端登陆wordpress

image-20240605192409840

成功登陆后台后,有多种getshell方法

在 Appearance -> Edit Themes 模块中,选择TwentyTwenty 主题(其他主题好像更新不了代码)

image-20240605213713546

更新404.php,直接换成我们的php-reverse-shell.php,设置好监听后访问

注意地址是:http://sunset-midnight/wp-content/themes/twentytwenty/404.php

image-20240605213831878

拿到shell了,下一步准备提权

提权

翻wordpress配置文件,发现存在账号jose的数据库账号密码

linpeas.sh 跑一遍也发现系统存在jose这个账户

image-20240605215635354

成功在系统中su jose,再跑一遍linpeas.sh 看看有没有其他信息

尝试 sudo -s 失败

image-20240605215926556

sudo不能用,看看还有没有suid的程序

image-20240605220843102

status有点特殊,运行一下

image-20240605220915709

提权过程为:status运用了service程序,调用过程中没有使用绝对路径,可以自定义services加到环境变量中以获得提权效果

image-20240605223158637

我们可以看到命令中确实只用了相对路径(提权完以后再看到的,我也是看walkthrough做的)

image-20240605222455327



如果您觉得阅读本文对您有帮助,请点一下“推荐”按钮,您的“推荐”将是我最大的写作动力!欢迎各位转载,但是未经作者本人同意,转载文章之后必须在文章页面明显位置给出作者和原文连接,否则保留追究法律责任的权利。

本文作者:cha0s32

本文链接:https://www.cnblogs.com/cha0s32/p/18234072

版权声明:本作品采用知识共享署名-非商业性使用-禁止演绎 2.5 中国大陆许可协议进行许可。

posted @   cha0s32  阅读(28)  评论(0编辑  收藏  举报
点击右上角即可分享
微信分享提示
评论
收藏
关注
推荐
深色
回顶
收起