nilsteampassnet / TeamPass

Collaborative Passwords Manager
https://www.teampass.net
1.65k stars 537 forks source link

PHP Fatal error: Uncaught Defuse\\Crypto\\Exception\\BadFormatException: Encoded data is shorter than expected #3547

Open Nachtlichtermeer opened 1 year ago

Nachtlichtermeer commented 1 year ago

Steps to reproduce

  1. Upgrade to 3.0.0.23 (Git-commit 61bd0d651d3485c8015d3f6479b12606873c61b4)
  2. Login as admin at /install/upgrade.php

Expected behaviour

Admin-Login for upgrade should work

Actual behaviour

Admin-Login for upgrade stuck after login

Server configuration

Operating system: Ubuntu 22.04

Web server: Apache 2

Database: MySQL

PHP version: 8.1

Teampass version: 3.0.0.23 (Git-commit 61bd0d651d3485c8015d3f6479b12606873c61b4)

Teampass configuration file:

Updated from an older Teampass or fresh install: Updated from 3.0.0.22 commit 0d0b3700aca3d49398995b32c0c155e3942b08cb

Client configuration

Browser: 110.0 (64-Bit)

Operating system: Ubuntu 22.04

Logs

Web server error log

[Thu Feb 23 11:18:13.074148 2023] [php:error] [pid 863] [client 172.20.1.71:54734] PHP Fatal error:  Uncaught Defuse\\Crypto\\Exception\\BadFormatException: Encoded data is shorter than expected. in /var/www/passwort-dev.foo.de/htdocs/teampass/includes/libraries/Encryption/Encryption/Encoding.php:225\nStack trace:\n#0 /var/www/passwort-dev.foo.de/htdocs/teampass/includes/libraries/Encryption/Encryption/Key.php(49): Defuse\\Crypto\\Encoding::loadBytesFromChecksummedAsciiSafeString()\n#1 /var/www/passwort-dev.foo.de/htdocs/teampass/install/tp.functions.php(131): Defuse\\Crypto\\Key::loadFromAsciiSafeString()\n#2 /var/www/passwort-dev.foo.de/htdocs/teampass/install/tp.functions.php(171): defuseCryption()\n#3 /var/www/passwort-dev.foo.de/htdocs/teampass/install/upgrade_ajax.php(225): defuse_return_decrypted()\n#4 {main}\n  thrown in /var/www/passwort-dev.foo.de/htdocs/teampass/includes/libraries/Encryption/Encryption/Encoding.php on line 225, referer: https://passwort-dev.foo.de/install/upgrade.php

Log from the web-browser developer console (CTRL + SHIFT + i)

Uncaught SyntaxError: JSON.parse: unexpected end of data at line 1 column 1 of the JSON data
    complete https://foo/install/upgrade.php:216
    jQuery 6
    <anonymous> https://foo/install/upgrade.php:208
    jQuery 2
michelmarinho commented 1 year ago

Same problem here too. Same version 3.0.22 to last commit(3.0.23)

[Wed Feb 22 11:11:56.354569 2023] [php7:error] [pid 2658101] [client 177.50.206.200:54740] PHP Fatal error: Uncaught Defuse\Crypto\Exception\BadFormatException: Encoded data is shorter than expected. in /var/www/html/teampass/includes/libraries/Encryption/Encryption/Encoding.php:225\nStack trace:\n#0 /var/www/html/teampass/includes/libraries/Encryption/Encryption/Key.php(49): Defuse\Crypto\Encoding::loadBytesFromChecksummedAsciiSafeString()\n#1 /var/www/html/teampass/install/tp.functions.php(131): Defuse\Crypto\Key::loadFromAsciiSafeString()\n#2 /var/www/html/teampass/install/tp.functions.php(171): defuseCryption()\n#3 /var/www/html/teampass/install/upgrade_ajax.php(227): defuse_return_decrypted()\n#4 {main}\n thrown in /var/www/html/teampass/includes/libraries/Encryption/Encryption/Encoding.php on line 225

eerimias commented 1 year ago

Same problem upgrading from version 3.0.22 to 3.0.23.

useronkel commented 1 year ago

Same problem with latest commit #7634356

useronkel commented 1 year ago

Problem still exists, even with newest commit. TP is currently unusable

jussara-ti commented 1 year ago

Same problem here, upgrading from v3.0.0.22 to the latest version 3.0.2

AKorolkovs commented 1 year ago

Open includes/config/include.php add following string: define('SECUREFILE', 'teampass-seckey.txt'); problem will be resolved

jussara-ti commented 1 year ago

@AKorolkovs here it worked in the upgrade to the version 3.0.1 but in 3.0.2 I didn't have success

AKorolkovs commented 1 year ago

@jussara-ti I've upgraded version 2.0.27.36 to 3.0.2 recently and this helped me to resolve issue

Nachtlichtermeer commented 1 year ago

solution from @AKorolkovs works with latest commit f6416bd763f99b1016a3991c17a49efb0e853294 but it follows another error with MySQL