靶机练习:born2root

cha0s32 / 2024-06-09 / 原文

信息收集

扫描全端口以发现服务

image-20240608183745879

发现端口

image-20240608183856678

80端口信息: Secretes Company / robots.txt / Wordpress-blog

访问80端口web服务

image-20240608184137375

About Us的用户名可以记录下来:Martin Hadi Jimmy

robots.txt 有两个路径: /wordpress-blog /files 分别访问一下

image-20240608184328831

image-20240608184354593

好像暂时没什么东西,拿用户名可以先爆破一下ssh,没爆破出什么东西

dirsearch 爆破主目录 和 wordpress-blog 也没东西(这里直接把icons给忽略掉了,看来oscp是真的不能忽略所有的东西)

Searschsploit 一下 Secretsec 也没东西

拿shell

dirsearch 发现有 icons 目录

访问得

image-20240608201822922

VDSoyuAXiO.txt 中有私钥,结合前面拿到的用户名可以尝试登陆

image-20240608201936621

使用wget方法把文件下下来,用martin账号登陆,刚开始登陆不了,报错sign_and_send_pubkey: no mutual signature supported

解决方法
1. 保证id_rsa权限为600

2. cd ~/.ssh目录下

3. 创建文件config

4. 文件内容: PubkeyAcceptedKeyTypes +ssh-rsa,保存退出

打开新的shell,进行登陆,成功登陆

image-20240608203238226

查看suid权限文件

image-20240608203450391

发现exim4程序,查看版本号,版本为4.84

image-20240608203852347

searchsploit 查看 有没有可用的 payload

image-20240608204052811

看到有一个本地提权的sh 可用

下载下来修改了一下脚本路径

image-20240608205401030

使用wget好像传不上去,使用nc试试,运行脚本以后一点用都没有

提权

把linpeas传上去跑

发现计划任务里面有一个py文件

image-20240608210838786

新建一个sekurity.py,把python的反弹shell写进去

image-20240608211941577

拿到shell了(等了几分钟)

image-20240608211904055

也木有sudo 权限

image-20240608212037054

使用密码生成器bopscrk生成hadi的密码

爆破其ssh密码,拿到密码,使用su即可拿到root权限