Skip to content

SMB/CIFS password visible in processlist #6092

Closed

Description

@Ewoxx

When using external storage "SMB/CIFS" username and password becomes visible to users logged in on the server.

The password is visible when listing processes on the server (ps -ef)

This is a running process:
sh -c smbclient -N -U 'DOMAIN/UID%PASSWORD' -O 'TCP_NODELAY IPTOS_LOWDELAY SO_KEEPALIVE SO_RCVBUF=8192 SO_SNDBUF=8192' -O 'TCP_NODELAY IPTOS_LOWDELAY SO_KEEPALIVE SO_RCVBUF=8192 SO_SNDBUF=8192' -d 0 '//sambaserver/share' -c 'dir "UID\Documents\Download\desktop.ini"' 2>/dev/null

Activity

  1. PVince81 commented on Nov 28, 2013

    @PVince81
    Contributor

    There might be a way to pass the password to smbclient using popen's stdin

  2. bantu commented on Dec 1, 2013

    @bantu

    @PVince81 Not sure whether smbclient accepts password from stdin, but it supports reading credentials from a file. The option is -A, --authentication-file=FILE Get the credentials from a file.

  3. PVince81 commented on Dec 2, 2013

    @PVince81
    Contributor

    It probably does, @icewind1991 did it in his PR.
    But good to know!

  4. Ewoxx commented on Dec 16, 2013

    @Ewoxx
    Author

    Just out of curiosity, where are we on this issue? Just installed v6.0 and its still there, is it awaiting commit? :)

  5. PVince81 commented on Dec 17, 2013

    @PVince81
    Contributor

    There is a full rewrite of the smbclient storage in the PR above.
    Before that PR can be merged it needs to be reviewed and regression tested.

  6. Ewoxx commented on Dec 17, 2013

    @Ewoxx
    Author

    Sounds good!
    How does it work after that? Will release an update with a bunch of fixes and this one in it?

  7. PVince81 commented on Dec 19, 2013

    @PVince81
    Contributor

    Since it's a full rewrite it will probably be released as part of OC 7.

    @icewind1991 would it be possible to extract the password hiding/piping approach of your PR and apply it to OC 6's
    smb4php ?

  8. icewind1991 commented on Dec 19, 2013

    @icewind1991
    Contributor

    Not without significant work I think.

    It may be safer to backport the whole thing to oC6 once it's properly tested

    @Ewoxx you can test the new SMB backend by copying the files_external app from https://github.com/owncloud/core/tree/smb/apps into your installation, it should work just fine in oC6.
    (Make sure to backup any important data, that everything works for me is no guarantee until we've done more testing)

  9. Ewoxx commented on Dec 19, 2013

    @Ewoxx
    Author

    Not sure if i did something wrong. But id didn't work.
    This is what I did:
    cd /var/www
    wget https://github.com/owncloud/core/archive/smb.zip
    unzip smp.zip
    mv /var/www/html/owncloud/apps/files_external .
    cp -rv /var/www/core-smb/apps/files_external /var/www/html/owncloud/apps
    chown -R apache: /var/www/html/owncloud/apps/files_external
    service httpd restart

    The effect is that the "External storage support" application disappear from OC and also the mount.

    Any idea?

  10. PVince81 commented on Jun 20, 2014

    @PVince81
    Contributor

    I think this is not backportable.
    Also the SMB client rewrite didn't make it into OC 7.
    So will have to go to OC 8.

  11. modified the milestones: , on Jun 20, 2014
  12. eigenphase commented on Jul 3, 2014

    @eigenphase

    This is sad. Is there an intermediate fix for this?
    Actually this causes me sleepless nights to know that the password appears in the "publicly" visible process list.

  13. PVince81 commented on Jul 3, 2014

    @PVince81
    Contributor

    Suggestions:

    1. try mounting the SMB storage directly on the Linux filesystem (using "cifs").
      For example mount it to "/mnt/smbstorage1".
      Then in ownCloud, create a "Local" external storage that points to "/mnt/smbstorage1".

    This only works if it's the admin who is mounting the storage, not the users mounting them themselves.

    1. You could also hack smb4php/smb.php yourself and try hard-coding the option -A like @bantu suggested here: SMB/CIFS password visible in processlist #6092 (comment)
      But it means you need to have a local file containing the passwords of all the SMB mounts.

    2. the clean alternative: need to fix smb4php/smb.php (which is a third party library) to not pass the password directly on the command line but pass it by writing to the process' stdin. It could be a matter of calling fwrite() with the password on the process handle after the popen() call. And also remove the password from the SMB URL that is built.

  14. PVince81 commented on Jul 3, 2014

    @PVince81
    Contributor

    @Xenopathic would you have time to have a look at my suggestion from point 3) ?

  15. 13 remaining items

  16. svensol commented on Sep 9, 2014

    @svensol

    Ok... thanks. I'll keep an eye open for v8 :-)

  17. modified the milestones: , on Sep 19, 2014
  18. modified the milestones: , backlog on Jan 8, 2015
  19. modified the milestones: , backlog on Feb 17, 2015
  20. locked as resolved and limited conversation to collaborators on Aug 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions