Skip to content

File Sharing stack overflow, memory issue, crash, CSRF issue on 9.1.0 #25557

Closed

Description

@Revisor01

Steps to reproduce

  1. Upgrade to owncloud 9.1
  2. Login
  3. It shows CSRF check failed
  4. Deactivated files_sharing via occ
  5. Login workes

Expected behaviour

Login and works

Actual behaviour

shows CSRF check failed

Server configuration

Operating system:

Web server:
all-inkl.com
Database:
5.6.30
PHP version:
5.6.23
ownCloud version: (see ownCloud admin page)
9.1
Updated from an older ownCloud or fresh install:
updated from 9.0.3
Where did you install ownCloud from:
Install from tar.bz2
Signing status (ownCloud 9.0 and above):

Login as admin user into your ownCloud and access 
http://example.com/index.php/settings/integrity/failed 
paste the results here.

List of activated apps:

Enabled:

  • activity: 2.3.2
  • calendar: 1.2.2
  • comments: 0.3.0
  • contacts: 1.3.1.0
  • dav: 0.2.5
  • federatedfilesharing: 0.3.0
  • federation: 0.1.0
  • files: 1.5.1
  • files_pdfviewer: 0.8.1
  • files_texteditor: 2.1
  • files_trashbin: 0.9.0
  • files_sharing 0.10.0
  • files_versions: 1.3.0
  • files_videoplayer: 0.9.8
  • gallery: 15.0.0
  • notifications: 0.3.0
  • provisioning_api: 0.5.0
  • systemtags: 0.3.0
  • updatenotification: 0.2.1
    Disabled:
  • encryption
  • external
  • files_antivirus
  • files_external
  • firstrunwizard
  • templateeditor
  • user_external
  • user_ldap

The content of config/config.php:

$CONFIG = array (
'trusted_domains' =>
array (
0 => 'owncloud..de',
1 => 'owncloud..de',
2 => '.de',
3 => 'www.owncloud..de',
4 => 'www.owncloud..de',
5 => '.de',
),
'datadirectory' => '/www/htdocs///ownclouddata/data',
'tempdirectory' => '/www/htdocs///ownclouddata/tmp',
'overwrite.cli.url' => 'http://.de/cloud/owncloud',
'dbtype' => 'mysql',
'version' => '9.1.0.15',
'dbname' => 'd01cd1d3',
'dbhost' => '127.0.0.1',
'dbtableprefix' => 'oc_',
'filesystem_check_changes' => 0,
'dbuser' => 'd01cd1d3',
'dbpassword' => '',
'installed' => true,
'forcessl' => true,
'theme' => '',
'maintenance' => false,
'loglevel' => 3,
'mail_smtpmode' => 'smtp',
'appstore.experimental.enabled' => true,
'mail_from_address' => 'info',
'mail_domain' => 'owncloud.de',
'mail_smtpauthtype' => 'LOGIN',
'mail_smtphost' => 'w01078ba.kasserver.com',
'mail_smtpport' => '465',
'mail_smtpauth' => 1,
'mail_smtpname' => '',
'mail_smtppassword' => '',
'trashbin_retention_obligation' => 'auto',
'enabledPreviewProviders' =>
array (
0 => 'OC\Preview\Image',
1 => 'OC\Preview\MP3',
2 => 'OC\Preview\TXT',
3 => 'OC\Preview\MarkDown',
4 => 'OC\Preview\Epub',
5 => 'OC\Preview\PDF',
6 => 'OC\Preview\OpenDocument',
7 => 'OC\Preview\StarOffice',
8 => 'OC\Preview\MSOfficeDoc',
9 => 'OC\Preview\MSOffice2003',
10 => 'OC\Preview\MSOffice2007',
),
'updater.secret' => '',
'mail_smtpsecure' => 'ssl',
);

Are you using external storage, if yes which one: local/smb/sftp/...

Are you using encryption: yes/no
no
Are you using an external user-backend, if yes which one: LDAP/ActiveDirectory/Webdav/...

Client configuration

Browser:
Chrome
Operating system:
Mac OSX 10.11.6

Logs

Web server error log

