SSHD corruptions and directory traversal

I recently ran noticed that sshd was not running on my turris box. Starting the service via the services tab (http://192.168.1.1/cgi-bin/luci/admin/system/startup) did not resolve the issue so i created a custom command to start the service manuly using /etc/init.d/sshd start. This produced the following output

key_load_public: invalid format
Could not load host key: /etc/ssh/ssh_host_rsa_key
key_load_public: invalid format
Could not load host key: /etc/ssh/ssh_host_dsa_key
key_load_public: invalid format
Could not load host key: /etc/ssh/ssh_host_ecdsa_key
key_load_public: invalid format
Could not load host key: /etc/ssh/ssh_host_ed25519_key
Disabling protocol version 2. Could not load host key
sshd: no hostkeys available -- exiting.

I manually ran ssh-keygen -A and got no output suggesting that the host keys already existed but must have been created corrupt. So the fix is to deleted the host keys and recreate them. to do this i created a custom commands for ls and rm which allowed arguments to be passed by the user. This is where i can in to the problem. if i try to pass /etc/ssh/ as an argument to either the ls command i end up wit the following

# ls etc
ls: etc: No such file or directory

as you can see the back slashes and everything after the second backslash is removed. i attempted to url encode this argument but that had no effect. so i hit it with a hammer and urlencoded it again and success. i was successfully able to list the directory using the following argument ls %252fetc%252fssh%252f which produced

# ls /etc/ssh/
moduli
ssh_config
ssh_host_dsa_key
ssh_host_dsa_key.pub
ssh_host_ecdsa_key
ssh_host_ecdsa_key.pub
ssh_host_ed25519_key
ssh_host_ed25519_key.pub
ssh_host_rsa_key
ssh_host_rsa_key.pub

after this the fix was pretty simple. i ran the following commands via the custom commands section to remove the old host files

# rm %252fetc%252fssh%252fssh_host_dsa_key
# rm %252fetc%252fssh%252fssh_host_dsa_key.pub
# rm %252fetc%252fssh%252fssh_host_ecdsa_key
# rm %252fetc%252fssh%252fssh_host_ecdsa_key.pub
# rm %252fetc%252fssh%252fssh_host_ed25519_key
# rm %252fetc%252fssh%252fssh_host_ed25519_key.pub
# rm %252fetc%252fssh%252fssh_host_rsa_key
# rm %252fetc%252fssh%252fssh_host_rsa_key.pub

I then started ssh via init which automatically recreates the host keys.

you can see the commands i created to debug and fix this issue here (http://bayimg.com/bAiMbaAGl). i thought i would put this post here incase others run into this problem. That said the developers may see this as a security issue as they have clearly tried to do some sanitisation on the argument input. Ultimitly it woiuld be nice to have a recreate ssh keys so a user can easily fix corruption to the ssh keys

EDIT: it was just pointed out to me that the initial issue is present in the erratum and there are additional fixes their
https://www.turris.cz/doc/en/troubleshooting/erratum