Re: Security implications of using open() on untrusted strings.

2008-11-26 Thread Jorgen Grahn
On Tue, 25 Nov 2008 23:37:25 +0100, News123 <[EMAIL PROTECTED]> wrote: > Jorgen Grahn wrote: >> Compare with a language (does Perl allow this?) where if the string >> is "rm -rf /|", open will run "rm -rf /" and start reading its output. >> *That* interface would have been > Good example. (

Re: Security implications of using open() on untrusted strings.

2008-11-25 Thread News123
Jorgen Grahn wrote: > Compare with a language (does Perl allow this?) where if the string > is "rm -rf /|", open will run "rm -rf /" and start reading its output. > *That* interface would have been Good example. (for perl): The problem doesn't exist in python open("rm -rf / |") would try t

Re: Security implications of using open() on untrusted strings.

2008-11-25 Thread Jorgen Grahn
On Tue, 25 Nov 2008 02:26:32 -0500, r0g <[EMAIL PROTECTED]> wrote: > Jorgen Grahn wrote: ... >> Or am I missing something? > No Jorgen, that's exactly what I needed to know i.e. that sending > unfiltered text to open() is not negligent or likely to allow any > badness to occur. > > As far as what

Re: Security implications of using open() on untrusted strings.

2008-11-25 Thread Jorgen Grahn
On Tue, 25 Nov 2008 20:40:57 +1300, Lawrence D'Oliveiro <[EMAIL PROTECTED]> wrote: > Jorgen Grahn wrote: > >> Seems to me you simply want to know beforehand that the reading will >> work. But you can never check that! You can stat(2) the file, or >> open-and-close it -- and then a microsecond la

Re: Security implications of using open() on untrusted strings.

2008-11-24 Thread Lawrence D'Oliveiro
Jorgen Grahn wrote: > Seems to me you simply want to know beforehand that the reading will > work. But you can never check that! You can stat(2) the file, or > open-and-close it -- and then a microsecond later, someone deletes the > file, or replaces it with another one, or write-protects it, or

Re: Security implications of using open() on untrusted strings.

2008-11-24 Thread r0g
Jorgen Grahn wrote: > On Mon, 24 Nov 2008 00:44:45 -0500, r0g <[EMAIL PROTECTED]> wrote: >> Hi there, >> >> I'm trying to validate some user input which is for the most part simple >> regexery however I would like to check filenames and I would like this >> code to be multiplatform. >> >> I had hop

Re: Security implications of using open() on untrusted strings.

2008-11-24 Thread Jorgen Grahn
On Mon, 24 Nov 2008 00:44:45 -0500, r0g <[EMAIL PROTECTED]> wrote: > Hi there, > > I'm trying to validate some user input which is for the most part simple > regexery however I would like to check filenames and I would like this > code to be multiplatform. > > I had hoped the os module would have a

Re: Security implications of using open() on untrusted strings.

2008-11-24 Thread Terry Reedy
r0g wrote: Yep, I spotted that too which is why white-listing is my fallback plan. My question is really about the security of using unfiltered data in a filesystem function though. Are there particualar exploits that could make use of such unfiltered calls? The classic one would be submitting

Re: Security implications of using open() on untrusted strings.

2008-11-24 Thread Thomas Bellman
r0g <[EMAIL PROTECTED]> wrote: > Although it's a desktop (not internet facing) app I'm a little squeamish > piping raw user input into a filesystem function like that and this app > will be dealing with some particularly sensitive data so I want to be > careful and minimize exposure where practica

Re: Security implications of using open() on untrusted strings.

2008-11-24 Thread r0g
Steven D'Aprano wrote: > On Mon, 24 Nov 2008 00:44:45 -0500, r0g wrote: > >> Hi there, >> >> I'm trying to validate some user input which is for the most part simple >> regexery however I would like to check filenames and I would like this >> code to be multiplatform. >> >> I had hoped the os modu

Re: Security implications of using open() on untrusted strings.

2008-11-23 Thread Steven D'Aprano
On Mon, 24 Nov 2008 00:44:45 -0500, r0g wrote: > Hi there, > > I'm trying to validate some user input which is for the most part simple > regexery however I would like to check filenames and I would like this > code to be multiplatform. > > I had hoped the os module would have a function that wo

Security implications of using open() on untrusted strings.

2008-11-23 Thread r0g
Hi there, I'm trying to validate some user input which is for the most part simple regexery however I would like to check filenames and I would like this code to be multiplatform. I had hoped the os module would have a function that would tell me if a proposed filename would be valid on the host