PFudd has asked for the wisdom of the Perl Monks concerning the following question:
Hi all,
I have to maintain a legacy CGI script, and recently discovered that it uses the header 'X-Forwarded-For' without validation. I would like to trace where that unvalidated data can get to.
I don't think I can turn on real taint checking; the program is too big, too old, and too crufty. I think too many things will break, and so this technical debt goes unpaid.
Is there a way to just say 'follow this value' and see where it goes? That is, if it's used as the input to a function, then start following the output of the function as well, in just the same way as real taint checking does?
I hope that by the time it gets stuck into a file or a database that it's been escaped and I'm safe from SQL injection attacks, but I'm stuck in a maze of twisty passages, all alike. I'm overwhelmed.
As I'm not sure if I can test every code path, is a static code analyzer what I need?
I've briefly looked at the Taint and Taint::Runtime man pages, but I don't know if they can help. I also looked at Tie::Watch, but it looks like I'd have to run the program, add watchpoints to new variables, run the program, add watchpoints to more new variables, etc.
Thanks!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Taint tracing a single variable?
by Anonymous Monk on May 16, 2014 at 02:56 UTC | |
|
Re: Taint tracing a single variable?
by RonW (Parson) on May 16, 2014 at 16:39 UTC | |
by PFudd (Initiate) on May 21, 2014 at 18:03 UTC | |
by RonW (Parson) on May 21, 2014 at 21:35 UTC |