Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can $_SERVER['REMOTE_USER'] be spoofed?

Tags:

security

php

cgi

I have a situation where I am opening a file based on the $_SERVER['REMOTE_USER'] variable. I don't think this is spoof-able but would just like to confirm. I do not want to make myself vulnerable to the reading of arbitrary files:

   <?
      $user = $_SERVER['REMOTE_USER'];
      $fp = fopen("./$user.png","r");
   ?>
like image 898
user974896 Avatar asked Oct 17 '12 19:10

user974896


People also ask

Can $_server[REMOTE_ADDR] be spoofed?

But given your code you might actually be more interested if the value in $_SERVER ['REMOTE_ADDR'] could be spoofed. While most assume that this is the source IP address of the client it can actually be different from the real source IP of the HTTP connection and it might even be manipulable by an attacker.

Is it possible to spoof the IP address of a HTTP Server?

HTTP is a protocol on top of TCP and doing IP spoofing with TCP is nearly impossible due to the internals of the protocol.

How to send TCP SYN with spoofed IP?

YOU send TCP SYN with spoofed IP. SERVER responds with SYN-ACK to that IP and waits for an ACK, Data packet back from that IP. End of conversation! Your TCP stack would only send the SYN packet and the remote system would attempt to send an SYN-ACK packet back to the spoofed IP you sent.

What is REMOTE_ADDR and how can I spoof it?

As I understand it, REMOTE_ADDR is the address of the client that the server is talking to - so spoofing that variable (if possible) might allow someone to send data to the server but the spoofer would not be able to read data returned from the server.


1 Answers

Yes, that username is whatever is specified by the remote user.

You need to verify password as well. If password is verified by your server, and not your application, then you are probably okay.

like image 151
Brad Avatar answered Sep 27 '22 23:09

Brad