-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NC 20 hex2bin(): Input string must be hexadecimal string at /var/www/nextcloud/lib/private/Security/Crypto.php#125 #23197
Comments
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
At first I encountered a different problem (#23595) and manually applied the existing patch #23606. Please ping me if I can povide any new logs/info that has not already been posted above. |
My error log is getting filled up by this error system to happen when users are syncing. @nickvergessen I know you've asked not to mention people but im not sure how to go about this but this error started since NC 20 and its not going away. |
Looks like if you setup a fresh install of NC20 you dont get this error but when you upgrade from an earlier version then you get this error. |
I am affected by this also. The error first appeared after upgrading from Nextcloud 19 to 20. |
Can someone from @nextcloud help with this |
I get it when users sync the most or open files. |
Yep I am also experiencing this issue. In fact, our files is not even accessible right now after upgrading from NC 19 to 20 |
I just updated from 19.0.5 to 20.0.2 and can see these error messages as well in Nextcloud Logging. I remember that I switched the config parameter I went back a little further in the logs and it seems that these error messages, already appeared while running the OCC command Apart from those error messages, it seems to run smoothly and without any issues. System Infos: CentOS 7.8 These appeared while browsing through Nextcloud and changing things in the dashboard:
Followed by:
|
Having the same issue. All my files are encrypted with a password that supposedly doesn't match my current password anymore (which is bullshit, I never changed it). While the files are still intact on my already synced clients, I cannot open them anymore via the web UI. This started happening after the upgrade to 20.0.
This Discourse chat is related: https://help.nextcloud.com/t/cant-update-private-key/53662 |
So the way I was able to grab photos via downgrading to NC19 (luckily my backup works) and goto Photos --> Album, only there can I click the picture 1 at a time, pretty sad. But the photo function can read and decrypt the file. However, I cannot save the PDF or non picture file. I try many of the OCC command like encryption:decrypt-all or encryption:decrypt-all [user] doesn't work. I review my overview section to ensure I resolved all errors. I had better luck with PHP7.4 but PHP 7.2 I cannot even login saying my password was wrong. I haven't had time to look but I'm tempted to roll back another month to NC18 or something |
Any reaction? This is basically a complete data loss due to the upgrade. My cloud file storage is completely dysfunctional right now. My only option at the moment is to delete everything and restore from backup. I will most likely have to delete the whole account with calendars and contacts, since there seems to be no other way to reset the broken encryption key. |
Disclaimer: I don't know much about the encryption in Nextcloud. Be careful with everything I suggest. Better have a full backup. server/apps/encryption/lib/Crypto/Crypt.php Lines 579 to 596 in b3037de
@phoerious You can turn off the signature check with |
Thanks. Commenting out that line allowed me to reset the private key password in the encryption settings. |
I had the same issue after a server failure: I restored a backup of my DB and data files to a new server and I had the same message as @phoerious about a changed password which was not... |
I find it startling that this critical issue still hasn't had any response from the developers after three months. Doesn't really boost my confidence in the product. |
@phoerious yes i agree with you on this. I understand they are busy but at least to get some movement on this i have 4 servers and all have the same issue after i updateded them from nc19 to nc20. i setup a new nc 20 and i dont get these errors so these seems more related from updating. @nickvergessen Anyway we can have someone look at this please 🙏🏼 |
Busy isn't an excuse. I manage a larger open source project myself and we would never be this unresponsive on such a critical issue. And we don't even have a company with full-time employees behind us like Nextcloud does. |
@
Trust me i understand and i agree with you 100% |
If you get an error about
|
All relevant log snippets have been posted, there are clear instructions as to how you may be able to reproduce it, the issue is formulated clearly and may potentially affect a lot of people, even if not many have written here. It leads to a potential loss of all data stored in the cloud and should thus have at least high triage priority if not for me, then for the thousands of users who might potentially face this in the future. The total lack of communication does not cast a positive light on this project. At least a timely acknowledgment would have been due, but ymmv. Yet how this went, if tomorrow I were to post a critical security vulnerability, I couldn't trust at all that it would ever be fixed. /rant Thanks for your work on this project anyway. |
As per above: "We have … a security program to handle …. After that comes everything else." |
Please try: diff --git a/lib/private/Encryption/Keys/Storage.php b/lib/private/Encryption/Keys/Storage.php
index a2b27de6b5..c70ebc15ec 100644
--- a/lib/private/Encryption/Keys/Storage.php
+++ b/lib/private/Encryption/Keys/Storage.php
@@ -301,7 +301,7 @@ class Storage implements IStorage {
$fallback = false;
try {
$clearData = $this->crypto->decrypt($data);
- } catch (\Exception $e) {
+ } catch (\Throwable $e) {
$fallback = true;
} |
I am getting the same messages in my log file, which is filling up faster than I can delete it. Current rate at which it is filling up is 1.5GB per day. I am also using an upgraded version of nextcloud ("userAgent":"Mozilla/5.0 (iOS) Nextcloud-iOS/3.1.0","version":"20.0.5.2"). I've regularly updated this server since version 14 or even earlier. I also did this recommended thing:
returned all good. Setting |
Sorry for the delay but I don't get notifications on closed ticket. |
FYI: still persists on 20.0.6.1 |
Can confirm the same error on Nextcloud 20.0.7 |
Does somebody have a complete stack trace for me? On 20.0.7? |
This is the stack trace on my 20.0.7: Click to expand{"reqId":"UyCpAteIaX2kO4DrKPP9","level":3,"time":"2021-02-07T17:03:25+00:00","remoteAddr":"127.0.0.1","user":"august","app":"PHP","method":"PUT","url":"/index.php/apps/text/session/create","message":{"Exception":"Error","Message":"hex2bin(): Input string must be hexadecimal string at /snap/nextcloud/26119/htdocs/lib/private/Security/Crypto.php#125","Code":0,"Trace":[{"function":"onError","class":"OC\Log\ErrorHandler","type":"::","args":[2,"hex2bin(): Input string must be hexadecimal string","/snap/nextcloud/26119/htdocs/lib/private/Security/Crypto.php",125,{"authenticatedCiphertext":"*** sensitive parameter replaced ","password":" sensitive parameter replaced ","parts":[null,null,null],"partCount":3}]},{"file":"/snap/nextcloud/26119/htdocs/lib/private/Security/Crypto.php","line":125,"function":"hex2bin","args":[null]},{"file":"/snap/nextcloud/26119/htdocs/lib/private/Encryption/Keys/Storage.php","line":285,"function":"decrypt","class":"OC\Security\Crypto","type":"->","args":[" sensitive parameters replaced ***"]},{"file":"/snap/nextcloud/26119/htdocs/lib/private/Encryption/Keys/Storage.php","line":104,"function":"getKey","class":"OC\Encryption\Keys\Storage","type":"->","args":["/august/files_encryption/keys/files/Willkommen/_Willkommen.md/OC_DEFAULT_MODULE/fileKey"]},{"file":"/snap/nextcloud/26119/htdocs/apps/encryption/lib/KeyManager.php","line":452,"function":"getFileKey","class":"OC\Encryption\Keys\Storage","type":"->","args":["/august/files/Willkommen/_Willkommen.md","fileKey","OC_DEFAULT_MODULE"]},{"file":"/snap/nextcloud/26119/htdocs/apps/encryption/lib/Crypto/Encryption.php","line":202,"function":"getFileKey","class":"OCA\Encryption\KeyManager","type":"->","args":["/august/files/Willkommen/_Willkommen.md","august"]},{"file":"/snap/nextcloud/26119/htdocs/lib/private/Files/Stream/Encryption.php","line":268,"function":"begin","class":"OCA\Encryption\Crypto\Encryption","type":"->","args":["/august/files/Willkommen/_Willkommen.md","august","r",{"oc_encryption_module":"OC_DEFAULT_MODULE"},[]]},{"function":"stream_open","class":"OC\Files\Stream\Encryption","type":"->","args":["ocencryption://","r",0,null]},{"file":"/snap/nextcloud/26119/htdocs/lib/private/Files/Stream/Encryption.php","line":207,"function":"fopen","args":["ocencryption://","r",false,null]},{"file":"/snap/nextcloud/26119/htdocs/lib/private/Files/Stream/Encryption.php","line":187,"function":"wrapSource","class":"OC\Files\Stream\Encryption","type":"::","args":[null,null,"ocencryption","OC\Files\Stream\Encryption","r"]},{"file":"/snap/nextcloud/26119/htdocs/lib/private/Files/Storage/Wrapper/Encryption.php","line":473,"function":"wrap","class":"OC\Files\Stream\Encryption","type":"::","args":[null,"files/Willkommen/_Willkommen.md","/august/files/Willkommen/_Willkommen.md",{"oc_encryption_module":"OC_DEFAULT_MODULE"},"august",{"class":"OCA\Encryption\Crypto\Encryption"},{"class":"OC\Files\Storage\Home"},{"cache":null,"scanner":null,"watcher":null,"propagator":null,"updater":null,"class":"OC\Files\Storage\Wrapper\Encryption"},{"class":"OC\Encryption\Util"},{"class":"OC\Encryption\File"},"r",3269,3269,0,false]},{"file":"/snap/nextcloud/26119/htdocs/lib/private/Files/Storage/Wrapper/Wrapper.php","line":300,"function":"fopen","class":"OC\Files\Storage\Wrapper\Encryption","type":"->","args":["files/Willkommen/_Willkommen.md","r"]},{"file":"/snap/nextcloud/26119/htdocs/lib/private/Files/View.php","line":1165,"function":"fopen","class":"OC\Files\Storage\Wrapper\Wrapper","type":"->","args":["files/Willkommen/_Willkommen.md","r"]},{"file":"/snap/nextcloud/26119/htdocs/lib/private/Files/View.php","line":1001,"function":"basicOperation","class":"OC\Files\View","type":"->","args":["fopen","/august/files/Willkommen/_Willkommen.md",["read"],"r"]},{"file":"/snap/nextcloud/26119/htdocs/lib/private/Files/Node/File.php","line":115,"function":"fopen","class":"OC\Files\View","type":"->","args":["/august/files/Willkommen/_Willkommen.md","r"]},{"file":"/snap/nextcloud/26119/htdocs/apps/text/lib/Service/DocumentService.php","line":162,"function":"fopen","class":"OC\Files\Node\File","type":"->","args":["r"]},{"file":"/snap/nextcloud/26119/htdocs/apps/text/lib/Service/ApiService.php","line":100,"function":"createDocument","class":"OCA\Text\Service\DocumentService","type":"->","args":[{"class":"OC\Files\Node\File"}]},{"file":"/snap/nextcloud/26119/htdocs/apps/text/lib/Controller/SessionController.php","line":49,"function":"create","class":"OCA\Text\Service\ApiService","type":"->","args":[15650,null,null,null,false]},{"file":"/snap/nextcloud/26119/htdocs/lib/private/AppFramework/Http/Dispatcher.php","line":169,"function":"create","class":"OCA\Text\Controller\SessionController","type":"->","args":[15650,null,false]},{"file":"/snap/nextcloud/26119/htdocs/lib/private/AppFramework/Http/Dispatcher.php","line":100,"function":"executeController","class":"OC\AppFramework\Http\Dispatcher","type":"->","args":[{"class":"OCA\Text\Controller\SessionController"},"create"]},{"file":"/snap/nextcloud/26119/htdocs/lib/private/AppFramework/App.php","line":152,"function":"dispatch","class":"OC\AppFramework\Http\Dispatcher","type":"->","args":[{"class":"OCA\Text\Controller\SessionController"},"create"]},{"file":"/snap/nextcloud/26119/htdocs/lib/private/Route/Router.php","line":309,"function":"main","class":"OC\AppFramework\App","type":"::","args":["OCA\Text\Controller\SessionController","create",{"class":"OC\AppFramework\DependencyInjection\DIContainer"},{"_route":"text.Session.create"}]},{"file":"/snap/nextcloud/26119/htdocs/lib/base.php","line":1008,"function":"match","class":"OC\Route\Router","type":"->","args":["/apps/text/session/create"]},{"file":"/snap/nextcloud/26119/htdocs/index.php","line":37,"function":"handleRequest","class":"OC","type":"::","args":[]}],"File":"/snap/nextcloud/26119/htdocs/lib/private/Log/ErrorHandler.php","Line":91,"CustomMessage":"--"},"userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:85.0) Gecko/20100101 Firefox/85.0","version":"20.0.7.1","id":"60201d5d7e624"} {"reqId":"UyCpAteIaX2kO4DrKPP9","level":3,"time":"2021-02-07T17:03:25+00:00","remoteAddr":"127.0.0.1","user":"august","app":"no app in context","method":"PUT","url":"/index.php/apps/text/session/create","message":{"Exception":"OC\ServerNotAvailableException","Message":"Could not decrypt key","Code":0,"Trace":[{"file":"/snap/nextcloud/26119/htdocs/lib/private/Encryption/Keys/Storage.php","line":104,"function":"getKey","class":"OC\Encryption\Keys\Storage","type":"->","args":["/august/files_encryption/keys/files/Willkommen/_Willkommen.md/OC_DEFAULT_MODULE/fileKey"]},{"file":"/snap/nextcloud/26119/htdocs/apps/encryption/lib/KeyManager.php","line":452,"function":"getFileKey","class":"OC\Encryption\Keys\Storage","type":"->","args":["/august/files/Willkommen/_Willkommen.md","fileKey","OC_DEFAULT_MODULE"]},{"file":"/snap/nextcloud/26119/htdocs/apps/encryption/lib/Crypto/Encryption.php","line":202,"function":"getFileKey","class":"OCA\Encryption\KeyManager","type":"->","args":["/august/files/Willkommen/_Willkommen.md","august"]},{"file":"/snap/nextcloud/26119/htdocs/lib/private/Files/Storage/Wrapper/Encryption.php","line":584,"function":"begin","class":"OCA\Encryption\Crypto\Encryption","type":"->","args":["/august/files/Willkommen/_Willkommen.md","august","r",{"oc_encryption_module":"OC_DEFAULT_MODULE"},[]]},{"file":"/snap/nextcloud/26119/htdocs/lib/private/Files/Storage/Wrapper/Encryption.php","line":505,"function":"fixUnencryptedSize","class":"OC\Files\Storage\Wrapper\Encryption","type":"->","args":["*** sensitive parameters replaced "]},{"file":"/snap/nextcloud/26119/htdocs/lib/private/Files/Storage/Wrapper/Encryption.php","line":166,"function":"verifyUnencryptedSize","class":"OC\Files\Storage\Wrapper\Encryption","type":"->","args":[" sensitive parameters replaced "]},{"file":"/snap/nextcloud/26119/htdocs/lib/private/Files/Storage/Wrapper/Encryption.php","line":409,"function":"filesize","class":"OC\Files\Storage\Wrapper\Encryption","type":"->","args":[" sensitive parameter replaced "]},{"file":"/snap/nextcloud/26119/htdocs/lib/private/Files/Storage/Wrapper/Wrapper.php","line":300,"function":"fopen","class":"OC\Files\Storage\Wrapper\Encryption","type":"->","args":[" sensitive parameter replaced ","r"]},{"file":"/snap/nextcloud/26119/htdocs/lib/private/Files/View.php","line":1165,"function":"fopen","class":"OC\Files\Storage\Wrapper\Wrapper","type":"->","args":[" sensitive parameter replaced ","r"]},{"file":"/snap/nextcloud/26119/htdocs/lib/private/Files/View.php","line":1001,"function":"basicOperation","class":"OC\Files\View","type":"->","args":["fopen","/august/files/Willkommen/_Willkommen.md",["read"],"r"]},{"file":"/snap/nextcloud/26119/htdocs/lib/private/Files/Node/File.php","line":115,"function":"fopen","class":"OC\Files\View","type":"->","args":["/august/files/Willkommen/_Willkommen.md","r"]},{"file":"/snap/nextcloud/26119/htdocs/apps/text/lib/Service/DocumentService.php","line":162,"function":"fopen","class":"OC\Files\Node\File","type":"->","args":["r"]},{"file":"/snap/nextcloud/26119/htdocs/apps/text/lib/Service/ApiService.php","line":100,"function":"createDocument","class":"OCA\Text\Service\DocumentService","type":"->","args":[{"class":"OC\Files\Node\File"}]},{"file":"/snap/nextcloud/26119/htdocs/apps/text/lib/Controller/SessionController.php","line":49,"function":"create","class":"OCA\Text\Service\ApiService","type":"->","args":[15650,null,null,null,false]},{"file":"/snap/nextcloud/26119/htdocs/lib/private/AppFramework/Http/Dispatcher.php","line":169,"function":"create","class":"OCA\Text\Controller\SessionController","type":"->","args":[15650,null,false]},{"file":"/snap/nextcloud/26119/htdocs/lib/private/AppFramework/Http/Dispatcher.php","line":100,"function":"executeController","class":"OC\AppFramework\Http\Dispatcher","type":"->","args":[{"class":"OCA\Text\Controller\SessionController"},"create"]},{"file":"/snap/nextcloud/26119/htdocs/lib/private/AppFramework/App.php","line":152,"function":"dispatch","class":"OC\AppFramework\Http\Dispatcher","type":"->","args":[{"class":"OCA\Text\Controller\SessionController"},"create"]},{"file":"/snap/nextcloud/26119/htdocs/lib/private/Route/Router.php","line":309,"function":"main","class":"OC\AppFramework\App","type":"::","args":["OCA\Text\Controller\SessionController","create",{"class":"OC\AppFramework\DependencyInjection\DIContainer"},{"_route":"text.Session.create"}]},{"file":"/snap/nextcloud/26119/htdocs/lib/base.php","line":1008,"function":"match","class":"OC\Route\Router","type":"->","args":["/apps/text/session/create"]},{"file":"/snap/nextcloud/26119/htdocs/index.php","line":37,"function":"handleRequest","class":"OC","type":"::","args":[]}],"File":"/snap/nextcloud/26119/htdocs/lib/private/Encryption/Keys/Storage.php","Line":287,"Previous":{"Exception":"Exception","Message":"HMAC does not match.","Code":0,"Trace":[{"file":"/snap/nextcloud/26119/htdocs/lib/private/Encryption/Keys/Storage.php","line":285,"function":"decrypt","class":"OC\Security\Crypto","type":"->","args":[" sensitive parameters replaced "]},{"file":"/snap/nextcloud/26119/htdocs/lib/private/Encryption/Keys/Storage.php","line":104,"function":"getKey","class":"OC\Encryption\Keys\Storage","type":"->","args":["/august/files_encryption/keys/files/Willkommen/_Willkommen.md/OC_DEFAULT_MODULE/fileKey"]},{"file":"/snap/nextcloud/26119/htdocs/apps/encryption/lib/KeyManager.php","line":452,"function":"getFileKey","class":"OC\Encryption\Keys\Storage","type":"->","args":["/august/files/Willkommen/_Willkommen.md","fileKey","OC_DEFAULT_MODULE"]},{"file":"/snap/nextcloud/26119/htdocs/apps/encryption/lib/Crypto/Encryption.php","line":202,"function":"getFileKey","class":"OCA\Encryption\KeyManager","type":"->","args":["/august/files/Willkommen/_Willkommen.md","august"]},{"file":"/snap/nextcloud/26119/htdocs/lib/private/Files/Storage/Wrapper/Encryption.php","line":584,"function":"begin","class":"OCA\Encryption\Crypto\Encryption","type":"->","args":["/august/files/Willkommen/_Willkommen.md","august","r",{"oc_encryption_module":"OC_DEFAULT_MODULE"},[]]},{"file":"/snap/nextcloud/26119/htdocs/lib/private/Files/Storage/Wrapper/Encryption.php","line":505,"function":"fixUnencryptedSize","class":"OC\Files\Storage\Wrapper\Encryption","type":"->","args":[" sensitive parameters replaced "]},{"file":"/snap/nextcloud/26119/htdocs/lib/private/Files/Storage/Wrapper/Encryption.php","line":166,"function":"verifyUnencryptedSize","class":"OC\Files\Storage\Wrapper\Encryption","type":"->","args":[" sensitive parameters replaced "]},{"file":"/snap/nextcloud/26119/htdocs/lib/private/Files/Storage/Wrapper/Encryption.php","line":409,"function":"filesize","class":"OC\Files\Storage\Wrapper\Encryption","type":"->","args":[" sensitive parameter replaced "]},{"file":"/snap/nextcloud/26119/htdocs/lib/private/Files/Storage/Wrapper/Wrapper.php","line":300,"function":"fopen","class":"OC\Files\Storage\Wrapper\Encryption","type":"->","args":[" sensitive parameter replaced ","r"]},{"file":"/snap/nextcloud/26119/htdocs/lib/private/Files/View.php","line":1165,"function":"fopen","class":"OC\Files\Storage\Wrapper\Wrapper","type":"->","args":[" sensitive parameter replaced ***","r"]},{"file":"/snap/nextcloud/26119/htdocs/lib/private/Files/View.php","line":1001,"function":"basicOperation","class":"OC\Files\View","type":"->","args":["fopen","/august/files/Willkommen/_Willkommen.md",["read"],"r"]},{"file":"/snap/nextcloud/26119/htdocs/lib/private/Files/Node/File.php","line":115,"function":"fopen","class":"OC\Files\View","type":"->","args":["/august/files/Willkommen/_Willkommen.md","r"]},{"file":"/snap/nextcloud/26119/htdocs/apps/text/lib/Service/DocumentService.php","line":162,"function":"fopen","class":"OC\Files\Node\File","type":"->","args":["r"]},{"file":"/snap/nextcloud/26119/htdocs/apps/text/lib/Service/ApiService.php","line":100,"function":"createDocument","class":"OCA\Text\Service\DocumentService","type":"->","args":[{"class":"OC\Files\Node\File"}]},{"file":"/snap/nextcloud/26119/htdocs/apps/text/lib/Controller/SessionController.php","line":49,"function":"create","class":"OCA\Text\Service\ApiService","type":"->","args":[15650,null,null,null,false]},{"file":"/snap/nextcloud/26119/htdocs/lib/private/AppFramework/Http/Dispatcher.php","line":169,"function":"create","class":"OCA\Text\Controller\SessionController","type":"->","args":[15650,null,false]},{"file":"/snap/nextcloud/26119/htdocs/lib/private/AppFramework/Http/Dispatcher.php","line":100,"function":"executeController","class":"OC\AppFramework\Http\Dispatcher","type":"->","args":[{"class":"OCA\Text\Controller\SessionController"},"create"]},{"file":"/snap/nextcloud/26119/htdocs/lib/private/AppFramework/App.php","line":152,"function":"dispatch","class":"OC\AppFramework\Http\Dispatcher","type":"->","args":[{"class":"OCA\Text\Controller\SessionController"},"create"]},{"file":"/snap/nextcloud/26119/htdocs/lib/private/Route/Router.php","line":309,"function":"main","class":"OC\AppFramework\App","type":"::","args":["OCA\Text\Controller\SessionController","create",{"class":"OC\AppFramework\DependencyInjection\DIContainer"},{"_route":"text.Session.create"}]},{"file":"/snap/nextcloud/26119/htdocs/lib/base.php","line":1008,"function":"match","class":"OC\Route\Router","type":"->","args":["/apps/text/session/create"]},{"file":"/snap/nextcloud/26119/htdocs/index.php","line":37,"function":"handleRequest","class":"OC","type":"::","args":[]}],"File":"/snap/nextcloud/26119/htdocs/lib/private/Security/Crypto.php","Line":139},"CustomMessage":"--"},"userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:85.0) Gecko/20100101 Firefox/85.0","version":"20.0.7.1","id":"60201d5d80b45"} {"reqId":"UyCpAteIaX2kO4DrKPP9","level":3,"time":"2021-02-07T17:03:25+00:00","remoteAddr":"127.0.0.1","user":"august","app":"no app in context","method":"PUT","url":"/index.php/apps/text/session/create","message":"Couldn't re-calculate unencrypted size for files/Willkommen/_Willkommen.md","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:85.0) Gecko/20100101 Firefox/85.0","version":"20.0.7.1","id":"60201d5d80b6b"} {"reqId":"UyCpAteIaX2kO4DrKPP9","level":3,"time":"2021-02-07T17:03:25+00:00","remoteAddr":"127.0.0.1","user":"august","app":"PHP","method":"PUT","url":"/index.php/apps/text/session/create","message":{"Exception":"Error","Message":"hash_equals(): Expected user_string to be a string, bool given at /snap/nextcloud/26119/htdocs/lib/private/Security/Crypto.php#138","Code":0,"Trace":[{"function":"onError","class":"OC\Log\ErrorHandler","type":"::","args":[2,"hash_equals(): Expected user_string to be a string, bool given","/snap/nextcloud/26119/htdocs/lib/private/Security/Crypto.php",138,{"authenticatedCiphertext":"*** sensitive parameter replaced ","password":" sensitive parameter replaced ","parts":[null,null,null],"partCount":3,"ciphertext":false,"iv":null,"hmac":false}]},{"file":"/snap/nextcloud/26119/htdocs/lib/private/Security/Crypto.php","line":138,"function":"hash_equals","args":[null,false]},{"file":"/snap/nextcloud/26119/htdocs/lib/private/Encryption/Keys/Storage.php","line":285,"function":"decrypt","class":"OC\Security\Crypto","type":"->","args":[" sensitive parameters replaced "]},{"file":"/snap/nextcloud/26119/htdocs/lib/private/Encryption/Keys/Storage.php","line":104,"function":"getKey","class":"OC\Encryption\Keys\Storage","type":"->","args":["/august/files_encryption/keys/files/Willkommen/_Willkommen.md/OC_DEFAULT_MODULE/fileKey"]},{"file":"/snap/nextcloud/26119/htdocs/apps/encryption/lib/KeyManager.php","line":452,"function":"getFileKey","class":"OC\Encryption\Keys\Storage","type":"->","args":["/august/files/Willkommen/_Willkommen.md","fileKey","OC_DEFAULT_MODULE"]},{"file":"/snap/nextcloud/26119/htdocs/apps/encryption/lib/Crypto/Encryption.php","line":202,"function":"getFileKey","class":"OCA\Encryption\KeyManager","type":"->","args":["/august/files/Willkommen/_Willkommen.md","august"]},{"file":"/snap/nextcloud/26119/htdocs/lib/private/Files/Storage/Wrapper/Encryption.php","line":584,"function":"begin","class":"OCA\Encryption\Crypto\Encryption","type":"->","args":["/august/files/Willkommen/_Willkommen.md","august","r",{"oc_encryption_module":"OC_DEFAULT_MODULE"},[]]},{"file":"/snap/nextcloud/26119/htdocs/lib/private/Files/Storage/Wrapper/Encryption.php","line":505,"function":"fixUnencryptedSize","class":"OC\Files\Storage\Wrapper\Encryption","type":"->","args":[" sensitive parameters replaced "]},{"file":"/snap/nextcloud/26119/htdocs/lib/private/Files/Storage/Wrapper/Encryption.php","line":166,"function":"verifyUnencryptedSize","class":"OC\Files\Storage\Wrapper\Encryption","type":"->","args":[" sensitive parameters replaced "]},{"file":"/snap/nextcloud/26119/htdocs/lib/private/Files/Storage/Wrapper/Encryption.php","line":409,"function":"filesize","class":"OC\Files\Storage\Wrapper\Encryption","type":"->","args":[" sensitive parameter replaced "]},{"file":"/snap/nextcloud/26119/htdocs/lib/private/Files/Storage/Wrapper/Wrapper.php","line":300,"function":"fopen","class":"OC\Files\Storage\Wrapper\Encryption","type":"->","args":[" sensitive parameter replaced ","r"]},{"file":"/snap/nextcloud/26119/htdocs/lib/private/Files/View.php","line":1165,"function":"fopen","class":"OC\Files\Storage\Wrapper\Wrapper","type":"->","args":[" sensitive parameter replaced ***","r"]},{"file":"/snap/nextcloud/26119/htdocs/lib/private/Files/View.php","line":1001,"function":"basicOperation","class":"OC\Files\View","type":"->","args":["fopen","/august/files/Willkommen/_Willkommen.md",["read"],"r"]},{"file":"/snap/nextcloud/26119/htdocs/lib/private/Files/Node/File.php","line":115,"function":"fopen","class":"OC\Files\View","type":"->","args":["/august/files/Willkommen/_Willkommen.md","r"]},{"file":"/snap/nextcloud/26119/htdocs/apps/text/lib/Service/DocumentService.php","line":162,"function":"fopen","class":"OC\Files\Node\File","type":"->","args":["r"]},{"file":"/snap/nextcloud/26119/htdocs/apps/text/lib/Service/ApiService.php","line":100,"function":"createDocument","class":"OCA\Text\Service\DocumentService","type":"->","args":[{"class":"OC\Files\Node\File"}]},{"file":"/snap/nextcloud/26119/htdocs/apps/text/lib/Controller/SessionController.php","line":49,"function":"create","class":"OCA\Text\Service\ApiService","type":"->","args":[15650,null,null,null,false]},{"file":"/snap/nextcloud/26119/htdocs/lib/private/AppFramework/Http/Dispatcher.php","line":169,"function":"create","class":"OCA\Text\Controller\SessionController","type":"->","args":[15650,null,false]},{"file":"/snap/nextcloud/26119/htdocs/lib/private/AppFramework/Http/Dispatcher.php","line":100,"function":"executeController","class":"OC\AppFramework\Http\Dispatcher","type":"->","args":[{"class":"OCA\Text\Controller\SessionController"},"create"]},{"file":"/snap/nextcloud/26119/htdocs/lib/private/AppFramework/App.php","line":152,"function":"dispatch","class":"OC\AppFramework\Http\Dispatcher","type":"->","args":[{"class":"OCA\Text\Controller\SessionController"},"create"]},{"file":"/snap/nextcloud/26119/htdocs/lib/private/Route/Router.php","line":309,"function":"main","class":"OC\AppFramework\App","type":"::","args":["OCA\Text\Controller\SessionController","create",{"class":"OC\AppFramework\DependencyInjection\DIContainer"},{"_route":"text.Session.create"}]},{"file":"/snap/nextcloud/26119/htdocs/lib/base.php","line":1008,"function":"match","class":"OC\Route\Router","type":"->","args":["/apps/text/session/create"]},{"file":"/snap/nextcloud/26119/htdocs/index.php","line":37,"function":"handleRequest","class":"OC","type":"::","args":[]}],"File":"/snap/nextcloud/26119/htdocs/lib/private/Log/ErrorHandler.php","Line":91,"CustomMessage":"--"},"userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:85.0) Gecko/20100101 Firefox/85.0","version":"20.0.7.1","id":"60201d5d80d6c"} {"reqId":"UyCpAteIaX2kO4DrKPP9","level":3,"time":"2021-02-07T17:03:25+00:00","remoteAddr":"127.0.0.1","user":"august","app":"PHP","method":"PUT","url":"/index.php/apps/text/session/create","message":{"Exception":"Error","Message":"hex2bin(): Input string must be hexadecimal string at /snap/nextcloud/26119/htdocs/lib/private/Security/Crypto.php#127","Code":0,"Trace":[{"function":"onError","class":"OC\Log\ErrorHandler","type":"::","args":[2,"hex2bin(): Input string must be hexadecimal string","/snap/nextcloud/26119/htdocs/lib/private/Security/Crypto.php",127,{"authenticatedCiphertext":"*** sensitive parameter replaced ","password":" sensitive parameter replaced ","parts":[null,null,null],"partCount":3,"ciphertext":false,"iv":null}]},{"file":"/snap/nextcloud/26119/htdocs/lib/private/Security/Crypto.php","line":127,"function":"hex2bin","args":[null]},{"file":"/snap/nextcloud/26119/htdocs/lib/private/Encryption/Keys/Storage.php","line":285,"function":"decrypt","class":"OC\Security\Crypto","type":"->","args":[" sensitive parameters replaced "]},{"file":"/snap/nextcloud/26119/htdocs/lib/private/Encryption/Keys/Storage.php","line":104,"function":"getKey","class":"OC\Encryption\Keys\Storage","type":"->","args":["/august/files_encryption/keys/files/Willkommen/_Willkommen.md/OC_DEFAULT_MODULE/fileKey"]},{"file":"/snap/nextcloud/26119/htdocs/apps/encryption/lib/KeyManager.php","line":452,"function":"getFileKey","class":"OC\Encryption\Keys\Storage","type":"->","args":["/august/files/Willkommen/_Willkommen.md","fileKey","OC_DEFAULT_MODULE"]},{"file":"/snap/nextcloud/26119/htdocs/apps/encryption/lib/Crypto/Encryption.php","line":202,"function":"getFileKey","class":"OCA\Encryption\KeyManager","type":"->","args":["/august/files/Willkommen/_Willkommen.md","august"]},{"file":"/snap/nextcloud/26119/htdocs/lib/private/Files/Storage/Wrapper/Encryption.php","line":584,"function":"begin","class":"OCA\Encryption\Crypto\Encryption","type":"->","args":["/august/files/Willkommen/_Willkommen.md","august","r",{"oc_encryption_module":"OC_DEFAULT_MODULE"},[]]},{"file":"/snap/nextcloud/26119/htdocs/lib/private/Files/Storage/Wrapper/Encryption.php","line":505,"function":"fixUnencryptedSize","class":"OC\Files\Storage\Wrapper\Encryption","type":"->","args":[" sensitive parameters replaced "]},{"file":"/snap/nextcloud/26119/htdocs/lib/private/Files/Storage/Wrapper/Encryption.php","line":166,"function":"verifyUnencryptedSize","class":"OC\Files\Storage\Wrapper\Encryption","type":"->","args":[" sensitive parameters replaced "]},{"file":"/snap/nextcloud/26119/htdocs/lib/private/Files/Storage/Wrapper/Encryption.php","line":409,"function":"filesize","class":"OC\Files\Storage\Wrapper\Encryption","type":"->","args":[" sensitive parameter replaced "]},{"file":"/snap/nextcloud/26119/htdocs/lib/private/Files/Storage/Wrapper/Wrapper.php","line":300,"function":"fopen","class":"OC\Files\Storage\Wrapper\Encryption","type":"->","args":[" sensitive parameter replaced ","r"]},{"file":"/snap/nextcloud/26119/htdocs/lib/private/Files/View.php","line":1165,"function":"fopen","class":"OC\Files\Storage\Wrapper\Wrapper","type":"->","args":[" sensitive parameter replaced ***","r"]},{"file":"/snap/nextcloud/26119/htdocs/lib/private/Files/View.php","line":1001,"function":"basicOperation","class":"OC\Files\View","type":"->","args":["fopen","/august/files/Willkommen/_Willkommen.md",["read"],"r"]},{"file":"/snap/nextcloud/26119/htdocs/lib/private/Files/Node/File.php","line":115,"function":"fopen","class":"OC\Files\View","type":"->","args":["/august/files/Willkommen/_Willkommen.md","r"]},{"file":"/snap/nextcloud/26119/htdocs/apps/text/lib/Service/DocumentService.php","line":162,"function":"fopen","class":"OC\Files\Node\File","type":"->","args":["r"]},{"file":"/snap/nextcloud/26119/htdocs/apps/text/lib/Service/ApiService.php","line":100,"function":"createDocument","class":"OCA\Text\Service\DocumentService","type":"->","args":[{"class":"OC\Files\Node\File"}]},{"file":"/snap/nextcloud/26119/htdocs/apps/text/lib/Controller/SessionController.php","line":49,"function":"create","class":"OCA\Text\Service\ApiService","type":"->","args":[15650,null,null,null,false]},{"file":"/snap/nextcloud/26119/htdocs/lib/private/AppFramework/Http/Dispatcher.php","line":169,"function":"create","class":"OCA\Text\Controller\SessionController","type":"->","args":[15650,null,false]},{"file":"/snap/nextcloud/26119/htdocs/lib/private/AppFramework/Http/Dispatcher.php","line":100,"function":"executeController","class":"OC\AppFramework\Http\Dispatcher","type":"->","args":[{"class":"OCA\Text\Controller\SessionController"},"create"]},{"file":"/snap/nextcloud/26119/htdocs/lib/private/AppFramework/App.php","line":152,"function":"dispatch","class":"OC\AppFramework\Http\Dispatcher","type":"->","args":[{"class":"OCA\Text\Controller\SessionController"},"create"]},{"file":"/snap/nextcloud/26119/htdocs/lib/private/Route/Router.php","line":309,"function":"main","class":"OC\AppFramework\App","type":"::","args":["OCA\Text\Controller\SessionController","create",{"class":"OC\AppFramework\DependencyInjection\DIContainer"},{"_route":"text.Session.create"}]},{"file":"/snap/nextcloud/26119/htdocs/lib/base.php","line":1008,"function":"match","class":"OC\Route\Router","type":"->","args":["/apps/text/session/create"]},{"file":"/snap/nextcloud/26119/htdocs/index.php","line":37,"function":"handleRequest","class":"OC","type":"::","args":[]}],"File":"/snap/nextcloud/26119/htdocs/lib/private/Log/ErrorHandler.php","Line":91,"CustomMessage":"--"},"userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:85.0) Gecko/20100101 Firefox/85.0","version":"20.0.7.1","id":"60201d5d80eff"} {"reqId":"UyCpAteIaX2kO4DrKPP9","level":3,"time":"2021-02-07T17:03:25+00:00","remoteAddr":"127.0.0.1","user":"august","app":"PHP","method":"PUT","url":"/index.php/apps/text/session/create","message":{"Exception":"Error","Message":"hex2bin(): Input string must be hexadecimal string at /snap/nextcloud/26119/htdocs/lib/private/Security/Crypto.php#125","Code":0,"Trace":[{"function":"onError","class":"OC\Log\ErrorHandler","type":"::","args":[2,"hex2bin(): Input string must be hexadecimal string","/snap/nextcloud/26119/htdocs/lib/private/Security/Crypto.php",125,{"authenticatedCiphertext":"*** sensitive parameter replaced ","password":" sensitive parameter replaced ","parts":[null,null,null],"partCount":3}]},{"file":"/snap/nextcloud/26119/htdocs/lib/private/Security/Crypto.php","line":125,"function":"hex2bin","args":[null]},{"file":"/snap/nextcloud/26119/htdocs/lib/private/Encryption/Keys/Storage.php","line":285,"function":"decrypt","class":"OC\Security\Crypto","type":"->","args":[" sensitive parameters replaced "]},{"file":"/snap/nextcloud/26119/htdocs/lib/private/Encryption/Keys/Storage.php","line":104,"function":"getKey","class":"OC\Encryption\Keys\Storage","type":"->","args":["/august/files_encryption/keys/files/Willkommen/_Willkommen.md/OC_DEFAULT_MODULE/fileKey"]},{"file":"/snap/nextcloud/26119/htdocs/apps/encryption/lib/KeyManager.php","line":452,"function":"getFileKey","class":"OC\Encryption\Keys\Storage","type":"->","args":["/august/files/Willkommen/_Willkommen.md","fileKey","OC_DEFAULT_MODULE"]},{"file":"/snap/nextcloud/26119/htdocs/apps/encryption/lib/Crypto/Encryption.php","line":202,"function":"getFileKey","class":"OCA\Encryption\KeyManager","type":"->","args":["/august/files/Willkommen/_Willkommen.md","august"]},{"file":"/snap/nextcloud/26119/htdocs/lib/private/Files/Storage/Wrapper/Encryption.php","line":584,"function":"begin","class":"OCA\Encryption\Crypto\Encryption","type":"->","args":["/august/files/Willkommen/_Willkommen.md","august","r",{"oc_encryption_module":"OC_DEFAULT_MODULE"},[]]},{"file":"/snap/nextcloud/26119/htdocs/lib/private/Files/Storage/Wrapper/Encryption.php","line":505,"function":"fixUnencryptedSize","class":"OC\Files\Storage\Wrapper\Encryption","type":"->","args":[" sensitive parameters replaced "]},{"file":"/snap/nextcloud/26119/htdocs/lib/private/Files/Storage/Wrapper/Encryption.php","line":166,"function":"verifyUnencryptedSize","class":"OC\Files\Storage\Wrapper\Encryption","type":"->","args":[" sensitive parameters replaced "]},{"file":"/snap/nextcloud/26119/htdocs/lib/private/Files/Storage/Wrapper/Encryption.php","line":409,"function":"filesize","class":"OC\Files\Storage\Wrapper\Encryption","type":"->","args":[" sensitive parameter replaced "]},{"file":"/snap/nextcloud/26119/htdocs/lib/private/Files/Storage/Wrapper/Wrapper.php","line":300,"function":"fopen","class":"OC\Files\Storage\Wrapper\Encryption","type":"->","args":[" sensitive parameter replaced ","r"]},{"file":"/snap/nextcloud/26119/htdocs/lib/private/Files/View.php","line":1165,"function":"fopen","class":"OC\Files\Storage\Wrapper\Wrapper","type":"->","args":[" sensitive parameter replaced ***","r"]},{"file":"/snap/nextcloud/26119/htdocs/lib/private/Files/View.php","line":1001,"function":"basicOperation","class":"OC\Files\View","type":"->","args":["fopen","/august/files/Willkommen/_Willkommen.md",["read"],"r"]},{"file":"/snap/nextcloud/26119/htdocs/lib/private/Files/Node/File.php","line":115,"function":"fopen","class":"OC\Files\View","type":"->","args":["/august/files/Willkommen/_Willkommen.md","r"]},{"file":"/snap/nextcloud/26119/htdocs/apps/text/lib/Service/DocumentService.php","line":162,"function":"fopen","class":"OC\Files\Node\File","type":"->","args":["r"]},{"file":"/snap/nextcloud/26119/htdocs/apps/text/lib/Service/ApiService.php","line":100,"function":"createDocument","class":"OCA\Text\Service\DocumentService","type":"->","args":[{"class":"OC\Files\Node\File"}]},{"file":"/snap/nextcloud/26119/htdocs/apps/text/lib/Controller/SessionController.php","line":49,"function":"create","class":"OCA\Text\Service\ApiService","type":"->","args":[15650,null,null,null,false]},{"file":"/snap/nextcloud/26119/htdocs/lib/private/AppFramework/Http/Dispatcher.php","line":169,"function":"create","class":"OCA\Text\Controller\SessionController","type":"->","args":[15650,null,false]},{"file":"/snap/nextcloud/26119/htdocs/lib/private/AppFramework/Http/Dispatcher.php","line":100,"function":"executeController","class":"OC\AppFramework\Http\Dispatcher","type":"->","args":[{"class":"OCA\Text\Controller\SessionController"},"create"]},{"file":"/snap/nextcloud/26119/htdocs/lib/private/AppFramework/App.php","line":152,"function":"dispatch","class":"OC\AppFramework\Http\Dispatcher","type":"->","args":[{"class":"OCA\Text\Controller\SessionController"},"create"]},{"file":"/snap/nextcloud/26119/htdocs/lib/private/Route/Router.php","line":309,"function":"main","class":"OC\AppFramework\App","type":"::","args":["OCA\Text\Controller\SessionController","create",{"class":"OC\AppFramework\DependencyInjection\DIContainer"},{"_route":"text.Session.create"}]},{"file":"/snap/nextcloud/26119/htdocs/lib/base.php","line":1008,"function":"match","class":"OC\Route\Router","type":"->","args":["/apps/text/session/create"]},{"file":"/snap/nextcloud/26119/htdocs/index.php","line":37,"function":"handleRequest","class":"OC","type":"::","args":[]}],"File":"/snap/nextcloud/26119/htdocs/lib/private/Log/ErrorHandler.php","Line":91,"CustomMessage":"--"},"userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:85.0) Gecko/20100101 Firefox/85.0","version":"20.0.7.1","id":"60201d5d811ce"} |
@rullzer I hope this helps. Web server errorError: Error: hash_equals(): Expected user_string to be a string, bool given at /var/www/nextcloud/lib/private/Security/Crypto.php#138
Web server errorError: hex2bin(): Hexadecimal input string must have an even length at /var/www/nextcloud/lib/private/Security/Crypto.php#127
Web server errorError: hex2bin(): Input string must be hexadecimal string at /var/www/nextcloud/lib/private/Security/Crypto.php#125
|
@rullzer Looks like this happens to me when i sync files for example i had a user log into a new computer and had them sync all there files and by error log went crazy with these errors. |
@axheli I can confirm this, this only happens to me when the Nextcloud desktop client is used, but regardless if it's a new computer or not. |
I would say the same just notice it more when it's doing a sync of everything then a file here and there |
For #23197 Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Ok I'm out of ideas why this is not being caught with the throwable.... let me add manual checks and give you a patch |
I ran into the same issue and did a little digging and read some of the code. First off the setup and history: In the first versions of files_encryption the keys used to be just binary blobs (spoiler: some of them may contain 2 or 3 '|' chars at random offsets). At some point the format was changed to something like "hex-encoded payload|binary IV|HMAC" and later "hex-encoded payload|hex-encoded IV|hex-encoded HMAC|version number". For this, suppose the current key is of the binary variant and contains 2 or 3 '|' chars. The check L121 passes, no exception is thrown. For even length strings containing garbage (i.e. stuff different from [0-9a-f]) false is returned by hex2bin. @rullzer: is there documentation for the previous key formats? Field lengths etc. may help writing useful checks as to what the keyformat actually is. Just checking for [0-9a-f|] was my first idea, but that doesn't work, since for some time the IV used to be binary (which doesn't make any sense btw). I'm not really familiar with the code, structure and architecture of NC, I just read some of the relevant parts after users started complaining after the last update. I have noticed some more problems with crypto, namely user keys (private and public). This should probably go to a separate bug report. The short version: looks like NC is trying to migrate user keys to the format "hex-encoded payload|hex-encoded IV|hex-encoded HMAC|version number". However, something goes terribly wrong. I have one user who's keys now are somewhat largish and invalid. Keys in this format now are private: 627204bytes, public 127236bytes. This affects multiple accounts, including my own non-admin account. Also, for some requests user private keys get logged in the traces. This is very bad as well. In short: NC20 MAJORLY BREAKS CRYPTO for older setups. I've put the instance in maintenance mode and disabled the cron job to prevent it from breaking more stuff. |
So no fix on this? |
Im on 20.0.8 and also getting the same error after Upgrade from NC 19 to NC 20. |
I have this problem too on NC 20.0.8 but mostly on empty or very small files (1 Byte). My experience with server side encryption is very bad and I can't recommend it to anyone. Especially because it is treated like a stepchild by NextCloud if at all! |
Does anyone have a fix for this? |
I'm on NC 21.0.1 and I also have these issue with Crypto.php Error: hash_equals(): Expected user_string to be a string, bool given at /www/htdocs/[xxx]/lib/private/Security/Crypto.php#146 | | 2021-04-21T20:17:29+0200 it seems to occur in combination with Fatal | webdav | OCP\Encryption\Exceptions\GenericEncryptionException: Bad Signature I also get lot of Couldn't re-calculate unencrypted size for files_versions/... for a lot of files... What shall I do? Cheers, |
@t52lE4MWEcgCx looks like the Explicitly check hex2bin input #25714 has not been merged so until then you might get these errors. Can we please get this pull request merged? |
Thanks for that hint. I applied the suggested changes to Crypto.php Any idea about the Fatal | webdav | OCP\Encryption\Exceptions\GenericEncryptionException: Bad Signature problem as well? Cheers, |
This comment has been minimized.
This comment has been minimized.
Fixed with #25714 |
For #23197 Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
For #23197 Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
For #23197 Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
How to use GitHub
Steps to reproduce
Getting the following error:
NC 20
Apache2
PHP 7.4.10
hex2bin(): Input string must be hexadecimal string at /var/www/nextcloud/lib/private/Security/Crypto.php#125
hex2bin(): Hexadecimal input string must have an even length at /var/www/nextcloud/lib/private/Security/Crypto.php#127
Web server error 1
Error: hash_equals(): Expected user_string to be a string, bool given at /var/www/nextcloud/lib/private/Security/Crypto.php#138
Web server error 2
Error: hex2bin(): Input string must be hexadecimal string at /var/www/nextcloud/lib/private/Security/Crypto.php#127
Web server error 3
Error: hex2bin(): Hexadecimal input string must have an even length at /var/www/nextcloud/lib/private/Security/Crypto.php#125
The text was updated successfully, but these errors were encountered: