Path Traversal in Wallet API
Title: Path Traversal in Wallet API Scope: https://github.com/EOSIO/eos Weakness: Path Traversal
Details:
Summary
When creating a wallet through the RPC interface, it is necessary to give parameters specifying the wallet you would like to access or create. This parameter is then used in path construction to load/save the file and is not checked. This results in being able to write the file to ANY location on the server.
Steps To Reproduce:
In this example, I will create the file in the "/home" directory, rather than the nodeos/data directory that the software should be restricted to.
I'll use the following parameter, "../../../../../../../home/haha", to traverse to the home directory.
I can then make a post request to /v1/wallet/create using "../../../../../../../home/haha" as the body
The response is successful as shown below: {F305412}
The file has now been created in the /home directory.
Note: This is a fresh installation of eos as of hours ago. Should be the v1.0.0 tag.
Impact
An attacker can write the wallet file to any directory on the server. Many programs have there own dedicated folders they use for loading/storage, and if an unknown file is written into the directory it can possibly do a large amount of damage. On top of this, the user can check if a file exists if it ends with ".wallet" due to the wallet_exist_exception