Search code examples
phptcpspoofing

Detect forged IP address?


How do you detect if the IP address for data received via a web form has come from a spoofed IP address?

If detection is possible in PHP, is there a library that will also attempt to find the real IP address?


Solution

  • Äh - you can not. There can not be a spoofed IP address.

    See, HTTP (which is the b asis for web forms) runs on top of TCP.

    If I spoofe my IP address in the TCP process, I will never manage to establish the TCP connection. WIthout an established TCP connection, I can not send any data to your server.

    THe connection on your side keeps stuck in a half open state - which, btw., was one of the attack vectors some time ago for a denial of service attack (overloading servers with half open connections so real ones do not get established):

    Ergo: In order to complete the form data submission, I need to open the TCP channel, for which my IP packets need to provide the real IP address.

    Where did you get the idea that your submissions come from spoofed IP addresses?