OwnCloud 9.1.8 crashes Authenticating LDAP Users


#1

Steps to reproduce

On one of my two OwnCloud 9.x systems, OwnCloud Crashes with a PHP Exception when a User is Authenticated.

Expected behaviour

LDAP users should be authenticated.

Actual behaviour

{“reqId”:“WxZMVvPN8MMZFK2OLh3zqAAAAAg”,“remoteAddr”:“192.168.0.4”,“app”:“index”,“message”:“Exception: {“Exception”:“InvalidArgumentException”,“Message”:”",“Code”:0,“Trace”:"#0 \/usr\/share\/owncloud\/lib\/private\/Share20\/DefaultShareProvider.php(791): OC\\Share20\\Share->setSharedBy(NULL)\n#1 \/usr\/share\/owncloud\/lib\/private\/Share20\/DefaultShareProvider.php(648): OC\\Share20\\DefaultShareProvider->createShare(Array)\n#2 \/usr\/share\/owncloud\/lib\/private\/Share20\/Manager.php(960): OC\\Share20\\DefaultShareProvider->getSharedWith(‘4054b596-267c-1…’, 0, NULL, -1, 0)\n#3 \/usr\/share\/owncloud\/apps\/files_sharing\/lib\/MountProvider.php(69): OC\\Share20\\Manager->getSharedWith(‘4054b596-267c-1…’, 0, NULL, -1)\n#4 \/usr\/share\/owncloud\/lib\/private\/Files\/Config\/MountProviderCollection.php(76): OCA\\Files_Sharing\\MountProvider->getMountsForUser(Object(OC\\User\\User), Object(OC\\Files\\Storage\\StorageFactory))\n#5 [internal function]: OC\\Files\\Config\\MountProviderCollection->OC\\Files\\Config\\{closure}(Object(OCA\\Files_Sharing\\MountProvider))\n#6 \/usr\/share\/owncloud\/lib\/private\/Files\/Config\/MountProviderCollection.php(77): array_map(Object(Closure), Array)\n#7 \/usr\/share\/owncloud\/lib\/private\/Files\/Filesystem.php(443): OC\\Files\\Config\\MountProviderCollection->getMountsForUser(Object(OC\\User\\User))\n#8 \/usr\/share\/owncloud\/lib\/private\/Files\/Filesystem.php(373): OC\\Files\\Filesystem::initMountPoints(‘4054b596-267c-1…’)\n#9 \/usr\/share\/owncloud\/lib\/private\/legacy\/util.php(231): OC\\Files\\Filesystem::init(‘4054b596-267c-1…’, ‘\/4054b596-267c-…’)\n#10 \/usr\/share\/owncloud\/lib\/base.php(890): OC_Util::setupFS()\n#11 \/usr\/share\/owncloud\/index.php(54): OC::handleRequest()\n#12 {main}",“File”:"\/usr\/share\/owncloud\/lib\/private\/Share20\/Share.php",“Line”:287}",“level”:3,“time”:“2018-06-05T08:39:51+00:00”,“method”:“GET”,“url”:"/owncloud/index.php/apps/files/",“user”:“4054b596-267c-102c-918a-d9d787c9dc10”}
{“reqId”:“WxZMXD7ht@w2nimqTfgyugAAAAE”,“remoteAddr”:“192.168.0.4”,“app”:“index”,“message”:“Exception: {“Exception”:“InvalidArgumentException”,“Message”:”",“Code”:0,“Trace”:"#0 \/usr\/share\/owncloud\/lib\/private\/Share20\/DefaultShareProvider.php(791): OC\\Share20\\Share->setSharedBy(NULL)\n#1 \/usr\/share\/owncloud\/lib\/private\/Share20\/DefaultShareProvider.php(648): OC\\Share20\\DefaultShareProvider->createShare(Array)\n#2 \/usr\/share\/owncloud\/lib\/private\/Share20\/Manager.php(960): OC\\Share20\\DefaultShareProvider->getSharedWith(‘4054b596-267c-1…’, 0, NULL, -1, 0)\n#3 \/usr\/share\/owncloud\/apps\/files_sharing\/lib\/MountProvider.php(69): OC\\Share20\\Manager->getSharedWith(‘4054b596-267c-1…’, 0, NULL, -1)\n#4 \/usr\/share\/owncloud\/lib\/private\/Files\/Config\/MountProviderCollection.php(76): OCA\\Files_Sharing\\MountProvider->getMountsForUser(Object(OC\\User\\User), Object(OC\\Files\\Storage\\StorageFactory))\n#5 [internal function]: OC\\Files\\Config\\MountProviderCollection->OC\\Files\\Config\\{closure}(Object(OCA\\Files_Sharing\\MountProvider))\n#6 \/usr\/share\/owncloud\/lib\/private\/Files\/Config\/MountProviderCollection.php(77): array_map(Object(Closure), Array)\n#7 \/usr\/share\/owncloud\/lib\/private\/Files\/Filesystem.php(443): OC\\Files\\Config\\MountProviderCollection->getMountsForUser(Object(OC\\User\\User))\n#8 \/usr\/share\/owncloud\/lib\/private\/Files\/Filesystem.php(373): OC\\Files\\Filesystem::initMountPoints(‘4054b596-267c-1…’)\n#9 \/usr\/share\/owncloud\/lib\/private\/legacy\/util.php(231): OC\\Files\\Filesystem::init(‘4054b596-267c-1…’, ‘\/4054b596-267c-…’)\n#10 \/usr\/share\/owncloud\/lib\/base.php(890): OC_Util::setupFS()\n#11 \/usr\/share\/owncloud\/index.php(54): OC::handleRequest()\n#12 {main}",“File”:"\/usr\/share\/owncloud\/lib\/private\/Share20\/Share.php",“Line”:287}",“level”:3,“time”:“2018-06-05T08:39:57+00:00”,“method”:“GET”,“url”:"/owncloud/index.php/apps/gallery/config?extramediatypes=1",“user”:“4054b596-267c-102c-918a-d9d787c9dc10”}
{“reqId”:“WxZMXFW3W-zbbMtUTsjfZQAAAAc”,“remoteAddr”:“192.168.0.4”,“app”:“PHP”,“message”:“InvalidArgumentException: at /usr/share/owncloud/lib/private/Share20/Share.php#287”,“level”:3,“time”:“2018-06-05T08:39:57+00:00”,“method”:“GET”,“url”:"/owncloud/ocs/v2.php/apps/notifications/api/v1/notifications?format=json",“user”:“4054b596-267c-102c-918a-d9d787c9dc10”}

Server configuration

Operating system:
Mageia Linux 6

Web server:
Apache

Database:
MariaDB

PHP version:
5.6.36

ownCloud version: (see ownCloud admin page)
9.1.8

Updated from an older ownCloud or fresh install:
Updated from 9.0.11

Where did you install ownCloud from:
OS RPM Package. However, only this one node failed the upgrade.

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 into https://gist.github.com/ and puth the link here.

The content of config/config.php:

Log in to the web-UI with an administrator account and click on
'admin' -> 'Generate Config Report' -> 'Download ownCloud config report'
This report includes the config.php settings, the list of activated apps
and other details in a well sanitized form.

or 

If you have access to your command line run e.g.:
sudo -u www-data php occ config:list system
from within your ownCloud installation folder

*ATTENTION:* Do not post your config.php file in public as is. Please use one of the above
methods whenever possible. Both, the generated reports from the web-ui and from occ config:list
consistently remove sensitive data. You still may want to review the report before sending.
If done manually then it is critical for your own privacy to dilligently
remove *all* host names, passwords, usernames, salts and other credentials before posting.
You should assume that attackers find such information and will use them against your systems.

List of activated apps:

If you have access to your command line run e.g.:
sudo -u www-data php occ app:list
from within your ownCloud installation folder.

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

Are you using encryption: yes/no

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

LDAP configuration (delete this part if not used)

With access to your command line run e.g.:
sudo -u www-data php occ ldap:show-config
from within your ownCloud installation folder

Without access to your command line download the data/owncloud.db to your local
computer or access your SQL server remotely and run the select query:
SELECT * FROM `oc_appconfig` WHERE `appid` = 'user_ldap';


Eventually replace sensitive data as the name/IP-address of your LDAP server or groups.

Client configuration

Browser:

Operating system:

Logs

Web server error log

Insert your webserver log here

ownCloud log (data/owncloud.log)

Insert your ownCloud log here

Browser log

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

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

#2

Does this happen on every user or just this one 4054b596-267c-102c-918a-d9d787c9dc10 ?

It seems ownCloud tries to get this users shares and crashes.
What shares does this user have?
Anything external?
Whats the configuration on that?


#3

Just their personal share, I’ll post config.php
This happens on every LDAP user. Non-LDAP users can log in without issue.
Left some details out for security reasons.

‘datadirectory’ => ‘/opt/var/www/pukey/owncloud/data’,
‘dbtype’ => ‘mysql’,
‘version’ => ‘9.1.8.2’,
‘dbname’ => ‘owncloud-service’,
‘dbhost’ => ‘localhost’,
‘dbtableprefix’ => ‘oc_’,
‘dbuser’ => ‘owncloud-service’,
‘installed’ => true,
‘ldapIgnoreNamingRules’ => false,
‘theme’ => ‘’,
‘maintenance’ => false,
‘forcessl’ => true,

I rolled back to 9.0.11 and LDAP users work again.


#4

Maybe it helps to continue with the upgrade to the latest 10.0.8. From what i know everything below is end of life.


#5

I have tried with OwnCloud 10.0.8 and get the exact same result.


#6

Can you post your ownCloud LDAP configuration?

Also would a new fresh installation be an option for you?


#7

This OwnCloud server is one of two, and this one contains substantial amounts of data. I’ve run some pretty severe risks so far with what I have done. I wanted to make this one a replication peer. I don’t want to do a clean install.


#8

There was an error installing the music App.
Doctrine\DBAL\Exception\UniqueConstraintViolationException: An exception occurred while executing ‘CREATE UNIQUE INDEX user_id_hash_idx ON oc_music_artists (user_id, hash)’: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry ‘4054b596-267c-102c-918a-d9d787c9dc10-’ for key ‘user_id_hash_idx’


#9

{“reqId”:“W3OQb4bS0lN5UC6CtW-TewAAAA4”,“level”:3,“time”:“2018-08-15T02:31:12+00:00”,“remoteAddr”:“192.168.0.4”,“user”:"–",“app”:“files”,“method”:“GET”,“url”:"/owncloud/cron.php",“message”:“Exception: {“Exception”:“InvalidArgumentException”,“Message”:”",“Code”:0,“Trace”:"#0 \/usr\/share\/owncloud\/lib\/private\/Share20\/DefaultShareProvider.php(997): OC\Share20\Share->setSharedBy(NULL)
#1 \/usr\/share\/owncloud\/lib\/private\/Share20\/DefaultShareProvider.php(915): OC\Share20\DefaultShareProvider->createShare(Array)
#2 \/usr\/share\/owncloud\/lib\/private\/Share20\/Manager.php(1090): OC\Share20\DefaultShareProvider->getAllSharedWith(‘4054b596-267c-1…’, NULL)
#3 \/usr\/share\/owncloud\/apps\/files_sharing\/lib\/MountProvider.php(72): OC\Share20\Manager->getAllSharedWith(‘4054b596-267c-1…’, Array, NULL)
#4 \/usr\/share\/owncloud\/lib\/private\/Files\/Config\/MountProviderCollection.php(77): OCA\Files_Sharing\MountProvider->getMountsForUser(Object(OC\User\User), Object(OC\Files\Storage\StorageFactory))
#5 [internal function]: OC\Files\Config\MountProviderCollection->OC\Files\Config\{closure}(Object(OCA\Files_Sharing\MountProvider))
#6 \/usr\/share\/owncloud\/lib\/private\/Files\/Config\/MountProviderCollection.php(78): array_map(Object(Closure), Array)
#7 \/usr\/share\/owncloud\/lib\/private\/Files\/Filesystem.php(445): OC\Files\Config\MountProviderCollection->getMountsForUser(Object(OC\User\User))
#8 \/usr\/share\/owncloud\/lib\/private\/Files\/Filesystem.php(374): OC\Files\Filesystem::initMountPoints(‘4054b596-267c-1…’)
#9 \/usr\/share\/owncloud\/lib\/private\/legacy\/util.php(298): OC\Files\Filesystem::init(‘4054b596-267c-1…’, ‘\/4054b596-267c-…’)
#10 \/usr\/share\/owncloud\/lib\/private\/Files\/Utils\/Scanner.php(101): OC_Util::setupFS(‘4054b596-267c-1…’)
#11 \/usr\/share\/owncloud\/lib\/private\/Files\/Utils\/Scanner.php(137): OC\Files\Utils\Scanner->getMounts(’’)
#12 \/usr\/share\/owncloud\/apps\/files\/lib\/BackgroundJob\/ScanFiles.php(87): OC\Files\Utils\Scanner->backgroundScan(’’)
#13 \/usr\/share\/owncloud\/apps\/files\/lib\/BackgroundJob\/ScanFiles.php(111): OCA\Files\BackgroundJob\ScanFiles->runScanner(Object(OC\User\User))
#14 \/usr\/share\/owncloud\/lib\/private\/BackgroundJob\/Job.php(57): OCA\Files\BackgroundJob\ScanFiles->run(NULL)
#15 \/usr\/share\/owncloud\/lib\/private\/BackgroundJob\/TimedJob.php(53): OC\BackgroundJob\Job->execute(Object(OC\BackgroundJob\JobList), Object(OC\Log))
#16 \/usr\/share\/owncloud\/cron.php(144): OC\BackgroundJob\TimedJob->execute(Object(OC\BackgroundJob\JobList), Object(OC\Log))
#17 {main}",“File”:"\/usr\/share\/owncloud\/lib\/private\/Share20\/Share.php",“Line”:289}"}
{“reqId”:“W3OQfAI1k0yb4V5zFRmRpgAAAAs”,“level”:3,“time”:“2018-08-15T02:31:25+00:00”,“remoteAddr”:“192.168.0.4”,“user”:“4054b596-267c-102c-918a-d9d787c9dc10”,“app”:“no app in context”,“method”:“POST”,“url”:"/owncloud/index.php/login",“message”:“Exception: {“Exception”:“InvalidArgumentException”,“Message”:”",“Code”:0,“Trace”:"#0 \/usr\/share\/owncloud\/lib\/private\/Share20\/DefaultShareProvider.php(997): OC\Share20\Share->setSharedBy(NULL)
#1 \/usr\/share\/owncloud\/lib\/private\/Share20\/DefaultShareProvider.php(915): OC\Share20\DefaultShareProvider->createShare(Array)
#2 \/usr\/share\/owncloud\/lib\/private\/Share20\/Manager.php(1090): OC\Share20\DefaultShareProvider->getAllSharedWith(‘4054b596-267c-1…’, NULL)
#3 \/usr\/share\/owncloud\/apps\/files_sharing\/lib\/MountProvider.php(72): OC\Share20\Manager->getAllSharedWith(‘4054b596-267c-1…’, Array, NULL)
#4 \/usr\/share\/owncloud\/lib\/private\/Files\/Config\/MountProviderCollection.php(77): OCA\Files_Sharing\MountProvider->getMountsForUser(Object(OC\User\User), Object(OC\Files\Storage\StorageFactory))
#5 [internal function]: OC\Files\Config\MountProviderCollection->OC\Files\Config\{closure}(Object(OCA\Files_Sharing\MountProvider))
#6 \/usr\/share\/owncloud\/lib\/private\/Files\/Config\/MountProviderCollection.php(78): array_map(Object(Closure), Array)
#7 \/usr\/share\/owncloud\/lib\/private\/Files\/Filesystem.php(445): OC\Files\Config\MountProviderCollection->getMountsForUser(Object(OC\User\User))
#8 \/usr\/share\/owncloud\/lib\/private\/Files\/Filesystem.php(374): OC\Files\Filesystem::initMountPoints(‘4054b596-267c-1…’)
#9 \/usr\/share\/owncloud\/lib\/private\/legacy\/util.php(298): OC\Files\Filesystem::init(‘4054b596-267c-1…’, ‘\/4054b596-267c-…’)
#10 \/usr\/share\/owncloud\/apps\/encryption\/lib\/Hooks\/UserHooks.php(328): OC_Util::setupFS(‘4054b596-267c-1…’)
#11 \/usr\/share\/owncloud\/apps\/encryption\/lib\/Hooks\/UserHooks.php(163): OCA\Encryption\Hooks\UserHooks->setupFS(‘4054b596-267c-1…’)
#12 [internal function]: OCA\Encryption\Hooks\UserHooks->login(*** sensitive parameters replaced )
#13 \/usr\/share\/owncloud\/lib\/private\/legacy\/hook.php(105): call_user_func(Array, Array)
#14 \/usr\/share\/owncloud\/lib\/private\/Server.php(356): OC_Hook::emit(‘OC_User’, ‘post_login’, Array)
#15 [internal function]: OC\Server->OC\{closure}(Object(OC\User\User), ‘Julius0’)
#16 \/usr\/share\/owncloud\/lib\/private\/Hooks\/EmitterTrait.php(99): call_user_func_array(Object(Closure), Array)
#17 \/usr\/share\/owncloud\/lib\/private\/Hooks\/PublicEmitter.php(33): OC\Hooks\BasicEmitter->emit(’\\OC\\User’, ‘postLogin’, Array)
#18 \/usr\/share\/owncloud\/lib\/private\/User\/Session.php(502): OC\Hooks\PublicEmitter->emit(’\\OC\\User’, ‘postLogin’, Array)
#19 \/usr\/share\/owncloud\/lib\/public\/Events\/EventEmitterTrait.php(50): OC\User\Session->OC\User\{closure}(Array)
#20 \/usr\/share\/owncloud\/lib\/private\/User\/Session.php(516): OC\User\Session->emittingCall(Object(Closure), Array, ‘user’, ‘login’)
#21 \/usr\/share\/owncloud\/lib\/private\/User\/Session.php(316): OC\User\Session->loginWithPassword(
sensitive parameters replaced )
#22 \/usr\/share\/owncloud\/core\/Controller\/LoginController.php(201): OC\User\Session->login(
sensitive parameters replaced )
#23 [internal function]: OC\Core\Controller\LoginController->tryLogin(
sensitive parameters replaced ***)
#24 \/usr\/share\/owncloud\/lib\/private\/AppFramework\/Http\/Dispatcher.php(159): call_user_func_array(Array, Array)
#25 \/usr\/share\/owncloud\/lib\/private\/AppFramework\/Http\/Dispatcher.php(89): OC\AppFramework\Http\Dispatcher->executeController(Object(OC\Core\Controller\LoginController), ‘tryLogin’)
#26 \/usr\/share\/owncloud\/lib\/private\/AppFramework\/App.php(103): OC\AppFramework\Http\Dispatcher->dispatch(Object(OC\Core\Controller\LoginController), ‘tryLogin’)
#27 \/usr\/share\/owncloud\/lib\/private\/AppFramework\/Routing\/RouteActionHandler.php(46): OC\AppFramework\App::main(‘LoginController’, ‘tryLogin’, Object(OC\AppFramework\DependencyInjection\DIContainer), Array)
#28 [internal function]: OC\AppFramework\Routing\RouteActionHandler->__invoke(Array)
#29 \/usr\/share\/owncloud\/lib\/private\/Route\/Router.php(342): call_user_func(Object(OC\AppFramework\Routing\RouteActionHandler), Array)
#30 \/usr\/share\/owncloud\/lib\/base.php(912): OC\Route\Router->match(’\/login’)
#31 \/usr\/share\/owncloud\/index.php(55): OC::handleRequest()
#32 {main}",“File”:"\/usr\/share\/owncloud\/lib\/private\/Share20\/Share.php",“Line”:289}"}


#10

The problem has been found. Its the files_sharing plugin. I’m working on a resolution, but for now, I’ve disabled it, and am now running OwnCloud 10.0.9