http://www.perlmonks.org?node_id=306805


in reply to Re: Re: Vetting a CGI script
in thread Vetting a CGI script

Ok, I see how they were able to take over the machine in that example, but assuming you *have* to offer file upload, how can you protect against that? It's been a long time since I've worked with CGI's that offer file upload capability, and I think when we did, we handled it with CGI.pm. I don't recall specifying a "temp" directory. Is the solution to the problem you presented fixed by specifying a temp directory that is *NOT* the cgi-bin directory?

I just read some in 'perldoc CGI' - there's a section titled "-private_tempfiles" that describes security issues with file uploads and the snifibility of info being written to those temp files.

I guess I'm wondering what the *right* way to program file uploads - is using CGI.pm to do that a good way?

TIA.