The function merely uses header("Location: ".$this->deny_access_page); and does not exit() or die() after this redirect. This could allow an attacker to view a page that is supposed to be restricted, without even being logged in. This would be accomplished by using a browser that ignores the sent header. Then the rest of the script would execute, revealing the content of the page that is supposed to be invisible to attacker.
Here is what the code should be to be more secure:
Maybe it would be better to change the way access_page works to something like this:
{Protected Page}
Code:
include(filename); $page = new Access; if ($page->accesspage) { PROTECTED HTML HERE }
Then change the function to redirect and return false on authentication fail.
you can do that but I don't think that this is common with the most applications. If you need to fight back hackers you should do somthing more then protect pages with just a password...
OMG!I am geek
Gender:
Posts: 55
366 credits Members referred : 0
my day will come..
« Reply #4 on: Oct 25, 2006, 09:14:50 AM »
But, isn't Header a merely PHP function that the server executes? I don't think there's any way to stop a header from being executed since it runs on the server itself.. I know Javascript and VB redirects can be prevented, but not PHP I believe. My ears are open for reasons though.
Moderator Community Supporter?
Jedai Sword Master
Gender:
Posts: 6309
38674 credits Members referred : 374
But, isn't Header a merely PHP function that the server executes? I don't think there's any way to stop a header from being executed since it runs on the server itself.. I know Javascript and VB redirects can be prevented, but not PHP I believe. My ears are open for reasons though.
yes right, that was the first time that a user is telling me these things (check the download count: more than 30000 incl. phpclasses.org)
that will say that a lot of applications a not safe (not only with AU)
But, isn't Header a merely PHP function that the server executes? I don't think there's any way to stop a header from being executed since it runs on the server itself.. I know Javascript and VB redirects can be prevented, but not PHP I believe. My ears are open for reasons though.
Well think about it.
A hacker goes to protected page, and is not logged in. PHP says "Go over here to login.php". Hacked browser says OK, I went. PHP execution still goes to completion Page is shown to hacker.
Moderator Community Supporter?
Jedai Sword Master
Gender:
Posts: 6309
38674 credits Members referred : 374
A hacker goes to protected page, and is not logged in. PHP says "Go over here to login.php". Hacked browser says OK, I went. PHP execution still goes to completion Page is shown to hacker.