Uploaded image for project: 'RHEL'
  1. RHEL
  2. RHEL-118406

scp traversing up in destination location when copying .. or ../..

Linking RHIVOS CVEs to...Migration: Automation ...SWIFT: POC ConversionSync from "Extern...XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Normal Normal
    • None
    • rhel-10.0
    • openssh
    • None
    • rhel-security-crypto-diamonds
    • None
    • False
    • False
    • Hide

      None

      Show
      None
    • None
    • None
    • None
    • None
    • Unspecified
    • Unspecified
    • Unspecified
    • All
    • None

      I am not sure if this behavior is expected feature or if it is a regression but it is definitely confusing.

      What were you trying to do that didn't work?

      1. prepare test data
        [karel@testvm ~]$ mkdir -p A/B/C
        [karel@testvm ~]$ touch A/B/C/boom
        [karel@testvm C]$ mkdir ~/DEST
        [karel@testvm ~]$ cd A/B/C
        [karel@testvm C]$ ls ../..
        B
      1. try to copy B to ~/DEST
        [karel@testvm C]$ scp -r ../.. karel@localhost:~/DEST
        karel@localhost's password:
        boom 100% 0 0.0KB/s 00:00
      1. nothing there
        [karel@testvm C]$ ls ~/DEST/
      1. B has been stored in ~ instead
        [karel@testvm C]$ ls ~
        A B DEST
        [karel@testvm C]$ find / -name boom 2> /dev/null
        /home/karel/A/B/C/boom
        /home/karel/B/C/boom
      1. similar scenario with ..
        [karel@testvm C]$ cd ~/A/B
        [karel@testvm B]$ ls
        C
        [karel@testvm B]$ scp -r .. karel@localhost:~
        karel@localhost's password:
        scp: stat remote: No such file or directory
        scp: remote setstat "/home": Permission denied
        scp: failed to upload directory .. to ~

      we can see that scp doesn't expact .. or ../.. to proper directory names

      on RHEL-8 with openssh-8.0p1-25.el8_10.x86_64 this is not happening:

      1. scp -r ../.. karel@localhost:~/DEST
        karel@localhost's password:
        scp: error: unexpected filename: ..

      same behavir as on RHEL-8 is on RHEL-7 with openssh-7.4p1-23.el7_9.x86_64

      What is the impact of this issue to you?

      data are copied to an unexpected location

      Please provide the package NVR for which the bug is seen:

      openssh-9.9p1-13.el10.x86_64
      openssh-9.9p1-7.el10_0.x86_64
      also with
      openssh-8.7p1-46.el9.x86_64

      How reproducible is this bug?:

      always

      Steps to reproduce

      above

              zfridric Zoltan Fridrich
              ksrot@redhat.com Karel Srot
              Zoltan Fridrich Zoltan Fridrich
              Miluse Bezo Konecna Miluse Bezo Konecna
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Created:
                Updated: