Forum Moderators: phranque
I'm using Linux Red Hat 7.1 and Apache 1.3 on a remote server. Is there any way to prevent Apache from accepting a valid username/password sent in this particular way (preceding the URL address)? Alternatively, is there a Perl or PHP variable or method which could be used? I've tried the http_referer variable, but that just gives me the calling page. What I would need is the complete hyperlink which was clicked.
Any advice or tips will be much appreciated, evan a URL where the problem is being discussed.
Although the RFC doesn't allow username and passwords to be included in a URL the practical implementation of it does. I've done some basic (VERY basic) testing on this as it interests me and this is what I have found.
The browser interprets the inline username and password and sends it as correctly formatted Basic Auth info so the server sees it simply as a standard succesful logon. Because of this there are no environment variables that may assist in stopping inline username passwords that I am aware of.
However, I think you have already got half of a possible solution. By utlising the http_referrer variable you will have available to you the page on which the link was clicked. You can use that information to parse the page for the link using LWP in Perl or CURL in PHP (just 2 options, there are many more)
If there is an anchor tag with an embedded password then you can stop them progressing further or if a standard anchor link is present set a session variable allowing them continued access.
I hope this helps..
Jason
I'm familiar with using LWP in Perl and I will do some experimenting to see how quickly the calling page can be examined for an offending hyperlink. I'll come back when I have some results. Maybe other forum members will be interested.
Jimbo
I now think bakedjake's suggestion is the way to go. It will mean a lot of work for me but it should be watertight.