I’m thinking of including files into a script, that have names based on a cookie
Something like this:
include("sometext".$mycoockie_here."some_text.php");
Is the code above vulnerable to such attacks? – even with the "sometext" and "sometex.php" hard coded?
Of course it is. Everyone can tweak the values of cookies send to your web application. Imagine someone sending you a cookie with the content
So you will end up with the path
The PHP file handling functions pass the path on to the OS, which uses null-terminated strings, so you will end up including the contents of
Which you probably don’t want.