nextcloud / server

☁️ Nextcloud server, a safe home for all your data
https://nextcloud.com
GNU Affero General Public License v3.0
26.51k stars 3.98k forks source link

[Bug]: A user accesses the administrator account without doing anything special. #40863

Closed totoadd closed 1 month ago

totoadd commented 10 months ago

⚠️ This issue respects the following points: ⚠️

Bug description

Hello, sorry for my bad english I have a Nextcloud server installed on my NAS based on TrueNAS Scale. Nextcloud is behind Nginx Proxy Manager, which is also hosted on my NAS. I have three other users on my Nextcloud server. My account has a strong 40 characters password and Two Authentification through TOTP enabled. Today, one user loaded the Nextcloud page (this browser is Brave), but instead of being connected to him account, he was connected to the admin account, so my account. He has access to the full account privileges and files without giving any username, password and TOTP. I specified that the user was yesterday connected to his account and this bug appears today then he wants to access Nextcloud. I didn't know why he had been automatically connected to my admin account by simply loading the page.

Steps to reproduce

  1. Have an other user on the Nextcloud instance.
  2. This other user load the Nextcloud page with his browser.
  3. The user is connected to the admin account of the Nextcloud instance.

Expected behavior

The user is not connected to the admin account but only to his own account. And it is not possible to access an account without an username, password and a TOTP code.

Installation method

Community Docker image

Nextcloud Server version

27

Operating system

Other

PHP engine version

PHP 8.2

Web server

Nginx

Database engine version

PostgreSQL

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?

Configuration report

{
    "system": {
        "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
            }
        ],
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "datadirectory": "***REMOVED SENSITIVE VALUE***",
        "dbtype": "pgsql",
        "version": "27.1.1.0",
        "dbname": "***REMOVED SENSITIVE VALUE***",
        "dbhost": "***REMOVED SENSITIVE VALUE***",
        "dbport": "",
        "dbtableprefix": "oc_",
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "installed": true,
        "instanceid": "***REMOVED SENSITIVE VALUE***",
        "redis": {
            "host": "***REMOVED SENSITIVE VALUE***",
            "password": "***REMOVED SENSITIVE VALUE***",
            "port": "6379"
        },
        "memcache.distributed": "\\OC\\Memcache\\Redis",
        "memcache.locking": "\\OC\\Memcache\\Redis",
        "upgrade.disable-web": true,
        "default_phone_region": "FR",
        "share_folder": "\/",
        "log_type": "file",
        "log_type_audit": "file",
        "loglevel": "2",
        "logfile": "\/var\/www\/html\/data\/logs\/nextcloud.log",
        "logfile_audit": "\/var\/www\/html\/data\/logs\/audit.log",
        "logdateformat": "d\/m\/Y H:i:s",
        "logtimezone": "Europe\/Paris",
        "activity_expire_days": "90",
        "trashbin_retention_obligation": "auto",
        "versions_retention_obligation": "auto",
        "preview_imaginary_url": "http:\/\/mycloud-nextcloud-imaginary:9090",
        "enable_previews": "true",
        "jpeg_quality": "60",
        "preview_max_x": "2048",
        "preview_max_y": "2048",
        "preview_max_memory": "1024",
        "preview_max_filesize_image": "50",
        "onlyoffice": "",
        "app_install_overwrite": [
            "twofactor_admin",
            "occweb",
            "sharepermissions"
        ],
        "overwrite.cli.url": "https:\/\/mycloud.example.com",
        "overwritehost": "mycloud.example.com",
        "overwriteprotocol": "https",
        "maintenance": false,
        "default_language": "fr",
        "mail_smtpmode": "smtp",
        "mail_smtpsecure": "ssl",
        "mail_sendmailmode": "smtp",
        "mail_from_address": "***REMOVED SENSITIVE VALUE***",
        "mail_domain": "***REMOVED SENSITIVE VALUE***",
        "mail_smtphost": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpport": "465",
        "mail_smtpauth": 1,
        "mail_smtpname": "***REMOVED SENSITIVE VALUE***",
        "mail_smtppassword": "***REMOVED SENSITIVE VALUE***",
        "trusted_domains": [
            "127.0.0.1",
            "localhost",
            "mycloud-nextcloud",
            "mycloud-nextcloud-*",
            "kube.internal.healthcheck",
            "http",
            "192.168.1.60"
        ],
        "trusted_proxies": "***REMOVED SENSITIVE VALUE***",
        "enabledPreviewProviders": [
            "OC\\Preview\\Imaginary",
            "OC\\Preview\\BMP",
            "OC\\Preview\\GIF",
            "OC\\Preview\\JPEG",
            "OC\\Preview\\Krita",
            "OC\\Preview\\MarkDown",
            "OC\\Preview\\MP3",
            "OC\\Preview\\OpenDocument",
            "OC\\Preview\\PNG",
            "OC\\Preview\\TXT",
            "OC\\Preview\\XBitmap",
            "OC\\Preview\\Movie",
            "OC\\Preview\\PDF",
            "OC\\Preview\\SVG",
            "OC\\Preview\\TIFF"
        ]
    }
}

List of activated Apps

Enabled:
  - activity: 2.19.0
  - announcementcenter: 6.6.2
  - bruteforcesettings: 2.7.0
  - calendar: 4.5.2
  - checksum: 1.2.2
  - cloud_federation_api: 1.10.0
  - comments: 1.17.0
  - contacts: 5.4.2
  - contactsinteraction: 1.8.0
  - dashboard: 7.7.0
  - dav: 1.27.0
  - external: 5.2.1
  - externalportal: 1.2.0
  - federatedfilesharing: 1.17.0
  - federation: 1.17.0
  - files: 1.22.0
  - files_accesscontrol: 1.17.1
  - files_antivirus: 5.2.2
  - files_external: 1.19.0
  - files_mindmap: 0.0.29
  - files_pdfviewer: 2.8.0
  - files_reminders: 1.0.0
  - files_rightclick: 1.6.0
  - files_sharing: 1.19.0
  - files_texteditor: 2.15.1
  - files_trashbin: 1.17.0
  - files_versions: 1.20.0
  - fileslibreofficeedit: 1.1.0
  - forms: 3.3.1
  - integration_reddit: 2.0.1
  - integration_twitter: 1.0.6
  - logreader: 2.12.0
  - lookup_server_connector: 1.15.0
  - mail: 3.4.0
  - metadata: 0.19.0
  - nextcloud_announcements: 1.16.0
  - notes: 4.8.1
  - notifications: 2.15.0
  - notify_push: 0.6.3
  - oauth2: 1.15.1
  - password_policy: 1.17.0
  - photos: 2.3.0
  - previewgenerator: 5.3.0
  - privacy: 1.11.0
  - provisioning_api: 1.17.0
  - recommendations: 1.6.0
  - related_resources: 1.2.0
  - serverinfo: 1.17.0
  - settings: 1.9.0
  - sharebymail: 1.17.0
  - spreed: 17.1.1
  - support: 1.10.0
  - survey_client: 1.15.0
  - suspicious_login: 5.0.0
  - systemtags: 1.17.0
  - tasks: 0.15.0
  - text: 3.8.0
  - theming: 2.2.0
  - twofactor_backupcodes: 1.16.0
  - twofactor_totp: 9.0.0
  - updatenotification: 1.17.0
  - user_status: 1.7.0
  - viewer: 2.1.0
  - weather_status: 1.7.0
  - welcome: 1.0.10
  - workflowengine: 2.9.0

Nextcloud Signing status

No errors have been found.

Nextcloud Logs

