Jump to content

Is this code a security issue?


fpc*

Recommended Posts

I have an advertisor who has requested I use php code to include their ad tag, this is the code they have given me;

[quote]<?php
$SERVER_NAME=$_SERVER['SERVER_NAME'];
$urlx=$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'];
$ref=str_replace(" ",null,$HTTP_USER_AGENT);
$URL="http://www.etc.com/etc/etc.php?urlx=".$urlx."&site=".$SERVER_NAME."&ref=".$ref;
$file = @fopen("$URL", "r");
$r = "";
do {
  $data = @fread($file, 8192);
  if (strlen($data) == 0) {
      break;
  }
  $r .= $data;
} while (true);
fclose ($file);
echo $r;


?>
[/quote]

Does this look malicous in any way? Can it be used to run remote commands, upload files or download files? I am a bit paranoid, but only because I am a bit clueless ;>

Any help is appreciated. thanks
Link to comment
Share on other sites

[code]<?php
// this simple retrieves the name of your server.
$SERVER_NAME=$_SERVER['SERVER_NAME'];
// retrieves the name of the server, with the current page
$urlx=$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'];
// This stuff below works with your name to prepare it to recieve hte information coming to it
$ref=str_replace(" ",null,$HTTP_USER_AGENT);
$URL="http://www.etc.com/etc/etc.php?urlx=".$urlx."&site=".$SERVER_NAME."&ref=".$ref;
// opens the website, and prepares it.
$file = @fopen("$URL", "r");
// set's r to blank variable
$r = "";
reading data into a file,
do {
  $data = @fread($file, 8192);
  if (strlen($data) == 0) {
      break;
  }
  $r .= $data;
} while (true);
fclose ($file);
echo $r;


?>[/code]
It looks safe.
I might have missed something but it looks pretty safe to me.
Link to comment
Share on other sites

It looks to me like the script is analyzing your server information, and including a file that hte guy wants included based on your server information.

There is no user input coming from anywhere, but of course he would be able to do something with it if he wanted on his end obviously.  Never trust a script from someone you don't know.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.