简体   繁体   English

在这种情况下可以使用XSS吗?

[英]Is XSS Possible in this case?

I'm not really good with security...So just wondering if in the event i was using lightbox 2.6.1 and i had 我对安全性不是很好...所以只是想知道是否在使用Lightbox 2.6.1的情况下

Edit: Example shows static, but in reality this google.com link comes from a mySQL DB which i have populated with links that goes along with the images (IE when users upload their image they key in a Image Link Source) so the Google.com is replace with that. 编辑:示例显示为静态,但实际上,此google.com链接来自mySQL DB,我在其中填充了与图像一同显示的链接(IE,当用户上传图像时,他们键入图像链接源),因此是Google。 COM被替换。

<a href="uploads/image.jpg" data-lightbox="example-set" title="&lt;a target='_self' href='http://www.google.com'&gt;Google&lt;/a&gt;">
<img src="uploads/image.jpg" alt="" />
        </a>

Would it be possible to execute a XSS or any form of dangerous javascript? 是否可以执行XSS或任何形式的危险javascript? I'm asking because i'm hesitant about this part. 我问是因为我对这部分犹豫不决。

title="&lt;a target='_self' href='http://www.google.com'&gt;Google&lt;/a&gt;"

The answer is "probably". 答案是“可能”。 It appears that HTML is being embedded within a " title " attribute of a HREF so make sure that you cannot break out of either 似乎HTML嵌入在HREF的“ title ”属性中,因此请确保您不会出现任何一个

  1. The title tag. title标签。
  2. The embedded href tag 嵌入式href标签

It all depends on what encoding you are using to insert values there but it may be tricky to ensure you are safe using encoding alone as you will also make sure that it is not possible to insert javascript: URLs. 这完全取决于您要在其中插入值的编码方式,但是要确保单独使用编码是安全的,可能会比较棘手,因为还要确保无法插入javascript: URL。

Is there any validation you can perform on the URLs before they are inserted into your database? 在将URL插入数据库之前,可以对URL进行任何验证吗? eg that the filename only contains alphanumeric characters and one dot before the extension. 例如,文件名仅包含字母数字字符和扩展名前的一个点。

See here for more info on preventing XSS: https://www.owasp.org/index.php/XSS_(Cross_Site_Scripting)_Prevention_Cheat_Sheet 有关防止XSS的更多信息,请参见此处: https ://www.owasp.org/index.php/XSS_(Cross_Site_Scripting)_Prevention_Cheat_Sheet

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

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