{"reqId":"V6QnXs0h3xtgUBzRyQXD","level":2,"time":"10/10/2023 20:25:18","remoteAddr":"","user":"--","app":"mail","method":"","url":"--","message":"Could not fetch structure detail data to enhance message previews: Authentication failed.","userAgent":"--","version":"27.1.1.0","exception":{"Exception":"Horde_Imap_Client_Exception","Message":"Authentication failed.","Code":102,"Trace":[{"file":"/var/www/html/custom_apps/mail/vendor/bytestream/horde-imap-client/lib/Horde/Imap/Client/Socket.php","line":4566,"function":"_responseCode","class":"Horde_Imap_Client_Socket","type":"->","args":[["Horde_Imap_Client_Interaction_Pipeline",[[],[],["Horde_Imap_Client_Exception",null,false,"Authentication failed."]],["Horde_Imap_Client_Fetch_Results"]],["Horde_Imap_Client_Interaction_Server_Tagged",["stdClass",[],"AUTHENTICATIONFAILED"],3,["Horde_Imap_Client_Tokenize"],"3"]]},{"file":"/var/www/html/custom_apps/mail/vendor/bytestream/horde-imap-client/lib/Horde/Imap/Client/Socket.php","line":4314,"function":"_getLine","class":"Horde_Imap_Client_Socket","type":"->","args":[["Horde_Imap_Client_Interaction_Pipeline",[[],[],["Horde_Imap_Client_Exception",null,false,"Authentication failed."]],["Horde_Imap_Client_Fetch_Results"]]]},{"file":"/var/www/html/custom_apps/mail/vendor/bytestream/horde-imap-client/lib/Horde/Imap/Client/Socket.php","line":4242,"function":"_sendCmdChunk","class":"Horde_Imap_Client_Socket","type":"->","args":[["Horde_Imap_Client_Interaction_Pipeline",[[],[],["Horde_Imap_Client_Exception",null,false,"Authentication failed."]],["Horde_Imap_Client_Fetch_Results"]],[["Horde_Imap_Client_Interaction_Command",[],true,false,null,null,["Horde_Imap_Client_Interaction_Pipeline",[[],[],["Horde_Imap_Client_Exception",null,false,"Authentication failed."]],["Horde_Imap_Client_Fetch_Results"]],["Horde_Imap_Client_Interaction_Server_Tagged",["stdClass",[],"AUTHENTICATIONFAILED"],3,["Horde_Imap_Client_Tokenize"],"3"],"3"]]]},{"file":"/var/www/html/custom_apps/mail/vendor/bytestream/horde-imap-client/lib/Horde/Imap/Client/Socket.php","line":850,"function":"_sendCmd","class":"Horde_Imap_Client_Socket","type":"->","args":[["Horde_Imap_Client_Interaction_Pipeline",[[],[],["Horde_Imap_Client_Exception",null,false,"Authentication failed."]],["Horde_Imap_Client_Fetch_Results"]]]},{"file":"/var/www/html/custom_apps/mail/vendor/bytestream/horde-imap-client/lib/Horde/Imap/Client/Socket.php","line":512,"function":"_tryLogin","class":"Horde_Imap_Client_Socket","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/html/custom_apps/mail/vendor/bytestream/horde-imap-client/lib/Horde/Imap/Client/Base.php","line":853,"function":"_login","class":"Horde_Imap_Client_Socket","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/html/custom_apps/mail/vendor/bytestream/horde-imap-client/lib/Horde/Imap/Client/Base.php","line":2510,"function":"login","class":"Horde_Imap_Client_Base","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/html/custom_apps/mail/vendor/bytestream/horde-imap-client/lib/Horde/Imap/Client/Base.php","line":2493,"function":"_fetchWrapper","class":"Horde_Imap_Client_Base","type":"->","args":["INBOX",["Horde_Imap_Client_Fetch_Query"],[["Horde_Imap_Client_Ids",false]]]},{"file":"/var/www/html/custom_apps/mail/lib/IMAP/MessageMapper.php","line":873,"function":"fetch","class":"Horde_Imap_Client_Base","type":"->","args":["INBOX",["Horde_Imap_Client_Fetch_Query"],[["Horde_Imap_Client_Ids",false]]]},{"file":"/var/www/html/custom_apps/mail/lib/IMAP/PreviewEnhancer.php","line":86,"function":"getBodyStructureData","class":"OCA\\Mail\\IMAP\\MessageMapper","type":"->","args":[["Horde_Imap_Client_Socket",["HICenv","HICflags","HIChdrs","HICdate","HICsize","And 1 more entries, set log level to debug to see all entries"],true,true],"INBOX",[1,2,3,4,5,"And 11752 more entries, set log level to debug to see all entries"]]},{"file":"/var/www/html/custom_apps/mail/lib/Service/PreprocessingService.php","line":81,"function":"process","class":"OCA\\Mail\\IMAP\\PreviewEnhancer","type":"->","args":[["OCA\\Mail\\Account"],["OCA\\Mail\\Db\\Mailbox",1],[["OCA\\Mail\\Db\\Message",97],["OCA\\Mail\\Db\\Message",98],["OCA\\Mail\\Db\\Message",99],["OCA\\Mail\\Db\\Message",100],["OCA\\Mail\\Db\\Message",101],"And 11752 more entries, set log level to debug to see all entries"]]},{"file":"/var/www/html/custom_apps/mail/lib/BackgroundJob/PreviewEnhancementProcessingJob.php","line":94,"function":"process","class":"OCA\\Mail\\Service\\PreprocessingService","type":"->","args":[1695752713,["OCA\\Mail\\Account"]]},{"file":"/var/www/html/lib/public/BackgroundJob/Job.php","line":81,"function":"run","class":"OCA\\Mail\\BackgroundJob\\PreviewEnhancementProcessingJob","type":"->","args":[[3]]},{"file":"/var/www/html/lib/public/BackgroundJob/TimedJob.php","line":103,"function":"start","class":"OCP\\BackgroundJob\\Job","type":"->","args":[["OC\\BackgroundJob\\JobList"]]},{"file":"/var/www/html/lib/public/BackgroundJob/TimedJob.php","line":93,"function":"start","class":"OCP\\BackgroundJob\\TimedJob","type":"->","args":[["OC\\BackgroundJob\\JobList"]]},{"file":"/var/www/html/cron.php","line":152,"function":"execute","class":"OCP\\BackgroundJob\\TimedJob","type":"->","args":[["OC\\BackgroundJob\\JobList"],["OC\\Log"]]}],"File":"/var/www/html/custom_apps/mail/vendor/bytestream/horde-imap-client/lib/Horde/Imap/Client/Socket.php","Line":5030,"message":"Could not fetch structure detail data to enhance message previews: Authentication failed.","exception":{"details":null,"logged":false,"raw_msg":"Authentication failed."},"CustomMessage":"Could not fetch structure detail data to enhance message previews: Authentication failed."}}
{"reqId":"V6QnXs0h3xtgUBzRyQXD","level":2,"time":"10/10/2023 20:25:19","remoteAddr":"","user":"--","app":"mail","method":"","url":"--","message":"Could not refresh oauth token: Client error: `POST https://oauth2.googleapis.com/token` resulted in a `400 Bad Request` response:\n{\n  \"error\": \"invalid_grant\",\n  \"error_description\": \"Bad Request\"\n}\n","userAgent":"--","version":"27.1.1.0","exception":{"Exception":"GuzzleHttp\\Exception\\ClientException","Message":"Client error: `POST https://oauth2.googleapis.com/token` resulted in a `400 Bad Request` response:\n{\n  \"error\": \"invalid_grant\",\n  \"error_description\": \"Bad Request\"\n}\n","Code":400,"Trace":[{"file":"/var/www/html/3rdparty/guzzlehttp/guzzle/src/Middleware.php","line":69,"function":"create","class":"GuzzleHttp\\Exception\\RequestException","type":"::","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/html/3rdparty/guzzlehttp/promises/src/Promise.php","line":204,"function":"GuzzleHttp\\{closure}","class":"GuzzleHttp\\Middleware","type":"::","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/html/3rdparty/guzzlehttp/promises/src/Promise.php","line":153,"function":"callHandler","class":"GuzzleHttp\\Promise\\Promise","type":"::","args":[1,"*** sensitive parameters replaced ***","*** sensitive parameters replaced ***"]},{"file":"/var/www/html/3rdparty/guzzlehttp/promises/src/TaskQueue.php","line":48,"function":"GuzzleHttp\\Promise\\{closure}","class":"GuzzleHttp\\Promise\\Promise","type":"::","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/html/3rdparty/guzzlehttp/promises/src/Promise.php","line":248,"function":"run","class":"GuzzleHttp\\Promise\\TaskQueue","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/html/3rdparty/guzzlehttp/promises/src/Promise.php","line":224,"function":"invokeWaitFn","class":"GuzzleHttp\\Promise\\Promise","type":"->","args":[]},{"file":"/var/www/html/3rdparty/guzzlehttp/promises/src/Promise.php","line":269,"function":"waitIfPending","class":"GuzzleHttp\\Promise\\Promise","type":"->","args":[]},{"file":"/var/www/html/3rdparty/guzzlehttp/promises/src/Promise.php","line":226,"function":"invokeWaitList","class":"GuzzleHttp\\Promise\\Promise","type":"->","args":[]},{"file":"/var/www/html/3rdparty/guzzlehttp/promises/src/Promise.php","line":62,"function":"waitIfPending","class":"GuzzleHttp\\Promise\\Promise","type":"->","args":[]},{"file":"/var/www/html/3rdparty/guzzlehttp/guzzle/src/Client.php","line":187,"function":"wait","class":"GuzzleHttp\\Promise\\Promise","type":"->","args":[]},{"file":"/var/www/html/lib/private/Http/Client/Client.php","line":301,"function":"request","class":"GuzzleHttp\\Client","type":"->","args":["post","https://oauth2.googleapis.com/token",["/var/www/html/data/files_external/rootcerts.crt",30,[["Closure"]],"application/json","{\"client_id\":\"398376885386-goms3b2k90lr81q0nv8vilrvvcevq1lg.apps.googleusercontent.com\",\"client_secret\":\"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\",\"grant_type\":\"refresh_token\",\"refresh_token\":\"1\\/\\/03AdLApMwkixvCgYIARAAGAMSNwF-L9Ir6oQfgMf_5EBOFRJ4_So4yHEgp30855j2qIopbHXvGp5wFuoFtFI5_iEiY8yuasEVED8\"}","And 3 more entries, set log level to debug to see all entries"]]},{"file":"/var/www/html/custom_apps/mail/lib/Integration/GoogleIntegration.php","line":160,"function":"post","class":"OC\\Http\\Client\\Client","type":"->","args":["https://oauth2.googleapis.com/token",["application/json","{\"client_id\":\"398376885386-goms3b2k90lr81q0nv8vilrvvcevq1lg.apps.googleusercontent.com\",\"client_secret\":\"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\",\"grant_type\":\"refresh_token\",\"refresh_token\":\"1\\/\\/03AdLApMwkixvCgYIARAAGAMSNwF-L9Ir6oQfgMf_5EBOFRJ4_So4yHEgp30855j2qIopbHXvGp5wFuoFtFI5_iEiY8yuasEVED8\"}"]]},{"file":"/var/www/html/custom_apps/mail/lib/Listener/OauthTokenRefreshListener.php","line":55,"function":"refresh","class":"OCA\\Mail\\Integration\\GoogleIntegration","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/html/lib/private/EventDispatcher/ServiceEventListener.php","line":86,"function":"handle","class":"OCA\\Mail\\Listener\\OauthTokenRefreshListener","type":"->","args":[["OCA\\Mail\\Events\\BeforeImapClientCreated"]]},{"file":"/var/www/html/3rdparty/symfony/event-dispatcher/EventDispatcher.php","line":251,"function":"__invoke","class":"OC\\EventDispatcher\\ServiceEventListener","type":"->","args":[["OCA\\Mail\\Events\\BeforeImapClientCreated"],"OCA\\Mail\\Events\\BeforeImapClientCreated",["Symfony\\Component\\EventDispatcher\\EventDispatcher"]]},{"file":"/var/www/html/3rdparty/symfony/event-dispatcher/EventDispatcher.php","line":73,"function":"callListeners","class":"Symfony\\Component\\EventDispatcher\\EventDispatcher","type":"->","args":[[["Closure"]],"OCA\\Mail\\Events\\BeforeImapClientCreated",["OCA\\Mail\\Events\\BeforeImapClientCreated"]]},{"file":"/var/www/html/lib/private/EventDispatcher/EventDispatcher.php","line":94,"function":"dispatch","class":"Symfony\\Component\\EventDispatcher\\EventDispatcher","type":"->","args":[["OCA\\Mail\\Events\\BeforeImapClientCreated"],"OCA\\Mail\\Events\\BeforeImapClientCreated"]},{"file":"/var/www/html/lib/private/EventDispatcher/EventDispatcher.php","line":106,"function":"dispatch","class":"OC\\EventDispatcher\\EventDispatcher","type":"->","args":["OCA\\Mail\\Events\\BeforeImapClientCreated",["OCA\\Mail\\Events\\BeforeImapClientCreated"]]},{"file":"/var/www/html/custom_apps/mail/lib/IMAP/IMAPClientFactory.php","line":77,"function":"dispatchTyped","class":"OC\\EventDispatcher\\EventDispatcher","type":"->","args":[["OCA\\Mail\\Events\\BeforeImapClientCreated"]]},{"file":"/var/www/html/custom_apps/mail/lib/IMAP/MailboxSync.php","line":103,"function":"getClient","class":"OCA\\Mail\\IMAP\\IMAPClientFactory","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/html/custom_apps/mail/lib/BackgroundJob/SyncJob.php","line":110,"function":"sync","class":"OCA\\Mail\\IMAP\\MailboxSync","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/html/lib/public/BackgroundJob/Job.php","line":81,"function":"run","class":"OCA\\Mail\\BackgroundJob\\SyncJob","type":"->","args":[[3]]},{"file":"/var/www/html/lib/public/BackgroundJob/TimedJob.php","line":103,"function":"start","class":"OCP\\BackgroundJob\\Job","type":"->","args":[["OC\\BackgroundJob\\JobList"]]},{"file":"/var/www/html/lib/public/BackgroundJob/TimedJob.php","line":93,"function":"start","class":"OCP\\BackgroundJob\\TimedJob","type":"->","args":[["OC\\BackgroundJob\\JobList"]]},{"file":"/var/www/html/cron.php","line":152,"function":"execute","class":"OCP\\BackgroundJob\\TimedJob","type":"->","args":[["OC\\BackgroundJob\\JobList"],["OC\\Log"]]}],"File":"/var/www/html/3rdparty/guzzlehttp/guzzle/src/Exception/RequestException.php","Line":113,"message":"Could not refresh oauth token: Client error: `POST https://oauth2.googleapis.com/token` resulted in a `400 Bad Request` response:\n{\n  \"error\": \"invalid_grant\",\n  \"error_description\": \"Bad Request\"\n}\n","exception":{},"CustomMessage":"Could not refresh oauth token: Client error: `POST https://oauth2.googleapis.com/token` resulted in a `400 Bad Request` response:\n{\n  \"error\": \"invalid_grant\",\n  \"error_description\": \"Bad Request\"\n}\n"}}
{"reqId":"Sy6a46KmmEaXNnhIYUCk","level":2,"time":"10/10/2023 21:24:12","remoteAddr":"**sensitive IP of User1**","user":"adminuser","app":"mail","method":"GET","url":"/apps/mail/","message":"Could not refresh oauth token: Client error: `POST https://oauth2.googleapis.com/token` resulted in a `400 Bad Request` response:\n{\n  \"error\": \"invalid_grant\",\n  \"error_description\": \"Bad Request\"\n}\n","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36","version":"27.1.1.0","exception":{"Exception":"GuzzleHttp\\Exception\\ClientException","Message":"Client error: `POST https://oauth2.googleapis.com/token` resulted in a `400 Bad Request` response:\n{\n  \"error\": \"invalid_grant\",\n  \"error_description\": \"Bad Request\"\n}\n","Code":400,"Trace":[{"file":"/var/www/html/3rdparty/guzzlehttp/guzzle/src/Middleware.php","line":69,"function":"create","class":"GuzzleHttp\\Exception\\RequestException","type":"::","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/html/3rdparty/guzzlehttp/promises/src/Promise.php","line":204,"function":"GuzzleHttp\\{closure}","class":"GuzzleHttp\\Middleware","type":"::","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/html/3rdparty/guzzlehttp/promises/src/Promise.php","line":153,"function":"callHandler","class":"GuzzleHttp\\Promise\\Promise","type":"::","args":[1,"*** sensitive parameters replaced ***","*** sensitive parameters replaced ***"]},{"file":"/var/www/html/3rdparty/guzzlehttp/promises/src/TaskQueue.php","line":48,"function":"GuzzleHttp\\Promise\\{closure}","class":"GuzzleHttp\\Promise\\Promise","type":"::","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/html/3rdparty/guzzlehttp/promises/src/Promise.php","line":248,"function":"run","class":"GuzzleHttp\\Promise\\TaskQueue","type":"->","args":[true]},{"file":"/var/www/html/3rdparty/guzzlehttp/promises/src/Promise.php","line":224,"function":"invokeWaitFn","class":"GuzzleHttp\\Promise\\Promise","type":"->","args":[]},{"file":"/var/www/html/3rdparty/guzzlehttp/promises/src/Promise.php","line":269,"function":"waitIfPending","class":"GuzzleHttp\\Promise\\Promise","type":"->","args":[]},{"file":"/var/www/html/3rdparty/guzzlehttp/promises/src/Promise.php","line":226,"function":"invokeWaitList","class":"GuzzleHttp\\Promise\\Promise","type":"->","args":[]},{"file":"/var/www/html/3rdparty/guzzlehttp/promises/src/Promise.php","line":62,"function":"waitIfPending","class":"GuzzleHttp\\Promise\\Promise","type":"->","args":[]},{"file":"/var/www/html/3rdparty/guzzlehttp/guzzle/src/Client.php","line":187,"function":"wait","class":"GuzzleHttp\\Promise\\Promise","type":"->","args":[]},{"file":"/var/www/html/lib/private/Http/Client/Client.php","line":301,"function":"request","class":"GuzzleHttp\\Client","type":"->","args":["post","https://oauth2.googleapis.com/token",["/var/www/html/data/files_external/rootcerts.crt",30,[["Closure"]],"application/json","{\"client_id\":\"398376885386-goms3b2k90lr81q0nv8vilrvvcevq1lg.apps.googleusercontent.com\",\"client_secret\":\"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\",\"grant_type\":\"refresh_token\",\"refresh_token\":\"1\\/\\/03AdLApMwkixvCgYIARAAGAMSNwF-L9Ir6oQfgMf_5EBOFRJ4_So4yHEgp30855j2qIopbHXvGp5wFuoFtFI5_iEiY8yuasEVED8\"}","And 3 more entries, set log level to debug to see all entries"]]},{"file":"/var/www/html/custom_apps/mail/lib/Integration/GoogleIntegration.php","line":160,"function":"post","class":"OC\\Http\\Client\\Client","type":"->","args":["https://oauth2.googleapis.com/token",["application/json","{\"client_id\":\"398376885386-goms3b2k90lr81q0nv8vilrvvcevq1lg.apps.googleusercontent.com\",\"client_secret\":\"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\",\"grant_type\":\"refresh_token\",\"refresh_token\":\"1\\/\\/03AdLApMwkixvCgYIARAAGAMSNwF-L9Ir6oQfgMf_5EBOFRJ4_So4yHEgp30855j2qIopbHXvGp5wFuoFtFI5_iEiY8yuasEVED8\"}"]]},{"file":"/var/www/html/custom_apps/mail/lib/Listener/OauthTokenRefreshListener.php","line":55,"function":"refresh","class":"OCA\\Mail\\Integration\\GoogleIntegration","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/html/lib/private/EventDispatcher/ServiceEventListener.php","line":86,"function":"handle","class":"OCA\\Mail\\Listener\\OauthTokenRefreshListener","type":"->","args":[["OCA\\Mail\\Events\\BeforeImapClientCreated"]]},{"file":"/var/www/html/3rdparty/symfony/event-dispatcher/EventDispatcher.php","line":251,"function":"__invoke","class":"OC\\EventDispatcher\\ServiceEventListener","type":"->","args":[["OCA\\Mail\\Events\\BeforeImapClientCreated"],"OCA\\Mail\\Events\\BeforeImapClientCreated",["Symfony\\Component\\EventDispatcher\\EventDispatcher"]]},{"file":"/var/www/html/3rdparty/symfony/event-dispatcher/EventDispatcher.php","line":73,"function":"callListeners","class":"Symfony\\Component\\EventDispatcher\\EventDispatcher","type":"->","args":[[["Closure"]],"OCA\\Mail\\Events\\BeforeImapClientCreated",["OCA\\Mail\\Events\\BeforeImapClientCreated"]]},{"file":"/var/www/html/lib/private/EventDispatcher/EventDispatcher.php","line":94,"function":"dispatch","class":"Symfony\\Component\\EventDispatcher\\EventDispatcher","type":"->","args":[["OCA\\Mail\\Events\\BeforeImapClientCreated"],"OCA\\Mail\\Events\\BeforeImapClientCreated"]},{"file":"/var/www/html/lib/private/EventDispatcher/EventDispatcher.php","line":106,"function":"dispatch","class":"OC\\EventDispatcher\\EventDispatcher","type":"->","args":["OCA\\Mail\\Events\\BeforeImapClientCreated",["OCA\\Mail\\Events\\BeforeImapClientCreated"]]},{"file":"/var/www/html/custom_apps/mail/lib/IMAP/IMAPClientFactory.php","line":77,"function":"dispatchTyped","class":"OC\\EventDispatcher\\EventDispatcher","type":"->","args":[["OCA\\Mail\\Events\\BeforeImapClientCreated"]]},{"file":"/var/www/html/custom_apps/mail/lib/IMAP/MailboxSync.php","line":103,"function":"getClient","class":"OCA\\Mail\\IMAP\\IMAPClientFactory","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/html/custom_apps/mail/lib/Service/MailManager.php","line":142,"function":"sync","class":"OCA\\Mail\\IMAP\\MailboxSync","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/html/custom_apps/mail/lib/Controller/PageController.php","line":145,"function":"getMailboxes","class":"OCA\\Mail\\Service\\MailManager","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/html/lib/private/AppFramework/Http/Dispatcher.php","line":230,"function":"index","class":"OCA\\Mail\\Controller\\PageController","type":"->","args":[]},{"file":"/var/www/html/lib/private/AppFramework/Http/Dispatcher.php","line":137,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[["OCA\\Mail\\Controller\\PageController"],"index"]},{"file":"/var/www/html/lib/private/AppFramework/App.php","line":183,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[["OCA\\Mail\\Controller\\PageController"],"index"]},{"file":"/var/www/html/lib/private/Route/Router.php","line":315,"function":"main","class":"OC\\AppFramework\\App","type":"::","args":["OCA\\Mail\\Controller\\PageController","index",["OC\\AppFramework\\DependencyInjection\\DIContainer"],["mail.page.index"]]},{"file":"/var/www/html/lib/base.php","line":1068,"function":"match","class":"OC\\Route\\Router","type":"->","args":["/apps/mail/"]},{"file":"/var/www/html/index.php","line":36,"function":"handleRequest","class":"OC","type":"::","args":[]}],"File":"/var/www/html/3rdparty/guzzlehttp/guzzle/src/Exception/RequestException.php","Line":113,"message":"Could not refresh oauth token: Client error: `POST https://oauth2.googleapis.com/token` resulted in a `400 Bad Request` response:\n{\n  \"error\": \"invalid_grant\",\n  \"error_description\": \"Bad Request\"\n}\n","exception":{},"CustomMessage":"Could not refresh oauth token: Client error: `POST https://oauth2.googleapis.com/token` resulted in a `400 Bad Request` response:\n{\n  \"error\": \"invalid_grant\",\n  \"error_description\": \"Bad Request\"\n}\n"}}
{"reqId":"Sy6a46KmmEaXNnhIYUCk","level":3,"time":"10/10/2023 21:24:16","remoteAddr":"**sensitive IP of User1**","user":"adminuser","app":"mail","method":"GET","url":"/apps/mail/","message":"Could not load account mailboxes: IMAP error synchronizing account 3: Authentication failed.","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36","version":"27.1.1.0","exception":{"Exception":"OCA\\Mail\\Exception\\ServiceException","Message":"IMAP error synchronizing account 3: Authentication failed.","Code":102,"Trace":[{"file":"/var/www/html/custom_apps/mail/lib/Service/MailManager.php","line":142,"function":"sync","class":"OCA\\Mail\\IMAP\\MailboxSync","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/html/custom_apps/mail/lib/Controller/PageController.php","line":145,"function":"getMailboxes","class":"OCA\\Mail\\Service\\MailManager","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/html/lib/private/AppFramework/Http/Dispatcher.php","line":230,"function":"index","class":"OCA\\Mail\\Controller\\PageController","type":"->","args":[]},{"file":"/var/www/html/lib/private/AppFramework/Http/Dispatcher.php","line":137,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[["OCA\\Mail\\Controller\\PageController"],"index"]},{"file":"/var/www/html/lib/private/AppFramework/App.php","line":183,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[["OCA\\Mail\\Controller\\PageController"],"index"]},{"file":"/var/www/html/lib/private/Route/Router.php","line":315,"function":"main","class":"OC\\AppFramework\\App","type":"::","args":["OCA\\Mail\\Controller\\PageController","index",["OC\\AppFramework\\DependencyInjection\\DIContainer"],["mail.page.index"]]},{"file":"/var/www/html/lib/base.php","line":1068,"function":"match","class":"OC\\Route\\Router","type":"->","args":["/apps/mail/"]},{"file":"/var/www/html/index.php","line":36,"function":"handleRequest","class":"OC","type":"::","args":[]}],"File":"/var/www/html/custom_apps/mail/lib/IMAP/MailboxSync.php","Line":125,"Previous":{"Exception":"Horde_Imap_Client_Exception","Message":"Authentication failed.","Code":102,"Trace":[{"file":"/var/www/html/custom_apps/mail/vendor/bytestream/horde-imap-client/lib/Horde/Imap/Client/Socket.php","line":4566,"function":"_responseCode","class":"Horde_Imap_Client_Socket","type":"->","args":[["Horde_Imap_Client_Interaction_Pipeline",[[],[],["Horde_Imap_Client_Exception",null,false,"Authentication failed."]],["Horde_Imap_Client_Fetch_Results"]],["Horde_Imap_Client_Interaction_Server_Tagged",["stdClass",[],"AUTHENTICATIONFAILED"],3,["Horde_Imap_Client_Tokenize"],"5"]]},{"file":"/var/www/html/custom_apps/mail/vendor/bytestream/horde-imap-client/lib/Horde/Imap/Client/Socket.php","line":4314,"function":"_getLine","class":"Horde_Imap_Client_Socket","type":"->","args":[["Horde_Imap_Client_Interaction_Pipeline",[[],[],["Horde_Imap_Client_Exception",null,false,"Authentication failed."]],["Horde_Imap_Client_Fetch_Results"]]]},{"file":"/var/www/html/custom_apps/mail/vendor/bytestream/horde-imap-client/lib/Horde/Imap/Client/Socket.php","line":4242,"function":"_sendCmdChunk","class":"Horde_Imap_Client_Socket","type":"->","args":[["Horde_Imap_Client_Interaction_Pipeline",[[],[],["Horde_Imap_Client_Exception",null,false,"Authentication failed."]],["Horde_Imap_Client_Fetch_Results"]],[["Horde_Imap_Client_Interaction_Command",[],true,false,null,null,["Horde_Imap_Client_Interaction_Pipeline",[[],[],["Horde_Imap_Client_Exception",null,false,"Authentication failed."]],["Horde_Imap_Client_Fetch_Results"]],["Horde_Imap_Client_Interaction_Server_Tagged",["stdClass",[],"AUTHENTICATIONFAILED"],3,["Horde_Imap_Client_Tokenize"],"5"],"5"]]]},{"file":"/var/www/html/custom_apps/mail/vendor/bytestream/horde-imap-client/lib/Horde/Imap/Client/Socket.php","line":850,"function":"_sendCmd","class":"Horde_Imap_Client_Socket","type":"->","args":[["Horde_Imap_Client_Interaction_Pipeline",[[],[],["Horde_Imap_Client_Exception",null,false,"Authentication failed."]],["Horde_Imap_Client_Fetch_Results"]]]},{"file":"/var/www/html/custom_apps/mail/vendor/bytestream/horde-imap-client/lib/Horde/Imap/Client/Socket.php","line":512,"function":"_tryLogin","class":"Horde_Imap_Client_Socket","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/html/custom_apps/mail/vendor/bytestream/horde-imap-client/lib/Horde/Imap/Client/Base.php","line":853,"function":"_login","class":"Horde_Imap_Client_Socket","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/html/custom_apps/mail/vendor/bytestream/horde-imap-client/lib/Horde/Imap/Client/Base.php","line":1404,"function":"login","class":"Horde_Imap_Client_Base","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/html/custom_apps/mail/lib/IMAP/FolderMapper.php","line":58,"function":"listMailboxes","class":"Horde_Imap_Client_Base","type":"->","args":["*",5,[true,true,true]]},{"file":"/var/www/html/custom_apps/mail/lib/IMAP/MailboxSync.php","line":122,"function":"getFolders","class":"OCA\\Mail\\IMAP\\FolderMapper","type":"->","args":["*** sensitive parameters replaced ***",["Horde_Imap_Client_Socket",["HICenv","HICflags","HIChdrs","HICdate","HICsize","And 1 more entries, set log level to debug to see all entries"],true,true]]},{"file":"/var/www/html/custom_apps/mail/lib/Service/MailManager.php","line":142,"function":"sync","class":"OCA\\Mail\\IMAP\\MailboxSync","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/html/custom_apps/mail/lib/Controller/PageController.php","line":145,"function":"getMailboxes","class":"OCA\\Mail\\Service\\MailManager","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/html/lib/private/AppFramework/Http/Dispatcher.php","line":230,"function":"index","class":"OCA\\Mail\\Controller\\PageController","type":"->","args":[]},{"file":"/var/www/html/lib/private/AppFramework/Http/Dispatcher.php","line":137,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[["OCA\\Mail\\Controller\\PageController"],"index"]},{"file":"/var/www/html/lib/private/AppFramework/App.php","line":183,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[["OCA\\Mail\\Controller\\PageController"],"index"]},{"file":"/var/www/html/lib/private/Route/Router.php","line":315,"function":"main","class":"OC\\AppFramework\\App","type":"::","args":["OCA\\Mail\\Controller\\PageController","index",["OC\\AppFramework\\DependencyInjection\\DIContainer"],["mail.page.index"]]},{"file":"/var/www/html/lib/base.php","line":1068,"function":"match","class":"OC\\Route\\Router","type":"->","args":["/apps/mail/"]},{"file":"/var/www/html/index.php","line":36,"function":"handleRequest","class":"OC","type":"::","args":[]}],"File":"/var/www/html/custom_apps/mail/vendor/bytestream/horde-imap-client/lib/Horde/Imap/Client/Socket.php","Line":5030},"message":"Could not load account mailboxes: IMAP error synchronizing account 3: Authentication failed.","exception":{},"CustomMessage":"Could not load account mailboxes: IMAP error synchronizing account 3: Authentication failed."}}
{"reqId":"4jiegHeaT5pLRUTj41t2","level":2,"time":"10/10/2023 21:24:25","remoteAddr":"**sensitive IP of User1**","user":"adminuser","app":"mail","method":"GET","url":"/apps/mail/api/accounts/3/quota","message":"Could not refresh oauth token: Client error: `POST https://oauth2.googleapis.com/token` resulted in a `400 Bad Request` response:\n{\n  \"error\": \"invalid_grant\",\n  \"error_description\": \"Bad Request\"\n}\n","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36","version":"27.1.1.0","exception":{"Exception":"GuzzleHttp\\Exception\\ClientException","Message":"Client error: `POST https://oauth2.googleapis.com/token` resulted in a `400 Bad Request` response:\n{\n  \"error\": \"invalid_grant\",\n  \"error_description\": \"Bad Request\"\n}\n","Code":400,"Trace":[{"file":"/var/www/html/3rdparty/guzzlehttp/guzzle/src/Middleware.php","line":69,"function":"create","class":"GuzzleHttp\\Exception\\RequestException","type":"::","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/html/3rdparty/guzzlehttp/promises/src/Promise.php","line":204,"function":"GuzzleHttp\\{closure}","class":"GuzzleHttp\\Middleware","type":"::","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/html/3rdparty/guzzlehttp/promises/src/Promise.php","line":153,"function":"callHandler","class":"GuzzleHttp\\Promise\\Promise","type":"::","args":[1,"*** sensitive parameters replaced ***","*** sensitive parameters replaced ***"]},{"file":"/var/www/html/3rdparty/guzzlehttp/promises/src/TaskQueue.php","line":48,"function":"GuzzleHttp\\Promise\\{closure}","class":"GuzzleHttp\\Promise\\Promise","type":"::","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/html/3rdparty/guzzlehttp/promises/src/Promise.php","line":248,"function":"run","class":"GuzzleHttp\\Promise\\TaskQueue","type":"->","args":[true]},{"file":"/var/www/html/3rdparty/guzzlehttp/promises/src/Promise.php","line":224,"function":"invokeWaitFn","class":"GuzzleHttp\\Promise\\Promise","type":"->","args":[]},{"file":"/var/www/html/3rdparty/guzzlehttp/promises/src/Promise.php","line":269,"function":"waitIfPending","class":"GuzzleHttp\\Promise\\Promise","type":"->","args":[]},{"file":"/var/www/html/3rdparty/guzzlehttp/promises/src/Promise.php","line":226,"function":"invokeWaitList","class":"GuzzleHttp\\Promise\\Promise","type":"->","args":[]},{"file":"/var/www/html/3rdparty/guzzlehttp/promises/src/Promise.php","line":62,"function":"waitIfPending","class":"GuzzleHttp\\Promise\\Promise","type":"->","args":[]},{"file":"/var/www/html/3rdparty/guzzlehttp/guzzle/src/Client.php","line":187,"function":"wait","class":"GuzzleHttp\\Promise\\Promise","type":"->","args":[]},{"file":"/var/www/html/lib/private/Http/Client/Client.php","line":301,"function":"request","class":"GuzzleHttp\\Client","type":"->","args":["post","https://oauth2.googleapis.com/token",["/var/www/html/data/files_external/rootcerts.crt",30,[["Closure"]],"application/json","{\"client_id\":\"398376885386-goms3b2k90lr81q0nv8vilrvvcevq1lg.apps.googleusercontent.com\",\"client_secret\":\"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\",\"grant_type\":\"refresh_token\",\"refresh_token\":\"1\\/\\/03AdLApMwkixvCgYIARAAGAMSNwF-L9Ir6oQfgMf_5EBOFRJ4_So4yHEgp30855j2qIopbHXvGp5wFuoFtFI5_iEiY8yuasEVED8\"}","And 3 more entries, set log level to debug to see all entries"]]},{"file":"/var/www/html/custom_apps/mail/lib/Integration/GoogleIntegration.php","line":160,"function":"post","class":"OC\\Http\\Client\\Client","type":"->","args":["https://oauth2.googleapis.com/token",["application/json","{\"client_id\":\"398376885386-goms3b2k90lr81q0nv8vilrvvcevq1lg.apps.googleusercontent.com\",\"client_secret\":\"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\",\"grant_type\":\"refresh_token\",\"refresh_token\":\"1\\/\\/03AdLApMwkixvCgYIARAAGAMSNwF-L9Ir6oQfgMf_5EBOFRJ4_So4yHEgp30855j2qIopbHXvGp5wFuoFtFI5_iEiY8yuasEVED8\"}"]]},{"file":"/var/www/html/custom_apps/mail/lib/Listener/OauthTokenRefreshListener.php","line":55,"function":"refresh","class":"OCA\\Mail\\Integration\\GoogleIntegration","type":"->","args":[["OCA\\Mail\\Account"]]},{"file":"/var/www/html/lib/private/EventDispatcher/ServiceEventListener.php","line":86,"function":"handle","class":"OCA\\Mail\\Listener\\OauthTokenRefreshListener","type":"->","args":[["OCA\\Mail\\Events\\BeforeImapClientCreated"]]},{"file":"/var/www/html/3rdparty/symfony/event-dispatcher/EventDispatcher.php","line":251,"function":"__invoke","class":"OC\\EventDispatcher\\ServiceEventListener","type":"->","args":[["OCA\\Mail\\Events\\BeforeImapClientCreated"],"OCA\\Mail\\Events\\BeforeImapClientCreated",["Symfony\\Component\\EventDispatcher\\EventDispatcher"]]},{"file":"/var/www/html/3rdparty/symfony/event-dispatcher/EventDispatcher.php","line":73,"function":"callListeners","class":"Symfony\\Component\\EventDispatcher\\EventDispatcher","type":"->","args":[[["Closure"]],"OCA\\Mail\\Events\\BeforeImapClientCreated",["OCA\\Mail\\Events\\BeforeImapClientCreated"]]},{"file":"/var/www/html/lib/private/EventDispatcher/EventDispatcher.php","line":94,"function":"dispatch","class":"Symfony\\Component\\EventDispatcher\\EventDispatcher","type":"->","args":[["OCA\\Mail\\Events\\BeforeImapClientCreated"],"OCA\\Mail\\Events\\BeforeImapClientCreated"]},{"file":"/var/www/html/lib/private/EventDispatcher/EventDispatcher.php","line":106,"function":"dispatch","class":"OC\\EventDispatcher\\EventDispatcher","type":"->","args":["OCA\\Mail\\Events\\BeforeImapClientCreated",["OCA\\Mail\\Events\\BeforeImapClientCreated"]]},{"file":"/var/www/html/custom_apps/mail/lib/IMAP/IMAPClientFactory.php","line":77,"function":"dispatchTyped","class":"OC\\EventDispatcher\\EventDispatcher","type":"->","args":[["OCA\\Mail\\Events\\BeforeImapClientCreated"]]},{"file":"/var/www/html/custom_apps/mail/lib/Service/MailManager.php","line":558,"function":"getClient","class":"OCA\\Mail\\IMAP\\IMAPClientFactory","type":"->","args":[["OCA\\Mail\\Account"]]},{"file":"/var/www/html/custom_apps/mail/lib/Controller/AccountsController.php","line":482,"function":"getQuota","class":"OCA\\Mail\\Service\\MailManager","type":"->","args":[["OCA\\Mail\\Account"]]},{"file":"/var/www/html/lib/private/AppFramework/Http/Dispatcher.php","line":230,"function":"getQuota","class":"OCA\\Mail\\Controller\\AccountsController","type":"->","args":[3]},{"file":"/var/www/html/lib/private/AppFramework/Http/Dispatcher.php","line":137,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[["OCA\\Mail\\Controller\\AccountsController"],"getQuota"]},{"file":"/var/www/html/lib/private/AppFramework/App.php","line":183,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[["OCA\\Mail\\Controller\\AccountsController"],"getQuota"]},{"file":"/var/www/html/lib/private/Route/Router.php","line":315,"function":"main","class":"OC\\AppFramework\\App","type":"::","args":["OCA\\Mail\\Controller\\AccountsController","getQuota",["OC\\AppFramework\\DependencyInjection\\DIContainer"],["3","mail.accounts.getQuota"]]},{"file":"/var/www/html/lib/base.php","line":1068,"function":"match","class":"OC\\Route\\Router","type":"->","args":["/apps/mail/api/accounts/3/quota"]},{"file":"/var/www/html/index.php","line":36,"function":"handleRequest","class":"OC","type":"::","args":[]}],"File":"/var/www/html/3rdparty/guzzlehttp/guzzle/src/Exception/RequestException.php","Line":113,"message":"Could not refresh oauth token: Client error: `POST https://oauth2.googleapis.com/token` resulted in a `400 Bad Request` response:\n{\n  \"error\": \"invalid_grant\",\n  \"error_description\": \"Bad Request\"\n}\n","exception":{},"CustomMessage":"Could not refresh oauth token: Client error: `POST https://oauth2.googleapis.com/token` resulted in a `400 Bad Request` response:\n{\n  \"error\": \"invalid_grant\",\n  \"error_description\": \"Bad Request\"\n}\n"}}
{"reqId":"4jiegHeaT5pLRUTj41t2","level":3,"time":"10/10/2023 21:24:27","remoteAddr":"**sensitive IP of User1**","user":"adminuser","app":"index","method":"GET","url":"/apps/mail/api/accounts/3/quota","message":"Authentication failed.","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36","version":"27.1.1.0","exception":{"Exception":"Horde_Imap_Client_Exception","Message":"Authentication failed.","Code":102,"Trace":[{"file":"/var/www/html/custom_apps/mail/vendor/bytestream/horde-imap-client/lib/Horde/Imap/Client/Socket.php","line":4566,"function":"_responseCode","class":"Horde_Imap_Client_Socket","type":"->","args":[["Horde_Imap_Client_Interaction_Pipeline",[[],[],["Horde_Imap_Client_Exception",null,false,"Authentication failed."]],["Horde_Imap_Client_Fetch_Results"]],["Horde_Imap_Client_Interaction_Server_Tagged",["stdClass",[],"AUTHENTICATIONFAILED"],3,["Horde_Imap_Client_Tokenize"],"3"]]},{"file":"/var/www/html/custom_apps/mail/vendor/bytestream/horde-imap-client/lib/Horde/Imap/Client/Socket.php","line":4314,"function":"_getLine","class":"Horde_Imap_Client_Socket","type":"->","args":[["Horde_Imap_Client_Interaction_Pipeline",[[],[],["Horde_Imap_Client_Exception",null,false,"Authentication failed."]],["Horde_Imap_Client_Fetch_Results"]]]},{"file":"/var/www/html/custom_apps/mail/vendor/bytestream/horde-imap-client/lib/Horde/Imap/Client/Socket.php","line":4242,"function":"_sendCmdChunk","class":"Horde_Imap_Client_Socket","type":"->","args":[["Horde_Imap_Client_Interaction_Pipeline",[[],[],["Horde_Imap_Client_Exception",null,false,"Authentication failed."]],["Horde_Imap_Client_Fetch_Results"]],[["Horde_Imap_Client_Interaction_Command",[],true,false,null,null,["Horde_Imap_Client_Interaction_Pipeline",[[],[],["Horde_Imap_Client_Exception",null,false,"Authentication failed."]],["Horde_Imap_Client_Fetch_Results"]],["Horde_Imap_Client_Interaction_Server_Tagged",["stdClass",[],"AUTHENTICATIONFAILED"],3,["Horde_Imap_Client_Tokenize"],"3"],"3"]]]},{"file":"/var/www/html/custom_apps/mail/vendor/bytestream/horde-imap-client/lib/Horde/Imap/Client/Socket.php","line":850,"function":"_sendCmd","class":"Horde_Imap_Client_Socket","type":"->","args":[["Horde_Imap_Client_Interaction_Pipeline",[[],[],["Horde_Imap_Client_Exception",null,false,"Authentication failed."]],["Horde_Imap_Client_Fetch_Results"]]]},{"file":"/var/www/html/custom_apps/mail/vendor/bytestream/horde-imap-client/lib/Horde/Imap/Client/Socket.php","line":512,"function":"_tryLogin","class":"Horde_Imap_Client_Socket","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/html/custom_apps/mail/vendor/bytestream/horde-imap-client/lib/Horde/Imap/Client/Base.php","line":853,"function":"_login","class":"Horde_Imap_Client_Socket","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/html/custom_apps/mail/vendor/bytestream/horde-imap-client/lib/Horde/Imap/Client/Base.php","line":1404,"function":"login","class":"Horde_Imap_Client_Base","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/html/custom_apps/mail/lib/IMAP/FolderMapper.php","line":58,"function":"listMailboxes","class":"Horde_Imap_Client_Base","type":"->","args":["*",5,[true,true,true]]},{"file":"/var/www/html/custom_apps/mail/lib/Service/MailManager.php","line":562,"function":"getFolders","class":"OCA\\Mail\\IMAP\\FolderMapper","type":"->","args":[["OCA\\Mail\\Account"],["Horde_Imap_Client_Socket",["HICenv","HICflags","HIChdrs","HICdate","HICsize","And 1 more entries, set log level to debug to see all entries"],true,true]]},{"file":"/var/www/html/custom_apps/mail/lib/Controller/AccountsController.php","line":482,"function":"getQuota","class":"OCA\\Mail\\Service\\MailManager","type":"->","args":[["OCA\\Mail\\Account"]]},{"file":"/var/www/html/lib/private/AppFramework/Http/Dispatcher.php","line":230,"function":"getQuota","class":"OCA\\Mail\\Controller\\AccountsController","type":"->","args":[3]},{"file":"/var/www/html/lib/private/AppFramework/Http/Dispatcher.php","line":137,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[["OCA\\Mail\\Controller\\AccountsController"],"getQuota"]},{"file":"/var/www/html/lib/private/AppFramework/App.php","line":183,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[["OCA\\Mail\\Controller\\AccountsController"],"getQuota"]},{"file":"/var/www/html/lib/private/Route/Router.php","line":315,"function":"main","class":"OC\\AppFramework\\App","type":"::","args":["OCA\\Mail\\Controller\\AccountsController","getQuota",["OC\\AppFramework\\DependencyInjection\\DIContainer"],["3","mail.accounts.getQuota"]]},{"file":"/var/www/html/lib/base.php","line":1068,"function":"match","class":"OC\\Route\\Router","type":"->","args":["/apps/mail/api/accounts/3/quota"]},{"file":"/var/www/html/index.php","line":36,"function":"handleRequest","class":"OC","type":"::","args":[]}],"File":"/var/www/html/custom_apps/mail/vendor/bytestream/horde-imap-client/lib/Horde/Imap/Client/Socket.php","Line":5030,"CustomMessage":"--"}}
{"reqId":"n8LMOxBlGWKym8EBBIk0","level":2,"time":"10/10/2023 21:24:38","remoteAddr":"**sensitive IP of User1**","user":"adminuser","app":"mail","method":"GET","url":"/apps/mail/box/1/thread/11879","message":"Could not refresh oauth token: Client error: `POST https://oauth2.googleapis.com/token` resulted in a `400 Bad Request` response:\n{\n  \"error\": \"invalid_grant\",\n  \"error_description\": \"Bad Request\"\n}\n","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36","version":"27.1.1.0","exception":{"Exception":"GuzzleHttp\\Exception\\ClientException","Message":"Client error: `POST https://oauth2.googleapis.com/token` resulted in a `400 Bad Request` response:\n{\n  \"error\": \"invalid_grant\",\n  \"error_description\": \"Bad Request\"\n}\n","Code":400,"Trace":[{"file":"/var/www/html/3rdparty/guzzlehttp/guzzle/src/Middleware.php","line":69,"function":"create","class":"GuzzleHttp\\Exception\\RequestException","type":"::","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/html/3rdparty/guzzlehttp/promises/src/Promise.php","line":204,"function":"GuzzleHttp\\{closure}","class":"GuzzleHttp\\Middleware","type":"::","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/html/3rdparty/guzzlehttp/promises/src/Promise.php","line":153,"function":"callHandler","class":"GuzzleHttp\\Promise\\Promise","type":"::","args":[1,"*** sensitive parameters replaced ***","*** sensitive parameters replaced ***"]},{"file":"/var/www/html/3rdparty/guzzlehttp/promises/src/TaskQueue.php","line":48,"function":"GuzzleHttp\\Promise\\{closure}","class":"GuzzleHttp\\Promise\\Promise","type":"::","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/html/3rdparty/guzzlehttp/promises/src/Promise.php","line":248,"function":"run","class":"GuzzleHttp\\Promise\\TaskQueue","type":"->","args":[true]},{"file":"/var/www/html/3rdparty/guzzlehttp/promises/src/Promise.php","line":224,"function":"invokeWaitFn","class":"GuzzleHttp\\Promise\\Promise","type":"->","args":[]},{"file":"/var/www/html/3rdparty/guzzlehttp/promises/src/Promise.php","line":269,"function":"waitIfPending","class":"GuzzleHttp\\Promise\\Promise","type":"->","args":[]},{"file":"/var/www/html/3rdparty/guzzlehttp/promises/src/Promise.php","line":226,"function":"invokeWaitList","class":"GuzzleHttp\\Promise\\Promise","type":"->","args":[]},{"file":"/var/www/html/3rdparty/guzzlehttp/promises/src/Promise.php","line":62,"function":"waitIfPending","class":"GuzzleHttp\\Promise\\Promise","type":"->","args":[]},{"file":"/var/www/html/3rdparty/guzzlehttp/guzzle/src/Client.php","line":187,"function":"wait","class":"GuzzleHttp\\Promise\\Promise","type":"->","args":[]},{"file":"/var/www/html/lib/private/Http/Client/Client.php","line":301,"function":"request","class":"GuzzleHttp\\Client","type":"->","args":["post","https://oauth2.googleapis.com/token",["/var/www/html/data/files_external/rootcerts.crt",30,[["Closure"]],"application/json","{\"client_id\":\"398376885386-goms3b2k90lr81q0nv8vilrvvcevq1lg.apps.googleusercontent.com\",\"client_secret\":\"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\",\"grant_type\":\"refresh_token\",\"refresh_token\":\"1\\/\\/03AdLApMwkixvCgYIARAAGAMSNwF-L9Ir6oQfgMf_5EBOFRJ4_So4yHEgp30855j2qIopbHXvGp5wFuoFtFI5_iEiY8yuasEVED8\"}","And 3 more entries, set log level to debug to see all entries"]]},{"file":"/var/www/html/custom_apps/mail/lib/Integration/GoogleIntegration.php","line":160,"function":"post","class":"OC\\Http\\Client\\Client","type":"->","args":["https://oauth2.googleapis.com/token",["application/json","{\"client_id\":\"398376885386-goms3b2k90lr81q0nv8vilrvvcevq1lg.apps.googleusercontent.com\",\"client_secret\":\"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\",\"grant_type\":\"refresh_token\",\"refresh_token\":\"1\\/\\/03AdLApMwkixvCgYIARAAGAMSNwF-L9Ir6oQfgMf_5EBOFRJ4_So4yHEgp30855j2qIopbHXvGp5wFuoFtFI5_iEiY8yuasEVED8\"}"]]},{"file":"/var/www/html/custom_apps/mail/lib/Listener/OauthTokenRefreshListener.php","line":55,"function":"refresh","class":"OCA\\Mail\\Integration\\GoogleIntegration","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/html/lib/private/EventDispatcher/ServiceEventListener.php","line":86,"function":"handle","class":"OCA\\Mail\\Listener\\OauthTokenRefreshListener","type":"->","args":[["OCA\\Mail\\Events\\BeforeImapClientCreated"]]},{"file":"/var/www/html/3rdparty/symfony/event-dispatcher/EventDispatcher.php","line":251,"function":"__invoke","class":"OC\\EventDispatcher\\ServiceEventListener","type":"->","args":[["OCA\\Mail\\Events\\BeforeImapClientCreated"],"OCA\\Mail\\Events\\BeforeImapClientCreated",["Symfony\\Component\\EventDispatcher\\EventDispatcher"]]},{"file":"/var/www/html/3rdparty/symfony/event-dispatcher/EventDispatcher.php","line":73,"function":"callListeners","class":"Symfony\\Component\\EventDispatcher\\EventDispatcher","type":"->","args":[[["Closure"]],"OCA\\Mail\\Events\\BeforeImapClientCreated",["OCA\\Mail\\Events\\BeforeImapClientCreated"]]},{"file":"/var/www/html/lib/private/EventDispatcher/EventDispatcher.php","line":94,"function":"dispatch","class":"Symfony\\Component\\EventDispatcher\\EventDispatcher","type":"->","args":[["OCA\\Mail\\Events\\BeforeImapClientCreated"],"OCA\\Mail\\Events\\BeforeImapClientCreated"]},{"file":"/var/www/html/lib/private/EventDispatcher/EventDispatcher.php","line":106,"function":"dispatch","class":"OC\\EventDispatcher\\EventDispatcher","type":"->","args":["OCA\\Mail\\Events\\BeforeImapClientCreated",["OCA\\Mail\\Events\\BeforeImapClientCreated"]]},{"file":"/var/www/html/custom_apps/mail/lib/IMAP/IMAPClientFactory.php","line":77,"function":"dispatchTyped","class":"OC\\EventDispatcher\\EventDispatcher","type":"->","args":[["OCA\\Mail\\Events\\BeforeImapClientCreated"]]},{"file":"/var/www/html/custom_apps/mail/lib/IMAP/MailboxSync.php","line":103,"function":"getClient","class":"OCA\\Mail\\IMAP\\IMAPClientFactory","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/html/custom_apps/mail/lib/Service/MailManager.php","line":142,"function":"sync","class":"OCA\\Mail\\IMAP\\MailboxSync","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/html/custom_apps/mail/lib/Controller/PageController.php","line":145,"function":"getMailboxes","class":"OCA\\Mail\\Service\\MailManager","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/html/custom_apps/mail/lib/Controller/PageController.php","line":304,"function":"index","class":"OCA\\Mail\\Controller\\PageController","type":"->","args":[]},{"file":"/var/www/html/lib/private/AppFramework/Http/Dispatcher.php","line":230,"function":"thread","class":"OCA\\Mail\\Controller\\PageController","type":"->","args":[1,11879]},{"file":"/var/www/html/lib/private/AppFramework/Http/Dispatcher.php","line":137,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[["OCA\\Mail\\Controller\\PageController"],"thread"]},{"file":"/var/www/html/lib/private/AppFramework/App.php","line":183,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[["OCA\\Mail\\Controller\\PageController"],"thread"]},{"file":"/var/www/html/lib/private/Route/Router.php","line":315,"function":"main","class":"OC\\AppFramework\\App","type":"::","args":["OCA\\Mail\\Controller\\PageController","thread",["OC\\AppFramework\\DependencyInjection\\DIContainer"],["1","11879","mail.page.thread"]]},{"file":"/var/www/html/lib/base.php","line":1068,"function":"match","class":"OC\\Route\\Router","type":"->","args":["/apps/mail/box/1/thread/11879"]},{"file":"/var/www/html/index.php","line":36,"function":"handleRequest","class":"OC","type":"::","args":[]}],"File":"/var/www/html/3rdparty/guzzlehttp/guzzle/src/Exception/RequestException.php","Line":113,"message":"Could not refresh oauth token: Client error: `POST https://oauth2.googleapis.com/token` resulted in a `400 Bad Request` response:\n{\n  \"error\": \"invalid_grant\",\n  \"error_description\": \"Bad Request\"\n}\n","exception":{},"CustomMessage":"Could not refresh oauth token: Client error: `POST https://oauth2.googleapis.com/token` resulted in a `400 Bad Request` response:\n{\n  \"error\": \"invalid_grant\",\n  \"error_description\": \"Bad Request\"\n}\n"}}

Additional info

The user who discovered the bug is using the Brave browser. My NAS is working on TrueNAS SCALE 22.12 The Nextcloud instance is on Internet behind Nginx Proxy Manager.

ChristophWurst commented 10 months ago

Hi @totoadd. Could you please share your nginx config file(s)? Redact any sensitive values like host URLs.

totoadd commented 10 months ago

Hello, thanks for your answer. Here is my Nginx Proxy Manager configuration for my Nextcloud instance : In the Details tab : NPM_DetailsTab_Config In the SSL tab : NPM_SSLTab_Config I also added this in the Advanced tab :

location = / {
    proxy_pass http://$server:$port;
    add_header  X-Robots-Tag "noindex, nofollow, nosnippet, noarchive";
}
location = /robots.txt {
return 200 "User-agent: *\nDisallow: /\n";
}

Have a good evening

ChristophWurst commented 10 months ago

Turn off Cache assets and try again please.

Is it possible to export the config file generated from the graphical interface options?

totoadd commented 10 months ago

I turned off Cache assets option and I have retrieved the configuration file stored in the Nginx Proxy Manger folders, here it is :

server {
  set $forward_scheme http;
  set $server         "mycloud-nextcloud.ix-mycloud.svc.cluster.local";
  set $port           80;

  listen 80;
#listen [::]:80;

listen 443 ssl http2;
#listen [::]:443;

  server_name mycloud.example.com;

  # Let's Encrypt SSL
  include conf.d/include/letsencrypt-acme-challenge.conf;
  include conf.d/include/ssl-ciphers.conf;
  ssl_certificate /etc/letsencrypt/live/npm-6/fullchain.pem;
  ssl_certificate_key /etc/letsencrypt/live/npm-6/privkey.pem;

  # Block Exploits
  include conf.d/include/block-exploits.conf;

  # HSTS (ngx_http_headers_module is required) (63072000 seconds = 2 years)
  add_header Strict-Transport-Security "max-age=63072000; preload" always;

  # Force SSL
  include conf.d/include/force-ssl.conf;

proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $http_connection;
proxy_http_version 1.1;

  access_log /data/logs/proxy-host-1_access.log proxy;
  error_log /data/logs/proxy-host-1_error.log warn;

location = / {
    proxy_pass http://$server:$port;
    add_header  X-Robots-Tag "noindex, nofollow, nosnippet, noarchive";
}
location = /robots.txt {
return 200 "User-agent: *\nDisallow: /\n";
}

  location / {

  # HSTS (ngx_http_headers_module is required) (63072000 seconds = 2 years)
  add_header Strict-Transport-Security "max-age=63072000; preload" always;

    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection $http_connection;
    proxy_http_version 1.1;

    # Proxy!
    include conf.d/include/proxy.conf;
  }

  # Custom
  include /data/nginx/custom/server_proxy[.]conf;
}

