Mitigation for file reverse

Filter for all characters that make directory traversal possible.

That means not just '.' and '/', but also any encoded alternatives such as:

%2e%2e%2f = ../
%2e%2e/ = ../
..%2f = ../
..%c0%af = ../ 


The best way to mitigate directory traversal is not to use user input when making file system calls. Of course, that may not be possible, so an alternative is to use an index. 

Example: 
view.php?language=English
—> 
view.php?language=1 

Popular posts from this blog

Phonebook - Hack the box Write up -- Web LDAP injection

wafwaf -- Hack The Box -- Web SQL injection

Cheat sheet for security+