[Bug]: `hash_hkdf(): Argument #2 ($key) cannot be empty` / `HMAC does not match`
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 36.9k
- Forks
- 5.2k
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 713
Description
⚠️ This issue respects the following points: ⚠️
- This is a bug, not a question or a configuration/webserver/proxy issue.
- This issue is not already reported on Github (I've searched it).
- Nextcloud Server is up to date. See Maintenance and Release Schedule for supported versions.
- Nextcloud Server is running on 64bit capable CPU, PHP and OS.
- I agree to follow Nextcloud's Code of Conduct.
Bug description
After upgrading my server from Nextcloud v24.0.4 to v24.0.5 and also upgrading to PHP8 (I don't know if this is of importance), the Nextcloud cron job generates the following error output:
ValueError: hash_hkdf(): Argument #2 ($key) cannot be empty in .../lib/private/Security/Crypto.php:97
Stack trace:
#0 .../nextcloud/lib/private/Security/Crypto.php(97): hash_hkdf('sha512', '')
#1 .../nextcloud/lib/private/Security/IdentityProof/Manager.php(110): OC\Security\Crypto->encrypt('-----BEGIN PRIV...')
#2 .../nextcloud/lib/private/Security/IdentityProof/Manager.php(133): OC\Security\IdentityProof\Manager->generateKey('user-juergen')
#3 .../nextcloud/lib/private/Security/IdentityProof/Manager.php(146): OC\Security\IdentityProof\Manager->retrieveKey('user-juergen')
#4 .../nextcloud/lib/private/Security/IdentityProof/Signer.php(64): OC\Security\IdentityProof\Manager->getKey(Object(OC\User\User))
#5 .../nextcloud/apps/lookup_server_connector/lib/BackgroundJobs/RetryJob.php(150): OC\Security\IdentityProof\Signer->sign('lookupserver', Array, Object(OC\User\User))
#6 .../nextcloud/lib/public/BackgroundJob/Job.php(79): OCA\LookupServerConnector\BackgroundJobs\RetryJob->run(Array)
#7 .../nextcloud/apps/lookup_server_connector/lib/BackgroundJobs/RetryJob.php(113): OCP\BackgroundJob\Job->execute(Object(OC\BackgroundJob\JobList), Object(OC\Log))
#8 .../nextcloud/cron.php(151): OCA\LookupServerConnector\BackgroundJobs\RetryJob->execute(Object(OC\BackgroundJob\JobList), Object(OC\Log))
#9 {main}
Steps to reproduce
I don't know how to reproduce it at the moment but it seems to occur if notification should be send-out.
Expected behavior
Execute background job without running into an error condition.
Installation method
Community Manual installation with Archive
Operating system
No response
PHP engine version
PHP 8.0
Web server
Apache (supported)
Database engine version
MariaDB
Is this bug present after an update or on a fresh install?
Updated from a minor version (ex. 22.2.3 to 22.2.4)
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
## Environment
#### Server Configuration
OS: Linux 5.15.64
Web server: Apache2 2.4.53
Database: MariaDB 10.3.35
PHP version: 8.0.20
Nextcloud version: 24.0.5
#### Client Configuration
Browser: Mozilla Firefox 104.0.2
Operating system: Windows 10
List of activated Apps
Enabled:
- accessibility: 1.10.0
- activity: 2.16.0
- admin_audit: 1.14.0
- announcementcenter: 6.3.1
- apporder: 0.15.0
- audioplayer: 3.3.0
- bookmarks: 11.0.1
- bruteforcesettings: 2.4.0
- calendar: 3.5.0
- circles: 24.0.1
- cloud_federation_api: 1.7.0
- comments: 1.14.0
- contacts: 4.2.0
- contactsinteraction: 1.5.0
- dav: 1.22.0
- event_update_notification: 1.5.0
- external: 4.0.0
- federatedfilesharing: 1.14.0
- federation: 1.14.0
- files: 1.19.0
- files_accesscontrol: 1.14.1
- files_antivirus: 3.3.1
- files_automatedtagging: 1.14.0
- files_downloadactivity: 1.13.0
- files_external: 1.16.1
- files_pdfviewer: 2.5.0
- files_photospheres: 1.24.1
- files_retention: 1.13.2
- files_rightclick: 1.3.0
- files_sharing: 1.16.2
- files_trashbin: 1.14.0
- files_versions: 1.17.0
- files_videoplayer: 1.13.0
- firstrunwizard: 2.13.0
- groupfolders: 12.0.1
- guests: 2.2.0
- impersonate: 1.11.0
- logreader: 2.9.0
- lookup_server_connector: 1.12.0
- mail: 1.13.8
- maps: 0.2.1
- metadata: 0.16.0
- news: 18.1.1
- nextcloud_announcements: 1.13.0
- notes: 4.5.1
- notifications: 2.12.1
- notify_push: 0.4.0
- oauth2: 1.12.0
- password_policy: 1.14.0
- photos: 1.6.0
- previewgenerator: 5.0.0
- privacy: 1.8.0
- provisioning_api: 1.14.0
- serverinfo: 1.14.0
- settings: 1.6.0
- sharebymail: 1.14.0
- smb_test: 0.3.4
- spreed: 14.0.4
- suspicious_login: 4.2.0
- systemtags: 1.14.0
- tasks: 0.14.4
- text: 3.5.1
- theming: 1.15.0
- twofactor_backupcodes: 1.13.0
- twofactor_gateway: 0.20.0
- twofactor_totp: 6.4.0
- twofactor_webauthn: 0.3.1
- unsplash: 1.2.5
- updatenotification: 1.14.0
- user_status: 1.4.0
- viewer: 1.8.0
- workflow_script: 1.9.0
- workflowengine: 2.6.0
Disabled:
- dashboard: 7.0.0
- encryption
- epubreader: 1.4.7
- files_trackdownloads: 1.11.0
- recommendations: 0.6.0
- support: 1.4.0
- survey_client: 1.1.0
- twofactor_admin: 3.2.0
- user_ldap
- weather_status: 1.0.0
Nextcloud Signing status
No errors have been found.
Nextcloud Logs
.
Additional info
.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with lib/private/Security/Crypto.php:97 and trace the identity-proof flow through IdentityProof/Manager.php, IdentityProof/Signer.php, and lookup_server_connector/lib/BackgroundJobs/RetryJob.php. Run the cron background job using the reported PHP 8 setup and determine why the key is empty or the HMAC fails; done means the job completes without either error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- backend, security
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100