The vulnerability lies in the design of Secure Copy Protocol (SCP) tools and can be exploited by malicious servers to unexpectedly alter victims’ ﬁles on their client machines, in the context of the user running the aﬀected application.
Exploitation of this vulnerability by a malicious SCP Server isn’t limited to alteration of the ﬁles which you fetched, but also expands to changing of access permissions, or downloading of extra documents. The SCP client fails to thoroughly check whether it’s getting the expected objects or not, which can be exploited by attackers to overwrite the user’s .bash_aliases ﬁle. This, in turn, would allow the attacker to run arbitrary commands on the victim’s device when they do routine stuﬀ, like list a directory.
However, the scp client only performs cursory validation of the object name returned (only directory traversal attacks are prevented), while the server chooses which ﬁles/directories are sent to the client. If recursive operation (-r) is performed, the server can manipulate subdirectories as well (for example, to overwrite the .ssh/authorized_keys ﬁle).
OpenSSH 7.9 and prior versions are vulnerable. This issue aﬀects the scp client shipped with openssh. The SSH protocol or the SSH client is not aﬀected.
Changing of Access Permissions
Unauthorized File Downloads
OpenSSH 7.9 and prior
Find a quick patch by sintonen in the link below: https://sintonen.ﬁ/advisories/scp-name-validator.patch A vendor patch is still not available.