I also give you the included conf files :

letsencrypt-acme-challenge.conf

# Rule for legitimate ACME Challenge requests (like /.well-known/acme-challenge/xxxxxxxxx)
# We use ^~ here, so that we don't check other regexes (for speed-up). We actually MUST cancel
# other regex checks, because in our other config files have regex rule that denies access to files with dotted names.
location ^~ /.well-known/acme-challenge/ {
        # Since this is for letsencrypt authentication of a domain and they do not give IP ranges of their infrastructure
        # we need to open up access by turning off auth and IP ACL for this location.
        auth_basic off;
        auth_request off;
        allow all;

        # Set correct content type. According to this:
        # https://community.letsencrypt.org/t/using-the-webroot-domain-verification-method/1445/29
        # Current specification requires "text/plain" or no content header at all.
        # It seems that "text/plain" is a safe option.
        default_type "text/plain";

        # This directory must be the same as in /etc/letsencrypt/cli.ini
        # as "webroot-path" parameter. Also don't forget to set "authenticator" parameter
        # there to "webroot".
        # Do NOT use alias, use root! Target directory is located here:
        # /var/www/common/letsencrypt/.well-known/acme-challenge/
        root /data/letsencrypt-acme-challenge;
}

# Hide /acme-challenge subdirectory and return 404 on all requests.
# It is somewhat more secure than letting Nginx return 403.
# Ending slash is important!
location = /.well-known/acme-challenge/ {
        return 404;
}

ssl-ciphers.conf

ssl_session_timeout 5m;
ssl_session_cache shared:SSL:50m;

# intermediate configuration. tweak to your needs.
ssl_protocols TLSv1.2 TLSv1.3;
ssl_ciphers 'ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384';
ssl_prefer_server_ciphers off;

block-exploits.conf

## Block SQL injections
set $block_sql_injections 0;
if ($query_string ~ "union.*select.*\(") {
        set $block_sql_injections 1;
}
if ($query_string ~ "union.*all.*select.*") {
        set $block_sql_injections 1;
}
if ($query_string ~ "concat.*\(") {
        set $block_sql_injections 1;
}
if ($block_sql_injections = 1) {
        return 403;
}

## Block file injections
set $block_file_injections 0;
if ($query_string ~ "[a-zA-Z0-9_]=http://") {
        set $block_file_injections 1;
}
if ($query_string ~ "[a-zA-Z0-9_]=(\.\.//?)+") {
        set $block_file_injections 1;
}
if ($query_string ~ "[a-zA-Z0-9_]=/([a-z0-9_.]//?)+") {
        set $block_file_injections 1;
}
if ($block_file_injections = 1) {
        return 403;
}

## Block common exploits
set $block_common_exploits 0;
if ($query_string ~ "(<|%3C).*script.*(>|%3E)") {
        set $block_common_exploits 1;
}
if ($query_string ~ "GLOBALS(=|\[|\%[0-9A-Z]{0,2})") {
        set $block_common_exploits 1;
}
if ($query_string ~ "_REQUEST(=|\[|\%[0-9A-Z]{0,2})") {
        set $block_common_exploits 1;
}
if ($query_string ~ "proc/self/environ") {
        set $block_common_exploits 1;
}
if ($query_string ~ "mosConfig_[a-zA-Z_]{1,21}(=|\%3D)") {
        set $block_common_exploits 1;
}
if ($query_string ~ "base64_(en|de)code\(.*\)") {
        set $block_common_exploits 1;
}
if ($block_common_exploits = 1) {
        return 403;
}

