-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Directory traversal #2
Comments
avermeer-tc
added a commit
to funzoneq/tftp-proxy
that referenced
this issue
Feb 7, 2024
Hi @cbiedl. I created a fix for it as you can see above, but I no longer have write access to this repository. |
@funzoneq Your patch does not work: package main
import "fmt"
import "path"
import "path/filepath"
func main() {
dir := "/var/lib/tftpboot"
filename := "/../../../../../../../etc/passwd"
fmt.Println(filepath.Clean(path.Join(dir, filename)))
} gives me What does work is
Like so: path.Join(dir, path.Clean("/"+filename)) |
@funzoneq that is not sufficient I'm afraid. This one prepends a slash to user-supplied filename and should therefore do the trick:
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello,
thanks for that little program, it serves me well, and I'm considering packaging it for the Debian Linux distribution.
However, there's an issue: It seems ftp-proxy has no safeguard against requesting files from outside the given base directory, in other words, "get ../../../etc/passwd" will happily deliver that file - something that shouldn't happen from a security point of view.
The text was updated successfully, but these errors were encountered: