🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: PHP

#213841
From: Steve
Date: Sat, 20 Jan 2007 19:02
52 lines
3522 bytes
admin@eelbash.yi.org wrote in message news:
<20070120183908.E3eXvxY6hsoM@anonymous.poster> ...
> On Sat, 20 Jan 2007 10:37:38 -0500, Steve wrote:
> 
> Thanks for those examples and warnings. Does this summarize it / restate
> it?
> 
> ' " and \ (and the null character) are escaped in php processing by
> default because those characters are used a lot - are probably always
> needed - to execute commands that a hacker might try to sneak into
> unvalidated data fields.

It's actually \0 (see: http://insecure.org/news/P55-07.txt, it's for 
perl but applies).  There are many more.  In php you can also use 
escapeshellcmd($userinput); and escapeshellarg($userinput);  There are 
arguments for all kinds of different approaches to input validation, 
all that really matters is that it is done some way.

> 
> In a php module, the escaped characters are not evaluated, so php
> processes normally, but it won't execute a command with them present.

Too much depends upon what the php module does, how data is passed to 
it, and how it is executed to answer this.

> 
> If you aren't just storing data on a database, but need to write it out in
> an email message or newsgroup posting, you have to get rid of the escape
> characters, while still keeping the hackers out.
> 
> One way is to keep the php default of 'on' for magic_quotes_dbc. Then, at
> some point in the php module, when it has processed all the fields, but
> before it calls the mailto program, run stripslashes() on each field to
> remove the escape characters.

stripslashes() for the fields you do not need them, like perhaps body 
text.  But anything being passed through the shell command line must be 
evaluated and passed escaped where need be.  Look at how you are 
passing the message to mixmaster.  Is there anything in that 
commandline that the user was able to input?  If so, was it properly 
validated?

magic_quotes_gpc can be off or on, leaving it on is a lazy approach, it 
is better to have it off and ensure you have written solid code.  But 
it can help with security while you are learning and if you are 
uncertain that what you are running is safe.

/steve
-- 
Packetderm, LLC
Web hosting, SSH Tunneling, Proxies, Advanced E-Mail, Privacy
http://www.cotse.net/areyoureadyforus.html
Technical Details
Message-ID: <MPG.201c313cb6f2813a98982b@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!news-in-01.newsfeed.easynews.com!easynews.com!easynews!news-out.octanews.net!mauve.octanews.net!198.186.190.95.MISMATCH!news-out.readnews.com!postnews3.readnews.com!nr2.newsreader.com.POSTED!not-for-mail
References: <MPG.201c014b818450d498982a@news.newsreader.com> <20070120183908.E3eXvxY6hsoM@anonymous.poster>

Show Full Headers
Complete Article Headers
Message-ID: <MPG.201c313cb6f2813a98982b@news.newsreader.com>
Subject: Re: PHP
Date: Sat, 20 Jan 2007 14:02:11 -0500
From: Steve <steve@invalid.inv>
References: <MPG.201c014b818450d498982a@news.newsreader.com> <20070120183908.E3eXvxY6hsoM@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!news-in-01.newsfeed.easynews.com!easynews.com!easynews!news-out.octanews.net!mauve.octanews.net!198.186.190.95.MISMATCH!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: 52
NNTP-Posting-Host: 9d2a2d95.nr2.newsreader.com
X-Trace: DXC=TfmEe:K; [h9G4A`M`oJg2=OA8_@f\K_i2dSnOn3mmWZ:iOnBjUTfZ0:oHL:MW\X;
 06; 6; T7Y@YaF2`8GII8Ko2@4
X-Complaints-To: abuse@newsreader.com