#Directory traversal attacks

17 messages · Page 1 of 1 (latest)

eager plinth
#

How should I go about preventing potential directory traversal attacks when using and concatenating user-input paths?
Path::canonicalize only works for files that actually exist, so it can't be used for detecting directory traversal

clever grotto
#

The canonicalize is definitely needed to prevent escape by using a symlink

eager plinth
clever grotto
eager plinth
#

Let's say I'm extracting a zip file or something, to some/directory/

#

I want to ensure some/directory/{user_input_path} doesn't leave some/directory

clever grotto
#

Not a path to read

eager plinth
#

Ya

clever grotto
eager plinth
#

Yeah, I think that'll do, thank you
I kind of expected the OS to provide some sort of help with this

clever grotto
eager plinth
#

oh yeah absolutely

#

plus needs to be portable

tropic jasper
#

bit heavy