## Block spam
set $block_spam 0;
if ($query_string ~ "\b(ultram|unicauca|valium|viagra|vicodin|xanax|ypxaieo)\b") {
        set $block_spam 1;
}
if ($query_string ~ "\b(erections|hoodia|huronriveracres|impotence|levitra|libido)\b") {
        set $block_spam 1;
}
if ($query_string ~ "\b(ambien|blue\spill|cialis|cocaine|ejaculation|erectile)\b") {
        set $block_spam 1;
}
if ($query_string ~ "\b(lipitor|phentermin|pro[sz]ac|sandyauer|tramadol|troyhamby)\b") {
        set $block_spam 1;
}
if ($block_spam = 1) {
        return 403;
}

## Block user agents
set $block_user_agents 0;
# Disable Akeeba Remote Control 2.5 and earlier
if ($http_user_agent ~ "Indy Library") {
        set $block_user_agents 1;
}

# Common bandwidth hoggers and hacking tools.
if ($http_user_agent ~ "libwww-perl") {
        set $block_user_agents 1;
}
if ($http_user_agent ~ "GetRight") {
        set $block_user_agents 1;
}
if ($http_user_agent ~ "GetWeb!") {
        set $block_user_agents 1;
}
if ($http_user_agent ~ "Go!Zilla") {
        set $block_user_agents 1;
}
if ($http_user_agent ~ "Download Demon") {
        set $block_user_agents 1;
}
if ($http_user_agent ~ "Go-Ahead-Got-It") {
        set $block_user_agents 1;
}
if ($http_user_agent ~ "TurnitinBot") {
        set $block_user_agents 1;
}
if ($http_user_agent ~ "GrabNet") {
        set $block_user_agents 1;
}
if ($block_user_agents = 1) {
        return 403;
}

