I have found an arbitrary file upload vulnerability on a flask application that I was playing with that essentially allows me to append to any file (and create new ones) in the file system. The code that causes the vulnerability boils down to:
with open(user_controlled, "a+") as f:
f.write(also_user_controlled)
I was trying to turn that into remote code execution but I haven't been able to do it since the usual technique of uploading of a PHP shell does not work for this case (as I'm dealing with flask). Can anyone think of a way?
Possibly important details:
- the server is running on linux;
- nginx is being used to serve the application.