Form将数据存储在mysql数据库中——XSS漏洞
我有一个带有一个文本区域字段的表单。该字段设置为接受任何内容,并在提交时将输入存储在数据库中。然后,该代码将作为 URL 公开,例如:domain.com/asd
。我没有进行任何类型的 strip_tags
、htmlentities
或任何类型的 xss 预防。
我的问题是,这可能会造成什么危害。用户是否可以在输入或输出期间执行任何类型的 xss 以从数据库获取信息。
I have a form with one textarea field. The field is set to accept anything and stores the input in the database when submitted. The code is then made public as a url ex: domain.com/asd
. I'm not doing any type of strip_tags
, htmlentities
or any type of xss prevention.
My Question is, what harm can this possibly cause. Can a user do any type of xss to fetch information from the database during either input or output.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
XSS 不会对您的服务器进行任何攻击,而没有 XSS 就不可能发生这种攻击。 XSS 的作用是让未经授权的用户充当授权用户。如果您的网站没有用户身份验证,XSS 通常不会构成威胁。
XSS does not make any attacks possible against your server which would not be possible without XSS. What XSS does is to enable an unauthorized user to act as an authorized user. If you don't have user authentication on your site, XSS is usually not a threat.
您可能面临存储型 xss 攻击、存储型跨站脚本攻击的严重威胁:
因此,如果恶意代码位于文本区域并且您存储了它。稍后,当您显示数据库中存储的数据时,就像您正在正确执行代码一样。除此之外,每当您在 SQL 查询中使用文本区域中的数据时,还有很多其他方法可以使用您的数据库。
You might be in serious threat of stored xss attacks, Stored cross site scripting :
So, if the malicious code is in the text area and you store it. At a later point of time when you display the data stored in the db, its like you are executing the code right. Apart from this, there are a lot other ways to play with your database whenever you use the data from the textarea in your SQL query.
当您接受用户的输入时,您至少应该:
,否则你的代码将非常不安全。
我建议您阅读 OWASP 以了解有关许多漏洞的更多信息。尤其是 OWASP Top 10 页面是必读的。
When you accept input from the user you should at least:
Otherwise your code is going to be unsafe as hell.
I would recommend you to read OWASP to know more about a lot of vulnerabilities. Especially the page OWASP top 10 is a must read.