|Pathologically Eclectic Rubbish Lister|
Comment onby gods
|on Feb 11, 2000 at 00:06 UTC||Need Help??|
Something weird you should look out for that I came across late one night:
Ok, whats the problem? CGI passes user_input=rfp , and the script tries to open rfp.db. (Lets ignore the ../../ stuff for now). Then it got interesting when I passed 'user_input=rfp%00'. Perl made $database="rfp\0.db", and then tried to open $database. The results?
It opened "rfp" (or would have, had it existed). What happened to the ".db"? As you probably know, Perl allows NULL characters in its variables as data. Unlike in C, NULL is not a string delimiter. But, the underlying system/kernel calls are programmed in C, which DOES recognize NULL as a delimiter. So the end result? Perl passes "rfp\0.db", but the underlying libs stop processing when they hit the first (our) NULL.
Im sure the brainpower of monks-combined (TM) could think of some nasty applications of this feature.
Update: I had intended to credit the author, RainForestPuppy, phrack mag 55-7. Sorry for the slip-up.
Added update per user request - dvergin 2002-02-26