PHP_SELF 和 XSS
可能的重复:
PHP_SELF 和 XSS
为什么需要过滤 $_SERVER['PHP_SELF'],例如
<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
<!-- form contents -->
</form>
to:
<form method="post" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"], ENT_QUOTES, "utf-8"); ?>">
<!-- form contents -->
</form>
:为了使其能够防 XSS 攻击?
以及:
攻击者如何利用第一种形式的“漏洞”接触除他自己之外的最终用户?
Possible Duplicate:
PHP_SELF and XSS
Why it's necessary to filter $_SERVER['PHP_SELF'], from e.g.:
<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
<!-- form contents -->
</form>
to:
<form method="post" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"], ENT_QUOTES, "utf-8"); ?>">
<!-- form contents -->
</form>
in order to make it XSS-attack proof?
and:
How can attacker reach end users other than himself using the "vulnerability" of the first form?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
攻击者可以从他控制的网站或他发送的电子邮件链接到您的网站。
The attacker can link to your site from a site he controls or an email he sends.
如果您使用
AcceptPathInfo
或类似的东西,例如/index.php/foo/bar
之类的 URI 被定向到/index.php
,请求/index.php/%22% E3E…
可以在form
标签之外获取您的以下数据。至于第二个问题:点击此处。
If you’re using
AcceptPathInfo
or something similar such that a URI like/index.php/foo/bar
is directed to/index.php
, requesting/index.php/%22%E3E…
can get your following data outside theform
tag.And as for the second question: click here.