Impact
If a system designer has deployed the Erlang/OTP TFTP server and assumed that the callback state value {root_dir,RootDir} mentioned in a type signature in the documentation, firstly, can be used as a server option for the undocumented tftp_file module, and secondly, would protect against relative path traversal above RootDir; then the file systems on the machine are open for remote read and writes without authentication, as the user and group running the Erlang VM.
File names in remote requests are, by the Erlang/OTP TFTP server, simply concatenated with RootDir, so if they contain "../" components the request can reach above RootDir and thereby any position in the file system hierarchy.
Note that Erlang/OTP TFTP server configurations that do not use root_dir allows remote file access anywhere on the system, with absolute or relative file paths, and this is a known property of the TFTP protocol as stated in RFC 1350 under Security Considerations, so it cannot be considered a vulnerability.
For a system to be vulnerable, the system designer must have used the undescribed {root_dir,RootDir} state as an option under incorrect assumptions. The state value/type is present in the documentation, in a function signature specification, but it is never described. It is only the option's name that may suggest that it could protect against relative path traversal.
To figure out how to use the root_dir state as an option, the system designer would have to consult the source code for the Erlang/OTP TFTP application and then it should be obvious that the option implements a file name concatenation that lack path traversal protection.
The system must also be reachable from untrusted hosts and contain confidential or precious data readable or writable by the OS user running the TFTP server, in this case the Erlang VM. For a TFTP installation without the root_dir option these points would be design errors, as the TFTP RFC 1359 indicates under Security Considerations.
Workarounds
- Ensure that no sensitive or precious data is readable or writable by the OS user running the Erlang VM
- Ensure that the TFTP server port on the machine running the Erlang/OTP TFTP server is not reachable from untrusted machines.
- Use the
connection_option() {reject,write} to tftp:start(ConnectionOptions) when starting the TFTP Server. This prevents write access.
Affected/Unaffected Versions
A version larger than or equal to one of the listed patched versions is unaffected; otherwise, a version that satisfies an expression listed under affected versions is affected, and if it does not, it is unaffected.
The documentation of the new OTP version scheme describes how versions should be compared. Note that versions used prior to OTP 17.0, when the new OTP version scheme was introduced, are never listed since it is not well defined how to compare those versions.
In the case of this vulnerability, versions prior to OTP 17.0 are also affected.
Credits
Thanks to Luigino Camastra at Aisle Research for finding and responsibly disclosing this vulnerability to the Erlang/OTP project.
Impact
If a system designer has deployed the Erlang/OTP TFTP server and assumed that the callback state value
{root_dir,RootDir}mentioned in a type signature in the documentation, firstly, can be used as a server option for the undocumentedtftp_filemodule, and secondly, would protect against relative path traversal aboveRootDir; then the file systems on the machine are open for remote read and writes without authentication, as the user and group running the Erlang VM.File names in remote requests are, by the Erlang/OTP TFTP server, simply concatenated with
RootDir, so if they contain "../" components the request can reach aboveRootDirand thereby any position in the file system hierarchy.Note that Erlang/OTP TFTP server configurations that do not use
root_dirallows remote file access anywhere on the system, with absolute or relative file paths, and this is a known property of the TFTP protocol as stated in RFC 1350 under Security Considerations, so it cannot be considered a vulnerability.For a system to be vulnerable, the system designer must have used the undescribed
{root_dir,RootDir}state as an option under incorrect assumptions. The state value/type is present in the documentation, in a function signature specification, but it is never described. It is only the option's name that may suggest that it could protect against relative path traversal.To figure out how to use the
root_dirstate as an option, the system designer would have to consult the source code for the Erlang/OTP TFTP application and then it should be obvious that the option implements a file name concatenation that lack path traversal protection.The system must also be reachable from untrusted hosts and contain confidential or precious data readable or writable by the OS user running the TFTP server, in this case the Erlang VM. For a TFTP installation without the
root_diroption these points would be design errors, as the TFTP RFC 1359 indicates under Security Considerations.Workarounds
connection_option(){reject,write}totftp:start(ConnectionOptions)when starting the TFTP Server. This prevents write access.Affected/Unaffected Versions
A version larger than or equal to one of the listed patched versions is unaffected; otherwise, a version that satisfies an expression listed under affected versions is affected, and if it does not, it is unaffected.
The documentation of the new OTP version scheme describes how versions should be compared. Note that versions used prior to OTP 17.0, when the new OTP version scheme was introduced, are never listed since it is not well defined how to compare those versions.
In the case of this vulnerability, versions prior to OTP 17.0 are also affected.
Credits
Thanks to Luigino Camastra at Aisle Research for finding and responsibly disclosing this vulnerability to the Erlang/OTP project.