{"reqId":"V5DHUlUNh8EAAC3bt5kAAAAk","remoteAddr":"217.93.9.75","app":"core","message":"starting upgrade from 9.0.1.3 to 9.1.0.15","level":0,"time":"2016-07-21T13:00:03+00:00","method":"GET","url":"/core/ajax/update.php?requesttoken=%3D%%3D","user":"--"}
{"reqId":"V5DHUlUNh8EAAC3bt5kAAAAk","remoteAddr":"217.93.9.75","app":"core","message":"Exception: {"Exception":"Exception","Message":"Die Anwendung konnte nicht installiert werden, weil Sie nicht mit dieser Version von ownCloud kompatibel ist.","Code":0,"Trace":"#grity(Array, '\/www\/htdocs\/w01...', '\/www\/htdocs\/w01...', false)\n#1 \/www\/htdocs\/w01078ba\/simon\/cloud\/owncloud\/lib\/private\/Installer.php(263): OC\Installer::updateApp(Array)\n#2 \/www\/htdocs\/w01078ba\/simon\/cloud\/owncloud\/lib\/private\/Updater.php(454): OC\Installer::updateAppByOCSId('164356')\n#3 \/www\/htdocs\/w01078ba\/simon\/cloud\/owncloud\/lib\/private\/Updater.php(254): OC\Updater->upgradeAppStoreApps(Array)\n#4 \/www\/htdocs\/w01078ba\/simon\/cloud\/owncloud\/lib\/private\/Updater.php(150): OC\Updater->doUpgrade('9.1.0.15', '9.0.1.3')\n#5 \/www\/htdocs\/w01078ba\/simon\/cloud\/owncloud\/core\/ajax\/update.php(193): OC\Updater->upgrade()\n#6 {main}","File":"\/www\/htdocs\/w01078ba\/simon\/cloud\/owncloud\/lib\/private\/Installer.php","Line":377}","level":3,"time":"2016-07-21T13:02:21+00:00","method":"GET","url":"/core/ajax/update.php?requesttoken=I3g2NToLJgUlehQpPikjBWMvOQMBV2wbOgQyOzwgN2U%3D%3AfSRxkQHLRIfSJLAsZFmNMb4BcfhZfNO5pfFUDm96pio%3D","user":"--"}

ownCloud log (data/owncloud.log)

Browser log

Insert your browser log here, this could for example include:

a) The javascript console log
b) The network log 
c) ...

