简体   繁体   English

来自服务器端安全性扫描程序的上光缓存POST请求

[英]Varnish caching POST requests from Server Side Security scanner

I run a webstore on Magento ver. 我在Magento ver上经营一个网上商店 2.1.8 eCommerce platform. 2.1.8电子商务平台。

Recently, I came across a issue where front-end of my website was using a completely different colour skin and layout and couldn't figure out why this is happening. 最近,我遇到一个问题,我的网站的前端使用的是完全不同的颜色外观和布局,无法弄清楚为什么会这样。

Purging the Varnish cache solved the issue for some time as the website would randomly changed the skin again after some time. 清除Varnish缓存解决了一段时间,因为网站将在一段时间后再次随机更改外观。 I had no idea how Varnish was caching the content that should never be displayed. 我不知道Varnish如何缓存不应显示的内容。

I also use Acunetix as a Server Side Scanner which scans my website every week for any malicious code or gaps in security. 我还将Acunetix用作服务器端扫描程序 ,它每周扫描我的网站是否存在恶意代码或安全漏洞。 I found one of the POST request that it sent: 我发现它发送了一个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--

The above is the configuration of the wrong designed that was cached by Varnish. 上面是Varnish缓存的错误设计的配置。 Eg aquamarine.css is the wrong CSS file cached, it should be red.css . 例如aquamarine.css错误的缓存CSS文件,应该是red.css

Is it possible that after this post request, Varnish cached this settings? 在发布请求后,Varnish是否有可能缓存了此设置? Also, what is the best way to overcome this problem? 另外,克服此问题的最佳方法是什么? Should I create a rule in Acunetix to avoid this URL? 是否应该在Acunetix中创建规则来避免使用此URL? Or create a NginX configuration to block access to it? 还是创建一个NginX配置来阻止对它的访问?

Try something like the following to just force Varnish to not attempt to use (or store into) the cache for POST requests: 尝试执行以下操作,仅强制Varnish不要尝试将POST请求使用(或存储到)缓存中:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM