Ethical Hacking

Learn to find vulnerabilities before the bad guys do! Gain real world hands on hacking experience in our state of the art hacking lab. Course designed and taught by expert instructors with years of penetration testing experience. 12 student maximum in every class. Certification attempt included in every package.
Computer Forensics Training at InfoSec Institute

Gain the in-demand skills of a certified computer examiner, learn to recover trace data left behind by fraud, theft, and cybercrime perpetrators. Discover the source of computer crime and abuse at your organization so that it never happens again. All of our class sizes are guaranteed to be 12 students or less to facilitate one-on-one interaction with one of our expert instructors.




Network Security SecProg
[Top] [All Lists]

Re: php - inject code into $_SERVER ?

Subject: Re: php - inject code into $_SERVER ?
Date: Wed, 02 Feb 2005 21:14:36 +0100
Dave Hull wrote:
Maybe it's a good idea to also parse the dhcp leases to check that the
ip has been attributed by the dhcp server...


Finally you're going up the right tree. Chasing webserver errors from a script executed by it is an exercise in futility.



Could you use the DHCPLEASEQUERY option for this?

http://www.ietf.org/internet-drafts/draft-ietf-dhc-leasequery-07.txt

I've been doing some PHP code audits in recent months and have been
amazed at the number of projects that blindly trust client input.

Client input and server platform input are two wildly different things. The $_SERVER[REMOTE_ADDRESS] variable is taken from a connected socket and simply inet_ntoa()'d to the environment. Since the packet got there, we know the variable can't possibly contain anything but an IP-address in standard dot notation (not that it matters if it doesn't, since it will still be four bytes translated to an IP-address).


Simply by asking this question, you're ahead of the game. Always
assume the worst, that some determined hacker has created a custom
browser and has the ability to insert environment and cookie variables
of her own choosing.

Environment variables, no. Cookie variables, yes. If the user can insert environment variables the game is lost. There is no chance for php to fend that off, no matter if the coder is god herself.
No browser on earth can insert environment variables without first compromising the server. If they could it would be so trivial to take over a website that nobody would care to set one up, and writing your own "browser" is trivial enough if it only has to send one request (or even a series of requests from various spoofed addresses).


Don't trust any input from the user or their browser.


Exactly. But trust the input from the server. You don't have much choice anyway, so it's a waste of time bothering about it.


/exon

<Prev in Thread] Current Thread [Next in Thread>