Varnish从Server Side Security扫描程序缓存POST请求

时间:2018-03-05 15:18:46

标签: http varnish magento2.1

我在 Magento ver上运行一个网上商店。 2.1.8 电子商务平台。

最近,我遇到了一个问题,我的网站的前端使用了完全不同的颜色皮肤和布局,无法弄清楚为什么会发生这种情况。

清除 Varnish 缓存已解决了一段时间的问题,因为网站会在一段时间后再次随机更改皮肤。我不知道Varnish如何缓存永远不会显示的内容。

我还使用Acunetix作为服务器端扫描程序,它每周扫描我的网站,查找任何恶意代码或安全漏洞。我发现了它发送的一个POST请求:

POST /themesettings/index/paneltool/ HTTP/1.1
Content-Length: 1193
Content-Type: multipart/form-data; boundary=-----Boundary_JTWCAHJSKP
Referer: https://www.domain.co.uk/
Cookie: PHPSESSID=sadfq345r234324dfasd; mage-messages= vespaneltool=a%3A6%3A%7Bs%3A52%3A%22ves_themesettings_general%2Fgeneral_settings%2Fdirection%22%3Bs%3A3%3A%22rtl%22%3Bs%3A49%3A%22ves_themesettings_general%2Fgeneral_settings%2Flayout%22%3Bs%3A8%3A%22boxed-lg%22%3Bs%3A52%3A%22ves_themesettings_general%2Fgeneral_settings%2Fmax_width%22%3Bs%3A5%3A%22960px%22%3Bs%3A59%3A%22ves_themesettings_general%2Fgeneral_settings%2Fmax_width_custom%22%3Bs%3A8%3A%22gqwtkdks%22%3Bs%3A47%3A%22ves_themesettings_general%2Fgeneral_settings%2Fskin%22%3Bs%3A8%3A%22blue.css%22%3Bs%3A55%3A%22ves_themesettings_header%2Fgeneral_settings%2Fheader_layout%22%3Bs%3A13%3A%22default.phtml%22%3B%7D; _vwo_uuid_v2=EC7CC959823F97596222AB508A6BB8BE|53a815cb661ea346311131469aaeb1c2; PHPSESSID=oaibesqi4980brc3udl1gdrfb0
Host: www.domain.co.uk
Connection: Keep-alive
Accept-Encoding: gzip,deflate
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.21 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.21
Accept: */*

-------Boundary_JTWCAHJSKP
Content-Disposition: form-data; name="btn-save"

Apply
-------Boundary_JTWCAHJSKP
Content-Disposition: form-data; name="userparams[ves_themesettings_general/general_settings/direction]"

rtl
-------Boundary_JTWCAHJSKP
Content-Disposition: form-data; name="userparams[ves_themesettings_general/general_settings/layout]"

boxed-md
-------Boundary_JTWCAHJSKP
Content-Disposition: form-data; name="userparams[ves_themesettings_general/general_settings/max_width]"

1024px
-------Boundary_JTWCAHJSKP
Content-Disposition: form-data; name="userparams[ves_themesettings_general/general_settings/max_width_custom]"

12345'"\'\");|]*%00{%0d%0a<%00>%bf%27'ð©
-------Boundary_JTWCAHJSKP
Content-Disposition: form-data; name="userparams[ves_themesettings_general/general_settings/skin]"

aquamarine.css
-------Boundary_JTWCAHJSKP
Content-Disposition: form-data; name="userparams[ves_themesettings_header/general_settings/header_layout]"

default2.phtml
-------Boundary_JTWCAHJSKP
Content-Disposition: form-data; name="vespanel"

1
-------Boundary_JTWCAHJSKP
Content-Disposition: form-data; name="vesreset"

0
-------Boundary_JTWCAHJSKP--

以上是由Varnish缓存的错误设计的配置。例如。 aquamarine.css错误的 CSS文件缓存,它应该是red.css

在这个帖子请求之后,Varnish是否可以缓存此设置?另外,解决这个问题的最佳方法是什么?我应该在Acunetix中创建规则以避免此URL吗?或者创建一个NginX配置来阻止对它的访问?

1 个答案:

答案 0 :(得分:0)

尝试以下内容,强制Varnish不要尝试使用(或存储)缓存来处理POST请求:

sub vcl_recv {
    if (req.method == 'POST') {
       set req.hash_always_miss = true;
    }
}