Catching directory transversals passed through QueryString



Ok, the gist of the problem is I have a site my predecessor created
that much of it goes through a single asp.net app. For some reason,
instead of using templates or includes, he passed everything through
this one bit of code that dumped html and flat text in the middle of
the page. To keep it dynamic, he has the querystring take in a
filename. eg.
http://www.oursite.net/default.aspx?filename=/folder/file.txt

Of course, this leaves it wide open for
http://www.oursite.net/default.aspx?filename=../web.config
or
http://www.oursite.net/default.aspx?filename=../../../Inetpub/wwwroot/default.aspx
or worse.

For now, I'm just using regex to require either ".txt" or ".htm?" and
then catch "../" and hit the breaks if it finds that. I'm concerned,
though, that there might be other ways of exploiting this.

.



Relevant Pages

  • Problem with "Back" button in IE 5.0 HELP!
    ... For some reason, out of the blue, if I hit the "Back" button when using IE ... an error code appears and the app closes down. ...
    (microsoft.public.windowsupdate)
  • Re: Opinion wanted
    ... the details including the nature of my own app (which you mischaraterized ... correct the current control (provided that control is invalid but invalid ... causes you to validate controls that have already been ... largely discreditted for good reason and has very little use these days. ...
    (microsoft.public.dotnet.framework.windowsforms)
  • Re: edit & continue
    ... > and just run the app in the dubugger to test it. ... there is little realistic way to perform unit tests, ... > solid reason, "If I encounter a simple mistake I can fix it without ... > practice talk that only seems to apply if you are following a certain ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Tablets? - OT
    ... - the main reason for porting was so idiots could maintain the code ... on a yellow legal pad. ... to find anyone to pay me to play with it. ... and an app that calculated the temperature from cricket chirps. ...
    (microsoft.public.vb.general.discussion)
  • Re: [PATCH/RFC] A method for clearing out page cache
    ... > app designers very frequently think that the VM gets its act wrong (most ... Any left over cache is wrong, ... coupled jobs. ... reason, perhaps this is such a reason. ...
    (Linux-Kernel)

Loading