简体   繁体   English

Wordpress-使用Ajaxy Live Search插件的XSS

[英]Wordpress - XSS using Ajaxy Live Search Plugin

I've installed Ajaxy Live Search Plugin v3.0.7 in my wordpress, but when searching something like: 我已经在wordpress中安装了Ajaxy Live Search插件v3.0.7,但是在搜索类似内容时:

<script>alert('123');</script>

I can see the alert on my browser. 我可以在浏览器中看到警报。

Using firebug I can see that when typing on the search box I'm calling 使用萤火虫时,我可以看到在搜索框上键入内容时

/wp-admin/admin-ajax.php

sending these parameters: 发送这些参数:

action = ajaxy_sf
search = false
sf_value = <script>alert('123');</script>

How can I avoid this problem on my search box? 如何避免在搜索框中出现此问题? Thanks in advance! 提前致谢!

XSS is an output encoding problem. XSS是输出编码问题。 It's not about what parameters are sent in the request, the vulnerability manifests itself when a response is made (either to the same request or a different one). 这与请求中发送的参数无关,该漏洞会在做出响应(针对同一请求或不同请求)时显示出来。

In any response, output should be encoded according to the context. 在任何响应中,都应根据上下文对输出进行编码。 Depending on how your plugin works, it may either create partial html on the server or use DOM mainpulation in the browser while sending AJAX requests. 根据插件的工作方式,它可能会在服务器上创建部分html,或者在发送AJAX请求时在浏览器中使用DOM维护。

If it's creating partial html and inserting that into the page as the search results, the view that generates the partial html should be fixed by adding output encoding (ie. htmlspecialchars() in php, but there are other options too). 如果要创建部分html并将其作为搜索结果插入页面,则应通过添加输出编码(即php中的htmlspecialchars() ,但还有其他选项)来修复生成部分html的视图。

If it's just an ajax request and the page dom is manipulated in javascript, the application should make sure to only insert variables as text nodes and not whole dom subtrees with potential script nodes. 如果只是ajax请求并且页面dom是用javascript操作的,则应用程序应确保仅将变量作为文本节点插入,而不要插入具有潜在脚本节点的整个dom子树。

Either way, I think it should be done by the plugin. 无论哪种方式,我都认为应该由插件来完成。 If it's not written correctly and vulnerable to XSS, pretty much the only way to fix it is to fix the plugin itself. 如果它编写不正确并且容易受到XSS的侵害,则修复它的唯一唯一方法就是修复插件本身。

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

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