Closed cha512 closed 1 year ago
@cha5126568: Thanks for finding this vulnerability! This is going to get fixed ASAP!
Please keep in mind that in any situation where this vulnerability matters you probably shouldn't use plain unencrypted FTP anyways, but also that's not an excuse for this vulneratbility.
Solved by #58
Suppose an attacker has a credential to access FTP server.
And suppose a user using fineFTP wants to share only a specific directory, as shown below.
In this case, an attacker can access unauthorized directories via path traversal.
Here's why.
The implementation of the
toLocalPath
function used by fineFTP to handle paths is shown below.A logic is needed that checks whether the return string of
toLocalPath
is a subdirectory of the local root (or the local root itself). However, there isn'tThus, if
/../../../../
(or/..\..\..\..\..\
on Windows) is used, depending on the account's permissions, file reads or writes for unauthorized paths can become possible.