是否有可能伪造网络浏览器发送的引用者信息?
我的服务可能会使用引用信息来判断请求是从哪个网站完成的,并且我想确保没有办法伪造引用信息。
My service might use referer information to tell from what web site a request is done, and I would like to make sure there is no way to fake the referer information.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
引用者很容易被欺骗。
使用引用者作为验证方法非常不可靠。
存在一个名为 refspoof 的 Firefox 插件很容易做到这一点。
即使像 wget 这样的命令行工具也可以选择执行此操作:
--referer=url
Referer can be easily spoofed.
Using a referrer is very unreliable as a method of verification.
There exists a firefox plugin called refspoof to do that very easily.
Even command line tools like wget have options to do that:
--referer=url
这是可能的。您无法阻止浏览器伪造该数据。
It is possible. There's nothing you can do to prevent browsers from faking that data.
有很多方法可以伪造客户发送的任何信息。接受客户信息的最基本规则是:不要相信客户。
永远。
浏览器可以伪造他们的用户代理字符串和引用者(正确的拼写,PHP 函数是最常见的拼写错误)。
There are many ways to fake any information sent by the client. The most basic rule of accepting information from a client is: don't trust the client.
Ever.
Browsers can fake, among many others, their User-Agent string and referrer (the proper spelling, the PHP function is about the most prolifically perpetuated typo going).
它很容易被欺骗,所以我不会依赖它来做任何重要的事情。
It's easily spoofed, so I wouldn't rely on it for anything important.
客户端可以自由地向您发送它想要的任何数据。您永远不应该相信浏览器发送的内容。
The client is free to send you what ever data it wants. You should -never- trust what the browser sends.