天天看点

ssi

SSI (Server Side Include)的 html 文件扩展名 (.shtml), 通常称为"服务器端嵌入"或者叫"服务器端包含"

说白了就是类似其他语言如 PHP include 引入其他文件,SSI 是通过配置服务器,一个静态 html 文件引入另一个 html 文件的功能。

从技术角度上来说,SSI就是在HTML文件中,可以通过注释行调用的命令或指针,即允许通过在HTML页面注入脚本或远程执行任意代码。

直接下载了bWAPP,这个里面有ssi注入场景。

需在apache2上开启ssi服务

 创建符号链接

sudo ln -s /etc/apache2/mods-available/include.load /etc/apache2/mods-enabled

 打开刚刚创建好的软连接配置文件

sudo vi /etc/apache2/mods-enabled/include.load

# Depends: mime    

LoadModule include_module /usr/lib/apache2/modules/mod_include.so    

# 上面内容是已有的,添加下面内容    

<Directory /var/www/html>  #根路径可以换

Options Indexes FollowSymLinks Includes    

AllowOverride None    

Order allow,deny    

allow from all    

# This directive allows us to have apache2's default start page    

# in /apache2-default/, but still have / go to the right place    

# Commented out for Ubuntu    

#RedirectMatch ^/$ /apache2-default/    

AddType text/html .shtml .html         #这两个是主要的配置文件    

AddOutputFilter INCLUDES .shtml .html  #加上 .html 意思是可以 include .html 文件  

</Directory>

尝试过程中发现

<!--#echo var="DATE_LOCAL"-->

<!--#include file="1.shtml"-->这样的可以调用

但是

<!--#exec cmd="ls -al"-->不能调用。。不知道为什么,先保留吧