Mail::Address Under Taint
"Jeffrey Horn" <[email protected]> Sun, 29 Aug 2004 05:45:03 -0500
| Newsgroups | gmane.comp.lang.perl.modules.mail-box |
|---|---|
| Message-ID | <[email protected]> |
I'm having a problem running MIME::Lite which uses Mail::Address under tainting. The following program illustrates that there is a problem in Mail::Address: #!/usr/bin/perl -T use Mail::Address; my $addy = '[email protected]'; my ($o) = Mail::Address->parse($addy); { my ($a,$b,$c)=@{$o}; my $arg = $b; my $nada=substr($arg,0,0); local $@; eval { eval "# $nada" }; if (length($@) != 0) { warn "'$arg' IS TAINTED"; } else { warn "'$arg' IS CLEAN"; } } This outputs the following: '[email protected]' IS TAINTED at ./test.pl line 15. I've isolated this down to sub _tokenise(), near line 116 of Mail::Address. Before the line that reads: s/^("([^"\\]|\\.)*")\s*// # "..." || s/^(\[([^\]\\]|\\.)*\])\s*// # [...] || s/^([^\s\Q()<>\@,;:\\".[]\E]+)\s*// || s/^([\Q()<>\@,;:\\".[]\E])\s*// and do { push(@words, $1); next; }; $_ is untainted. After this line $1 is tainted. I'm not exactly clear on what is going on here, or why it would taint $1. Perhaps you could shed some light on the subject. -- Jeff Horn