Jump to content

[SOLVED] need help with header injection


darkfreaks

Recommended Posts

it doesn't redirect to a page this is retarded whoever designed this to display the error on the same page through the header here is the code....

<?php
//the error part is unsafe even if i take itout and put the //whole error in a $variable 
//and urlencode it.
header("Location: $base_url/login.php?game=
$game&error=Error+logging+in.+Have+you+created
+an+account+yet?+Passwords+are+caSe+SEnsITIvE.");?>

 

 

 

i tried

 

 

<?php

$error="Error+logging+in.+Have+you+created+an+account+yet?+Passwords+are+caSe+SEnsITIvE.";
header("Location: $base_url/login.php?game=".urlencode($game)."&error=".urlencode($error)."");
?>

 

but that did not work either :-\

No, we need to see how the script login.php is using $_GET['error']. That's where the problem is, not how you're setting it. The problem is that the script is trusting that $_GET['error'] will always be only those strings it knows about.

 

Never trust user input

 

At minimum, you should be using the strip_tags before sending the value of $_GET['error'] to the screen.

 

Ken

 

 

there is no $_GET['error'] it is all passed through this function

 

<?php

function error($page,$error = "")
{
include "globals.inc.php";
if (ereg("\?",$page))
{
	$string = "Location: $page&error=" . space2plus($error);// turn + to spaces
}
else
{
	$string = "Location: $page?error=" . space2plus($error);// turn + to spaces
}
return $string;
}?>

No.

 

Somewhere in the script login.php it is sending the value for $_GET['error'] to the screen.

 

If there is no $_GET['error'] then your scripts are relying on register_globals being enabled which is another security problem.

 

Instead of posting snippets of the script that don't relate to the problem, just post the entire script.

 

Ken

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.