force-ssl.conf

if ($scheme = "http") {
        return 301 https://$host$request_uri;
}

proxy.conf

add_header       X-Served-By $host;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Scheme $scheme;
proxy_set_header X-Forwarded-Proto  $scheme;
proxy_set_header X-Forwarded-For    $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP          $remote_addr;
proxy_pass       $forward_scheme://$server:$port$request_uri;

Since last week, the bug hasn't recurred, but I don't know if it will.

joshtrichards commented 10 months ago

The cause of your issue is likely this:

https://github.com/NginxProxyManager/nginx-proxy-manager/blob/3197de41de89786a7fb73a61fbf3f1e271e03091/docker/rootfs/etc/nginx/conf.d/include/assets.conf#L9

That appears to be what the Cached Assets option of Nginx proxy manager enables.

It's NPM specific (not a standard nginx config). Stripping Set-Cookie can be dangerous if not done very carefully.

It could cause the behavior you are describing.

Follow-up: There's a chance I'm wrong, but when I saw that proxy_ignore_headers line that included Set-Cookie I got deeply suspicious. I haven't reviewed NPM's config templates in depth.

ChristophWurst commented 10 months ago

Right, this instructs the fastcgi cache to cache responses despite the set-headers cookie. So multiple users receive the same same, cached cookie headers and therefore share a session.

totoadd commented 10 months ago

So this issue is caused by the Cache assets option from Nginx Proxy Manager that enable proxy_ignore_headers Set-Cookie. For this reason, I disabled the Cache assets in Nginx Proxy Manager. Thank for your time passed in helping me to resolve my issue. Have a good day.

joshtrichards commented 1 month ago

I'm going to close this out since this isn't a bug in Nextcloud, but a deployment / configuration matter. However there is a PR under early development that would add a setup check to warn the admin if we detect obvious signs of this configuration mishap. I think that would be a good addition.