网络安全技术分享( 二 )


【网络安全技术分享】题目描述:
DC-5 is another purposely built vulnerable lab with the intent of gaining experience in the world of penetration testing.The plan was for DC-5 to kick it up a notch, so this might not be great for beginners, but should be ok for people with intermediate or better experience. Time will tell (as will feedback).As far as I am aware, there is only one exploitable entry point to get in (there is no SSH either). This particular entry point may be quite hard to identify, but it **is** there. You need to look for something a little out of the ordinary (something that changes with a refresh of a page). This will **hopefully** provide some kind of idea as to what the vulnerability might involve.And just for the record, there is no phpmailer exploit involved. :-)The ultimate goal of this challenge is to get root and to read the one and only flag.描述中说到something that changes with a refresh of a page(随着页面刷新而改变的东西) , 这里我们留意一下 。并且靶机只有一个flag
知识点总结:
①端口扫描(熟悉常用的几个端口是哪个服务)
②文件包含漏洞
③利用文件包含写入shell
④screen提权
1.使用命令列出局域网内所有主机
arp-scan -l

网络安全技术分享

文章插图
 
获得目标主机IP:192.168.2.118
2.使用nmap扫描目标主机查看开放端口
root@kali:~#nmap -sV -p- 192.168.2.118 参数说明:                -sV 用来扫描目标主机和端口上运行的软件的版本      -p 80 指定80端口      -p- 扫描0-65535全部端口
网络安全技术分享

文章插图
 
可以看到开放了80端口,代表有web服务 , 直接访问
常用端口参考链接
3.访问IP查看web内容
网络安全技术分享

文章插图
 
在contact模块发现了留言板的功能 , 随便输入测试一下
网络安全技术分享

文章插图
 
看到请求被提交到了thankyou.php , 并且有参数 , 为GET方式传参 。从题目描述中我们也知道提示到了刷新 , 我们刷新下页面看下
网络安全技术分享

文章插图
 
被圈住的地方每当刷新一次都会改变 , 由此我们可以联想到可能有文件包含漏洞
我们现在先扫一下目录看一下是哪个文件被包含进来
使用DirBuster扫描目录
网络安全技术分享

文章插图
 
可以发现有一个footer.php 访问一下正好验证文件包含的漏洞
网络安全技术分享

文章插图
 
4.测试文件包含参数
那么我们现在就要确定文件包含的参数是哪一个 , 一般page  , file , filename用的比较多 , 我们可以试一下 , 如果不是我们也可以用kali里边自带的字典进行fuzz
网络安全技术分享

文章插图
 
由此 , 我们可以确定参数为file
我们现在可以对文件进行读取了 , 但是我们的目的是获取shell , 如果只读取文件是无法完成的 , 我们需要往里边写东西 , 于是可以想到利用日志文件 , 将shell写入日志文件 然后进行文件包含
网络安全技术分享

文章插图
 
可以看到网站是Nginx的 , Nginx 的日志默认路径是
/var/log/nginx/error.log?/var/log/nginx/access.log我们也可以通过FuzzDB提供的字典进行爆破日志的位置
网络安全技术分享

文章插图
 
有了日志文件位置 , 接下来就要往日志文件写一句话木马
5.写入一句话木马
?file=<?php @eval($_POST[123]);?>
网络安全技术分享

文章插图
 
查看日志文件
网络安全技术分享

文章插图
 
可以看到一句话木马已经被写进日志文件了
使用蚁剑进行连接
网络安全技术分享


推荐阅读