Activity

  1. cipher2k commented on Jul 21, 2016

    @cipher2k

    I have the same issue. deactivating files_sharing via occ solved the issue of not being able to log in, but now the file sharing feature is missing.

  2. wmeneses commented on Jul 22, 2016

    @wmeneses

    hello, happens to me ... when I activate the ldap module, an answer to this problem?

  3. PVince81 commented on Jul 22, 2016

    @PVince81
    Contributor

    Please all tell us how did you update.

    From looking at the messages above it looks like the source code hasn't been properly replaced.

  4. added this to the 9.0.5 milestone on Jul 22, 2016
  5. Revisor01 commented on Jul 22, 2016

    @Revisor01
    Author

    Hello,
    I Downloaded tar.bz2, extracted on the Server, copy over config.php and started update process.

    Thanks for help

  6. PVince81 commented on Jul 22, 2016

    @PVince81
    Contributor

    @Revisor01 did you delete the old source code before extracting ?

  7. Revisor01 commented on Jul 22, 2016

    @Revisor01
    Author

    Yes.

  8. Revisor01 commented on Jul 22, 2016

    @Revisor01
    Author

    In an Otter Installation i tried to replace files. Same Error.

  9. PVince81 commented on Jul 22, 2016

    @PVince81
    Contributor
  10. Revisor01 commented on Jul 22, 2016

    @Revisor01
    Author

    I'm not at the pc right now. But there were no errors or integrity massages after disabling files_sharing.

  11. PVince81 commented on Jul 22, 2016

    @PVince81
    Contributor

    Could all the reporters answer the same questions ? The more details we have about the different setups, the closer we can get to a soluton. Thank you !

  12. 194 remaining items

  13. PVince81 commented on Aug 31, 2016

    @PVince81
    Contributor

    @wobemh Please make new tickets for any new issues observed on 9.1.1RC1 or patched instances.

    @derekbtw https://owncloud.org/faq/#backup
    @derekbtw since you don't have shares, your problem is likely a different one #25927

  14. derekbtw commented on Sep 1, 2016

    @derekbtw

    @PVince81 I figured it out. The problem was my max file upload size was set to 1KB for some reason. So when I typed in my username and password, it was over 1kb.

  15. kwisatz commented on Sep 1, 2016

    @kwisatz

    We have tested the latest patch mentioned above (https://patch-diff.githubusercontent.com/raw/owncloud/core/pull/25754.patch) and found it working.
    However, @PVince81 you mentioned that

    The patch was merged and will be in OC 9.1.1.

    This means that is you want to help testing, you can use tomorrow's daily build of stable9.1

    However, we're using the .deb package from your repository and 9.1.1 is not yet available here, is that known?

    owncloud:
      Installed: 9.1.0-1.1
      Candidate: 9.1.0-1.1
      Version table:
     *** 9.1.0-1.1 0
            500 http://download.owncloud.org/download/repositories/stable/Debian_8.0/  Packages
    
  16. PVince81 commented on Sep 1, 2016

    @PVince81
    Contributor

    You might find 9.1.1RC1 in the testing repositories

  17. stormsh commented on Sep 19, 2016

    @stormsh

    Hello there, I had login problems with my apps since I updated to 9.1. I solved this problem by adding App passwords for said apps. BUT I get this error when I try to log in with my mobile Firefox. The normal desktop Firefox (both are same version and nearly same addons) doesn't have a login problem. It's not urgend because I use the mobile forefox login twice per year.
    I just thought you might like the info.

  18. lolnerd commented on Sep 22, 2016

    @lolnerd

    Hi there, I encountered this problem after upgrading to 9.1 by repository (Ubuntu 16.04). After the info in this thread, I waited patiently to 9.1.1 being released via repository, yet still the bug remains. I'm unable to login via Web Interface with the "Zugriff verboten", "CSRF check failed" error.

  19. PVince81 commented on Sep 22, 2016

    @PVince81
    Contributor
  20. soaringPingu commented on Sep 22, 2016

    @soaringPingu

    Hi, for what it might be worth I have a slightly different path to the same issue, and it might be useful to someone :-)

    This doesn't just happen with upgrades.
    I started from scratch with 9.1.0 a month or so ago. My old version was 7, and I only have 3 family users, so didn't bother upgrade as I was also making a fair few other changes.
    I manually moved the old file structure of the data files into the new install. I have been using it since it was installed and I have shared one folder, with sub folders and files, with the group 'family'.
    Yesterday I added one of the family users back in, and there were some file name clashes with the old files, using lower case first letters, like 'documents', vs. 9.1.0 defaults of 'Documents' (it might be the other way around, not sure...). This became an issue on Windows. I used the sync utility in Windows and manually de-selected the upper case and lower case directories until they contained the same data. I then logged in to the web interface with the new user and removed one version, in this case the lower case ones (documents, music and photos).
    This morning, the new user could not log in, nor could I log in with my current user (admin rights). No changes had been made to the system at all.
    I could still log into the web interface using my original admin account, and notably, that account is not a member of the group "family", all other accounts are.
    My sync client on Ubuntu was showing a green connected tick, using the same credentials as I failed to log in with in the web interface. I didn't test it further than that.

    It appears that only users in the group 'family' (in my case) are affected.
    The folder that was shared with the group 'family' had no links to the removed folders
    The sync clients appeared to be unaffected

    (I have not done extensive testing as I am fairly novice in this and I don't have a test set-up, (and I don't want to break it ;-))

    If some log files are of use to anyone, let me know which ones.

    Since I only have a small system and my oc_share table only had one line in it, I solved it using the above suggested workaround of disabling the File Share and removing that entry. I then rebooted, enabled File Sharing, shared the folder again, and I am up and running.

  21. PVince81 commented on Sep 23, 2016

    @PVince81
    Contributor

    By the way, 9.1.1 was released which contains this fix.

    So I encourage anyone coming here with the same issue to try 9.1.1 first.

  22. lep86 commented on Sep 27, 2016

    @lep86

    OC 9.1.1 new installation on ubuntu 16. Got error CSRF check failed

  23. PVince81 commented on Sep 27, 2016

    @PVince81
    Contributor

    I'm locking this thread now as many people mistake it with #25927.

    If you came here through the search and see a CSRF check failed issue on 9.1.1, please report your details in #25927.

    Thanks.

  24. locked and limited conversation to collaborators on Sep 27, 2016
  25. changed the title [-]File Sharing stack overflow, memory issue, crash, CSRF issue on 9.1[/-] [+]File Sharing stack overflow, memory issue, crash, CSRF issue on 9.1.0[/+] on Sep 27, 2016
  26. PVince81 commented on Jan 10, 2017

    @PVince81
    Contributor

    Trying to find smaller steps to reproduce this locally. Goal is being able to test this automatically to avoid regressions in the future.

    Steps to recreate one level of recursion on v9.1.0:

    1. Create three users "user1", "user2" and "user3"
    2. Login as "user2"
    3. Create a folder "deleted"
    4. Share "deleted" with "user1"
    5. Delete "deleted" to trash (but leave it there)
    6. Create a folder "test"
    7. Share "test" with "user1"
    8. Login as "user3"
    9. Create a folder "withuser2"
    10. Share "withuser2" with "user2"
    11. Log out
    12. curl -D - -X GET -u user1:test http://localhost/owncloud/remote.php/webdav/welcome.txt > file.txt and debug into $this->ownerView->getPath() from the shared storage.

    At some point the $mounts list will contain a SharedMount when trying to resolve the "deleted" share. Since that one is not in the "Home" mount which is the first entry in $mounts, it will step to the second entry SharedMount and call getStorage() and getCache() which will internally initialized that matching shared storage, which itself will call $this->ownerView->getPath() again for itself.

    0  OC\Files\View->getPath() /srv/www/htdocs/owncloud/lib/private/Files/View.php:1693
    1  OC\Files\Storage\Shared->__construct() /srv/www/htdocs/owncloud/apps/files_sharing/lib/sharedstorage.php:83
    2  OC\Files\Storage\StorageFactory->getInstance() /srv/www/htdocs/owncloud/lib/private/Files/Storage/StorageFactory.php:82
    3  OC\Files\Mount\MountPoint->createStorage() /srv/www/htdocs/owncloud/lib/private/Files/Mount/MountPoint.php:137
    4  OC\Files\Mount\MountPoint->getStorage() /srv/www/htdocs/owncloud/lib/private/Files/Mount/MountPoint.php:160
    5  OC\Files\View->getPath() /srv/www/htdocs/owncloud/lib/private/Files/View.php:1687
    6  OC\Files\Storage\Shared->__construct() /srv/www/htdocs/owncloud/apps/files_sharing/lib/sharedstorage.php:83
    7  OC\Files\Storage\StorageFactory->getInstance() /srv/www/htdocs/owncloud/lib/private/Files/Storage/StorageFactory.php:82
    8  OC\Files\Mount\MountPoint->createStorage() /srv/www/htdocs/owncloud/lib/private/Files/Mount/MountPoint.php:137
    9  OC\Files\Mount\MountPoint->getStorage() /srv/www/htdocs/owncloud/lib/private/Files/Mount/MountPoint.php:160
    10 OC\Files\Config\LazyStorageMountInfo->getStorageId() /srv/www/htdocs/owncloud/lib/private/Files/Config/LazyStorageMountInfo.php:50
    11 OC\Files\Config\UserMountCache->addToCache() /srv/www/htdocs/owncloud/lib/private/Files/Config/UserMountCache.php:138
    12 OC\Files\Config\UserMountCache->registerMounts() /srv/www/htdocs/owncloud/lib/private/Files/Config/UserMountCache.php:124
    13 OC\Files\Config\MountProviderCollection->registerMounts() /srv/www/htdocs/owncloud/lib/private/Files/Config/MountProviderCollection.php:133
    14 OC\Files\Filesystem::initMountPoints() /srv/www/htdocs/owncloud/lib/private/Files/Filesystem.php:425
    15 OC\Cache\File->getStorage() /srv/www/htdocs/owncloud/lib/private/Cache/File.php:52
    16 OC\Cache\File->gc() /srv/www/htdocs/owncloud/lib/private/Cache/File.php:173
    17 OC::{closure:/srv/www/htdocs/owncloud/lib/base.php:717-729}() /srv/www/htdocs/owncloud/lib/base.php:720
    18 call_user_func_array:{/srv/www/htdocs/owncloud/lib/private/Hooks/EmitterTrait.php:98}() /srv/www/htdocs/owncloud/lib/private/Hooks/EmitterTrait.php:98
    19 OC\Hooks\BasicEmitter->emit() /srv/www/htdocs/owncloud/lib/private/Hooks/EmitterTrait.php:98
    20 OC\Hooks\PublicEmitter->emit() /srv/www/htdocs/owncloud/lib/private/Hooks/PublicEmitter.php:32
    21 OC\User\Session->loginWithPassword() /srv/www/htdocs/owncloud/lib/private/User/Session.php:436
    22 OC\User\Session->login() /srv/www/htdocs/owncloud/lib/private/User/Session.php:287
    23 OC\User\Session->logClientIn() /srv/www/htdocs/owncloud/lib/private/User/Session.php:313
    24 OCA\DAV\Connector\Sabre\Auth->validateUserPass() /srv/www/htdocs/owncloud/apps/dav/lib/Connector/Sabre/Auth.php:121
    25 Sabre\DAV\Auth\Backend\AbstractBasic->check() /srv/www/htdocs/owncloud/3rdparty/sabre/dav/lib/DAV/Auth/Backend/AbstractBasic.php:105
    26 OCA\DAV\Connector\Sabre\Auth->auth() /srv/www/htdocs/owncloud/apps/dav/lib/Connector/Sabre/Auth.php:242
    27 OCA\DAV\Connector\Sabre\Auth->check() /srv/www/htdocs/owncloud/apps/dav/lib/Connector/Sabre/Auth.php:146
    28 Sabre\DAV\Auth\Plugin->beforeMethod() /srv/www/htdocs/owncloud/3rdparty/sabre/dav/lib/DAV/Auth/Plugin.php:166
    29 call_user_func_array:{/srv/www/htdocs/owncloud/3rdparty/sabre/event/lib/EventEmitterTrait.php:105}() /srv/www/htdocs/owncloud/3rdparty/sabre/event/lib/EventEmitterTrait.php:105
    30 Sabre\Event\EventEmitter->emit() /srv/www/htdocs/owncloud/3rdparty/sabre/event/lib/EventEmitterTrait.php:105
    31 Sabre\DAV\Server->invokeMethod() /srv/www/htdocs/owncloud/3rdparty/sabre/dav/lib/DAV/Server.php:446
    32 Sabre\DAV\Server->exec() /srv/www/htdocs/owncloud/3rdparty/sabre/dav/lib/DAV/Server.php:248
    33 require_once()  /srv/www/htdocs/owncloud/apps/dav/appinfo/v1/webdav.php:56
    34 {main}          /srv/www/htdocs/owncloud/remote.php:164
    

    This is only a single-level recursion. Goal is to use a similar scenario to achieve infinite recursion with group shares.

  27. PVince81 commented on Jan 10, 2017

    @PVince81
    Contributor

    Steps for infinite recursion on v9.1.0:

    1. Create two users "user1" and "user2"
    2. Login as "user1"
    3. Create a folder "delfromuser1"
    4. Share "delfromuser1" with "user2"
    5. Delete "delfromuser1" to trash
    6. Create a folder "testfromuser1"
    7. Share "testfromuser1" with "user2"
    8. Login as "user2"
    9. Create a folder "delfromuser2"
    10. Share "delfromuser2" with "user1"
    11. Refresh the page 💥
    12. curl -D - -X GET -u user2:test http://localhost/owncloud/remote.php/webdav/welcome.txt > file.txt 💥 500 Internal Server Error

    How the recursion occurs:

    1. When setting up the FS for user2, the SharedStorage for "delfromuser1" is being initialized.
    2. This calls $this->ownerView->getPath() with the id of that share which points to a deleted file. The owner is "user1" so this is user1's view
    3. getPath() grabs a list of mounts points in $mounts, first one is user1's Home storage and the second one is user1's received SharedMount "delfromuser2".
    4. Since the file doesn't exist on the Home storage, the loop proceeds to the `SharedMount' "delfromuser2"
    5. Since that one is not initialized yet, calling getStorage()->getCache() will initialize it.
    6. Initializing the "SharedStorage" for "delfromuser2" will itself call $this->ownerView->getPath()with the id of that share. The owner is "user2" so this is user2's view.
    7. getPath() grabs a list of mount points in $mounts, first one is user2's Home storage and the second one is user2's received SharedMount "delfromuser1"
    8. The same logic as above happens in the loop and the SharedMount "delfromuser1" will initialize the storage again from step1, which causes an infinite loop that way
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions