Moin Moin!
Das ist meine Rekonstruktion Deines Codes, zusammen mit expliziten Taint-Ausgaben. Und die sagt, dass $Files{'logfile'} am Ende tainted ist. Demzufolge verweigert open() die Arbeit und wirft stattdessen eine Exception.
So sieht das aus:
/home/XXX/beat>perl -T beat.pl
scriptpath is tainted in lline 23 (value="beat.pl")
$_ is tainted in lline 27 (value="# config.ehf\n")
$_ is tainted in lline 27 (value="scriptdir=/home/XXX/beat\n")
scriptpath is tainted in lline 32 (value="beat.pl")
scriptpath is tainted in lline 36 (value="beat.pl")
Use of uninitialized value $Path{"cgidir"} in regexp compilation at beat.pl line 38.
scriptpath is tainted in lline 40 (value="beat.pl")
scriptname is not tainted in lline 41 (value="")
root is not tainted in lline 42 (value="")
cgi is not tainted in lline 43 (value="")
__datadir is tainted in lline 47 (value="/home/XXX/__data/")
Use of uninitialized value $Path{"root"} in concatenation (.) or string at beat.pl line 49.
Use of uninitialized value in concatenation (.) or string at beat.pl line 49.
Use of uninitialized value in concatenation (.) or string at beat.pl line 49.
homedir is not tainted in lline 51 (value="/")
logfile is tainted in lline 56 (value="/home/XXX/__data/log.ehf")
Insecure dependency in open while running with -T switch at beat.pl line 58.
Alexander
Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so".