I would like to be at least certain that my Perl cgi code doesn't fall prey to obvious hack attacks. I'm wondering if I'm on the right right as far cgi security is concerned with the following measures I've taken:
1) taint mode is enabled on the main script
2) fatal_to_browser is turned off
3) use strict is on
4) Perl modules reside in a directory below the web directory (i.e. /usr/home/mysite/perlmodules)
5) Use CGI.pm instead of own code to parse data
6) Every user input goes through the following regex:
Am I doing the right things? Is there anything terribly obvious that I need to add to the list?# null byte $data =~ s/\x00//g; $data =~ s/"/"/g; $data =~ s/\|/\|/g; # to prevent sql injection $data =~ s/drop/dr0p/ig; $data =~ s/insert/ins3rt/ig; $data =~ s/select/se1ect/ig; # letter 'l' becomes number '1' $data =~ s/delete/de1ete/ig; $data =~ s/alter/a1ter/ig; $data =~ s/update/upd4te/ig; # unix command? $data =~ s/rrm//ig; # javascript $data =~ s/script/skript/ig;
Cheers and many thanks in advance :)
update: I'm using a shared server. I've correctly set the permission to my alloted directory.
In reply to CGI (in)security by kiat
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |