nextcloud / nextcloud/server

Unresponsive SFTP external storage blocks access to unrelated files

Open
#49,457 22 comments 7 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

0. Needs triage 30-feedback bug feature: external storage
Dominant language
PHP
Stars
36.9k
Forks
5.2k
Avg merge
2d 3h
Merged PRs (30d)
713

Description

⚠️ This issue respects the following points: ⚠️
Bug description

Hi,
I just discovered, that an unresponsive external Storage provider (SFTP) can make nextcloud unusable and you wont get helpful error messages.

Relevant Versions running:

  • Nextcloud Hub 9 (30.0.2)
  • External storage support -Version 1.22.0
Steps to reproduce

1.I am using Nextcloud Docker installation from dockerhub -> tag latest -> https://hub.docker.com/layers/library/nextcloud/latest/images/sha256-63fb5f32eace75c4770a324c13f9c199f45d5d2cfe10871ba48c820c614c9713?context=explore
2.activate the External storage support (I followed the Bug link from the app and came here)
3. include an external storage (I discovered the problem with an SFTP Provider)
4. everything works fine
5. external storage provider become unresponsive
6. calling the URL apps/files/files -> you get an error like "directory unavailable" - I am not able to find the exact message
7. nextcloud.log is not very helpful to non developers: see attached log

Expected behavior

I would expect in nextcloud hosted files (apart from the external storage in question) still being available.
I would also expect other error handling -> grey out/make red etc. the directory of the external storage

Nextcloud Server version

30

Operating system

Debian/Ubuntu

PHP engine version

PHP 8.2

Web server

Apache (supported)

Database engine version

MariaDB

Is this bug present after an update or on a fresh install?

None

Are you using the Nextcloud Server Encryption module?

Encryption is Disabled

What user-backends are you using?
  • Default user-backend (database)
  • LDAP/ Active Directory
  • SSO - SAML
  • Other
Configuration report
{
    "system": {
        "maintenance": false,
        "maintenance_window_start": 1,
        "htaccess.RewriteBase": "\/",
        "memcache.local": "\\OC\\Memcache\\APCu",
        "apps_paths": [
            {
                "path": "\/var\/www\/html\/apps",
                "url": "\/apps",
                "writable": false
            },
            {
                "path": "\/var\/www\/html\/custom_apps",
                "url": "\/custom_apps",
                "writable": true
            }
        ],
        "instanceid": "***REMOVED SENSITIVE VALUE***",
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "trusted_domains": [
            "REDACTED"
        ],
        "datadirectory": "***REMOVED SENSITIVE VALUE***",
        "dbtype": "mysql",
        "version": "30.0.2.2",
        "overwrite.cli.url": "REDACTED",
        "dbname": "***REMOVED SENSITIVE VALUE***",
        "dbhost": "***REMOVED SENSITIVE VALUE***",
        "dbport": "",
        "dbtableprefix": "oc_",
        "mysql.utf8mb4": true,
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "installed": true,
        "overwriteprotocol": "https",
        "trusted_proxies": "***REMOVED SENSITIVE VALUE***",
        "default_phone_region": "DE",
        "mail_smtpmode": "smtp",
        "mail_smtpsecure": "tls",
        "mail_sendmailmode": "smtp",
        "mail_smtpauth": 1,
        "mail_smtpauthtype": "PLAIN",
        "mail_smtphost": "***REMOVED SENSITIVE VALUE***",
        "mail_domain": "***REMOVED SENSITIVE VALUE***",
        "mail_from_address": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpport": "587",
        "mail_smtpname": "***REMOVED SENSITIVE VALUE***",
        "mail_smtppassword": "***REMOVED SENSITIVE VALUE***",
        "loglevel": 2,
        "theme": "",
        "trashbin_retention_obligation": "31,60",
        "memcache.distributed": "\\OC\\Memcache\\Redis",
        "memcache.locking": "\\OC\\Memcache\\Redis",
        "redis": {
            "host": "***REMOVED SENSITIVE VALUE***",
            "password": "***REMOVED SENSITIVE VALUE***",
            "port": 6379
        }
    }
}
List of activated Apps
Enabled:
  - activity: 3.0.0
  - app_api: 4.0.0
  - bruteforcesettings: 3.0.0
  - calendar: 5.0.5
  - circles: 30.0.0
  - cloud_federation_api: 1.13.0
  - comments: 1.20.1
  - contacts: 6.1.1
  - dashboard: 7.10.0
  - dav: 1.31.1
  - end_to_end_encryption: 1.16.1
  - federatedfilesharing: 1.20.0
  - federation: 1.20.0
  - files: 2.2.0
  - files_downloadlimit: 3.0.0
  - files_external: 1.22.0
  - files_pdfviewer: 3.0.0
  - files_reminders: 1.3.0
  - files_sharing: 1.22.0
  - files_trashbin: 1.20.1
  - files_versions: 1.23.0
  - logreader: 3.0.0
  - lookup_server_connector: 1.18.0
  - nextcloud_announcements: 2.0.0
  - notifications: 3.0.0
  - oauth2: 1.18.1
  - password_policy: 2.0.0
  - photos: 3.0.2
  - previewgenerator: 5.7.0
  - privacy: 2.0.0
  - provisioning_api: 1.20.0
  - recommendations: 3.0.0
  - related_resources: 1.5.0
  - serverinfo: 2.0.0
  - settings: 1.13.0
  - sharebymail: 1.20.0
  - systemtags: 1.20.0
  - tasks: 0.16.1
  - text: 4.1.0
  - theming: 2.5.0
  - twofactor_backupcodes: 1.19.0
  - updatenotification: 1.20.0
  - user_status: 1.10.0
  - viewer: 3.0.0
  - weather_status: 1.10.0
  - webhook_listeners: 1.1.0-dev
  - workflowengine: 2.12.0
Disabled:
  - admin_audit: 1.20.0
  - contactsinteraction: 1.11.0 (installed 1.6.0)
  - encryption: 2.18.0
  - firstrunwizard: 3.0.0 (installed 2.14.0)
  - support: 2.0.0 (installed 1.10.0)
  - survey_client: 2.0.0 (installed 1.15.0)
  - suspicious_login: 8.0.0
  - twofactor_nextcloud_notification: 4.0.0
  - twofactor_totp: 12.0.0-dev
  - user_ldap: 1.21.0
Nextcloud Signing status
No errors have been found.
Nextcloud Logs
{"reqId":"REDACTED","level":3,"time":"2024-11-24T13:24:47+00:00","remoteAddr":"REDACTED","user":"REDACTED","app":"index","method":"POST","url":"/apps/files_external/globalstorages","message":"base and exponent overflow in file '/var/www/html/3rdparty/phpseclib/phpseclib/phpseclib/Math/BigInteger.php' line 3040","userAgent":"Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:132.0) Gecko/20100101 Firefox/132.0","version":"30.0.2.2","exception":{"Exception":"Exception","Message":"base and exponent overflow in file '/var/www/html/3rdparty/phpseclib/phpseclib/phpseclib/Math/BigInteger.php' line 3040","Code":0,"Trace":[{"file":"/var/www/html/lib/private/AppFramework/App.php","line":161,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[{"__class__":"OCA\\Files_External\\Controller\\GlobalStoragesController"},"create"]},{"file":"/var/www/html/lib/private/Route/Router.php","line":302,"function":"main","class":"OC\\AppFramework\\App","type":"::","args":["OCA\\Files_External\\Controller\\GlobalStoragesController","create",{"__class__":"OC\\AppFramework\\DependencyInjection\\DIContainer"},{"_route":"files_external.global_storages.create"}]},{"file":"/var/www/html/lib/base.php","line":1001,"function":"match","class":"OC\\Route\\Router","type":"->","args":["/apps/files_external/globalstorages"]},{"file":"/var/www/html/index.php","line":24,"function":"handleRequest","class":"OC","type":"::","args":[]}],"File":"/var/www/html/lib/private/AppFramework/Http/Dispatcher.php","Line":146,"Previous":{"Exception":"ValueError","Message":"base and exponent overflow","Code":0,"Trace":[{"file":"/var/www/html/3rdparty/phpseclib/phpseclib/phpseclib/Math/BigInteger.php","line":3040,"function":"gmp_pow","args":[{"__class__":"GMP"},256]},{"file":"/var/www/html/3rdparty/phpseclib/phpseclib/phpseclib/Net/SSH2.php","line":1846,"function":"bitwise_leftShift","class":"phpseclib\\Math\\BigInteger","type":"->","args":[256]},{"file":"/var/www/html/3rdparty/phpseclib/phpseclib/phpseclib/Net/SSH2.php","line":1435,"function":"_key_exchange","class":"phpseclib\\Net\\SSH2","type":"->","args":[]},{"file":"/var/www/html/3rdparty/phpseclib/phpseclib/phpseclib/Net/SSH2.php","line":5217,"function":"_connect","class":"phpseclib\\Net\\SSH2","type":"->","args":[]},{"file":"/var/www/html/apps/files_external/lib/Lib/Storage/SFTP.php","line":110,"function":"getServerPublicHostKey","class":"phpseclib\\Net\\SSH2","type":"->","args":[]},{"file":"/var/www/html/apps/files_external/lib/Lib/Storage/SFTP.php","line":145,"function":"getConnection","class":"OCA\\Files_External\\Lib\\Storage\\SFTP","type":"->","args":[]},{"file":"/var/www/html/apps/files_external/lib/MountConfig.php","line":98,"function":"test","class":"OCA\\Files_External\\Lib\\Storage\\SFTP","type":"->","args":["*** sensitive parameters replaced ***","*** sensitive parameters replaced ***"]},{"file":"/var/www/html/apps/files_external/lib/Controller/StoragesController.php","line":224,"function":"getBackendStatus","class":"OCA\\Files_External\\MountConfig","type":"::","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/html/apps/files_external/lib/Controller/GlobalStoragesController.php","line":115,"function":"updateStorageStatus","class":"OCA\\Files_External\\Controller\\StoragesController","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/html/lib/private/AppFramework/Http/Dispatcher.php","line":208,"function":"create","class":"OCA\\Files_External\\Controller\\GlobalStoragesController","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/html/lib/private/AppFramework/Http/Dispatcher.php","line":114,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[{"__class__":"OCA\\Files_External\\Controller\\GlobalStoragesController"},"create"]},{"file":"/var/www/html/lib/private/AppFramework/App.php","line":161,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[{"__class__":"OCA\\Files_External\\Controller\\GlobalStoragesController"},"create"]},{"file":"/var/www/html/lib/private/Route/Router.php","line":302,"function":"main","class":"OC\\AppFramework\\App","type":"::","args":["OCA\\Files_External\\Controller\\GlobalStoragesController","create",{"__class__":"OC\\AppFramework\\DependencyInjection\\DIContainer"},{"_route":"files_external.global_storages.create"}]},{"file":"/var/www/html/lib/base.php","line":1001,"function":"match","class":"OC\\Route\\Router","type":"->","args":["/apps/files_external/globalstorages"]},{"file":"/var/www/html/index.php","line":24,"function":"handleRequest","class":"OC","type":"::","args":[]}],"File":"/var/www/html/3rdparty/phpseclib/phpseclib/phpseclib/Math/BigInteger.php","Line":3040},"message":"base and exponent overflow in file '/var/www/html/3rdparty/phpseclib/phpseclib/phpseclib/Math/BigInteger.php' line 3040","exception":{},"CustomMessage":"base and exponent overflow in file '/var/www/html/3rdparty/phpseclib/phpseclib/phpseclib/Math/BigInteger.php' line 3040"}}
Additional info

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the stack trace through apps/files_external/lib/Lib/Storage/SFTP.php, MountConfig.php, and the storage controllers, then inspect the phpseclib SSH connection path. Reproduce an unresponsive SFTP provider while accessing unrelated files. Done means unrelated hosted files remain available and the unavailable external directory receives a clear error state or message.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.