There is a php file in my server that is called when authenticated clients want to upload a file to their own server folder. Please note that it is a dev site, so there is no need to focus on possible issues like clients spamming the server etc. I get the file path from $_POST['filePath'], and the authenticated username $_SERVER['REMOTE_USER'].
Together they form the path where the file is created, like this:
users/$username/$filepath
Now the file path is the concern (as everything coming from the client usually is :) )
Is it possible for the client to post backspaces in the file path string, and leave a way to modify the servers files?
Here are a few examples:
test.txtbecomesusers/user/test.txt(normal behavior)foo/bar.logbecomesusers/user/foo/bar.log(still normal behavior)#8#8#8#8#8otheruser/important.txtbecomesuser/otheruser/important.txt(#8 stands for a backspace, and this behavior is not wanted)#8#8#8...http://this.domain.com/server.cfgbecomeshttp://this.domain.com/server.cfg(Definitely not wanted behavior)
Just to clarify my question, I want to know if this is possible, not a way to prevent it with, say, regexp.