Request.UserHostAddress.ToString() 可以被欺骗吗? ASP.NET 4.0-IIS 7.5

发布于 2024-12-15 22:49:07 字数 147 浏览 3 评论 0原文

我使用此方法获取访问者 IP Request.UserHostAddress.ToString()

它是否有可能被欺骗或用于 SQL 注入。有哪些风险和可能性。谢谢。

ASP.NET 4.0、C# 4.0、IIS 7.5

I am getting the visitors ip with this method Request.UserHostAddress.ToString()

Are there any chance that it can be spoofed or used for sql injection. What are the risks and possibilities. thank you.

asp.net 4.0 , c# 4.0 , IIS 7.5

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

情话已封尘 2024-12-22 22:49:07

不。IP 来自网络服务器的套接字。它不能被欺骗(对于多个请求)。如果IP被欺骗,客户端只能向服务器发送请求,而永远看不到回复。

我看不出它如何在 SQL 注入中使用,即使它是直接在 SQL 语句中使用的。即使它是假的,它也是一个 IP 地址,并且不可能是 SQL 代码。

摘要

欺骗:如果用户必须在您的网站中导航(进行多次寻呼)。那么他的IP需要是正确的(不是欺骗的)。

注入:用户不能将任何值放入 UserHostAddress:它需要是一个 IP 地址,因此如果注入到 SQL 语句中不会造成损害。

No. The IP is from the socket with the web server. It can not be spoofed (for more then one request). If the IP was spoofed, the client could only send a request to the server and would never see the reply.

I can not see how it can be used in a SQL injection, even if it was used directly in your SQL statement. It is an IP-address even if it was fake, and could not be SQL code.

Summary:

Spoofing: If the user has to navigate in your site (make more then one page-call). Then his IP needs to be correct (not spoofed).

Injection: The user can not put just any value into UserHostAddress: it needs to be an IP-address, and therefore can not be harmful if injected into your SQL statement.

倥絔 2024-12-22 22:49:07

IP 地址本身可能会被欺骗,但可能性极低。

它不能用于 SQL 注入。

The IP address itself can be spoofed, but extremely unlikely.

It cannot be used for SQL injection.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文