Membership
Main Menu
Forum Boards
Stats
- 18 tutorials
- 72,337 members
- 696,776 forum posts
- 11 blog posts
Tutorials
PHP Security
Views: 64726
9. Directory traversal
Imagine the same script we used when talking about RFI attacks:
We will just say that this particular file is stored in the following path: /home/someone/public_html/index.php. The attacker could then do: index.php?page=../secret
That would give us /home/someone/public_html/secret.php which would otherwise have been accessible. I am sure you could think of more dangerous situations than this particular one.
There are a couple of ways you could prevent this with. First of all you could have an array of valid pages, e.g.:
Another thing you could do is check that the requested file matches a particular format:
Basically you need to verify that the entered information is valid and conforms to what you expected.
