Skip to content
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

Updating TeamPass v2.x to 3.0.0.17 - Personal Folder - Fatal error: Uncaught Error: Call to a member function unlockKey() #3286

Open
rizi opened this issue Aug 18, 2022 · 2 comments

Comments

@rizi
Copy link

rizi commented Aug 18, 2022

Steps to reproduce

  1. Login to TeamPass
  2. Open an item within my personal folder
  3. TeamPass shows me the following info: "Teampass has been upgraded to a new version which includes a new encryption protocol. It expects from you to re-encrypt your personal items. For this, you need to provide your current Personal Salt Key (PSK). Once odne, please click on button Launch and wait until the process reached the final step. This could take several minutes depending on the number of objects."
  4. After entering the (correct) password and click Launch an error occurs

Expected behaviour

TeamPass should display the selected item (after it has upgraded it to the latest encryption protocol)

Actual behaviour

Even the password is correct (I know that because we still have the v2.x version running and there the pwd is accepted) I got the following error:
Fatal error: Uncaught Error: Call to a member function unlockKey() on string in C:\wamp\www\prd\teampass\sources\main.functions.php:284 Stack trace: #0 C:\wamp\www\prd\teampass\sources\main.queries.php(2395): defuse_validate_personal_key('test', 'def10000def5020...') #1 C:\wamp\www\prd\teampass\sources\main.queries.php(410): migrateTo3_DoUserPersonalItemsEncryption(33, 0, 100, 'test', Array) #2 C:\wamp\www\prd\teampass\sources\main.queries.php(152): keyHandler('user_psk_reencr...', Array, Array) #3 C:\wamp\www\prd\teampass\sources\main.queries.php(74): mainQuery(Array) #4 {main} thrown in C:\wamp\www\prd\teampass\sources\main.functions.php on line 284

Note: I used test as password because I don't post the real one on github ;)

I would be enough if I could remove all old items in my personal folder or re-create the personal folder.

Server configuration

Operating system: Windows NT SV-INT-RUM-02 10.0 build 17763 (Windows Server 2016) i586

Web server: Apache/2.4.52 (Win32) OpenSSL/1.1.1m mod_fcgid/2.3.9

Database: 5.7.19-log

PHP version: 7.4.30

Teampass version: 3.0.0.17

Teampass configuration file:

'max_latest_items' => '10',
'enable_favourites' => '1',
'show_last_items' => '1',
'enable_pf_feature' => '1',
'log_connections' => '1',
'log_accessed' => '1',
'time_format' => 'H:i:s',
'date_format' => 'd/m/Y',
'duplicate_folder' => '1',
'duplicate_item' => '1',
'number_of_used_pw' => '3',
'manager_edit' => '1',
'cpassman_dir' => 'C:/wamp/www/prd/teampass',
'cpassman_url' => 'https://<anonym_url>
'favicon' => 'https://<anonym_url>/favicon.ico',
'path_to_upload_folder' => 'C:/wamp/www/prd/teampass/upload',
'url_to_upload_folder' => 'https://teampass.uppersolutions.at/upload',
'path_to_files_folder' => 'C:/wamp/www/prd/teampass/files',
'url_to_files_folder' => 'https://teampass.uppersolutions.at/files',
'activate_expiration' => '0',
'pw_life_duration' => '0',
'maintenance_mode' => '0',
'enable_sts' => '0',
'encryptClientServer' => '0',
'cpassman_version' => '3.0.0.17',
'ldap_mode' => '1',
'ldap_type' => 'ActiveDirectory',
'ldap_suffix' => '@upper.local',
'ldap_domain_dn' => 'dc=upper,dc=local',
'ldap_domain_controler' => 'upper.local',
'ldap_user_attribute' => 'samaccountname',
'ldap_ssl' => '0',
'ldap_tls' => '0',
'ldap_elusers' => '0',
'richtext' => '0',
'allow_print' => '0',
'show_description' => '1',
'anyone_can_modify' => '1',
'anyone_can_modify_bydefault' => '1',
'nb_bad_authentication' => '0',
'utf8_enabled' => '1',
'restricted_to' => '0',
'restricted_to_roles' => '0',
'enable_send_email_on_user_login' => '0',
'enable_user_can_create_folders' => '0',
'insert_manual_entry_item_history' => '0',
'enable_kb' => '0',
'enable_email_notification_on_item_shown' => '0',
'custom_logo' => ' https://teampass.xxxx/includes/images/SOL_Logo_gray_360px.png',
'custom_login_text' => 'Bitte PRV User verwenden',
'default_language' => 'english',
'send_stats' => '0',
'get_tp_info' => '1',
'send_mail_on_user_login' => '0',
'nb_items_by_query' => 'auto',
'enable_delete_after_consultation' => '0',
'enable_personal_saltkey_cookie' => '0',
'personal_saltkey_cookie_duration' => '31',
'email_smtp_server' => '<removed>'
'email_smtp_auth' => 'false',
'email_auth_username' => '<removed>'
'email_auth_pwd' => '<removed>'
'email_port' => '25',
'email_from' => '<removed>'
'email_from' => '<removed>'
'pwd_maximum_length' => '40',
'delay_item_edition' => '0',
'allow_import' => '0',
'proxy_ip' => '',
'proxy_port' => '',
'upload_maxfilesize' => '10mb',
'upload_docext' => 'doc,docx,dotx,xls,xlsx,xltx,rtf,csv,txt,pdf,ppt,pptx,pot,dotx,xltx',
'upload_imagesext' => 'jpg,jpeg,gif,png',
'upload_pkgext' => '7z,rar,tar,zip',
'upload_otherext' => 'sql,xml',
'upload_imageresize_options' => '0',
'upload_imageresize_width' => '800',
'upload_imageresize_height' => '600',
'upload_imageresize_quality' => '90',
'use_md5_password_as_salt' => '0',
'ga_website_name' => 'TeamPass for ChangeMe',
'api' => '0',
'subfolder_rights_as_parent' => '1',
'show_only_accessible_folders' => '1',
'enable_suggestion' => '0',
'send_stats_time' => '0',
'tree_counters' => '0',
'item_extra_fields' => '0',
'enable_attachment_encryption' => '1',
'copy_to_clipboard_small_icons' => '1',
'settings_offline_mode' => '0',
'offline_key_level' => '0',
'can_create_root_folder' => '0',
'ldap_bind_dn' => 'sv-int-dc-02',
'ldap_bind_passwd' => 'brussels',
'menu_type' => 'context',
'item_duplicate_in_same_folder' => '1',
'roles_allowed_to_print' => '0',
'email_security' => 'none',
'enable_email_notification_on_user_pw_change' => '0',
'email_server_url' => '',
'otv_expiration_period' => '7',
'default_session_expiration_time' => '60',
'bck_script_filename' => 'bck_cpassman',
'bck_script_path' => 'C:/wamp/www/prd/teampass/backups',
'timezone' => 'Europe/Amsterdam',
'duo' => '0',
'google_authentication' => '0',
'enable_server_password_change' => '0',
'syslog_enable' => '0',
'syslog_host' => 'localhost',
'syslog_port' => '514',
'ldap_object_class' => '0',
'saltkey_ante_2127' => 'Raw7nCaC9SGCFAcUUqnJjFBeKAnC',
'teampass_version' => '2.1.27',
'migration_to_2127' => 'done',
'manager_move_item' => '1',
'create_item_without_password' => '0',
'send_statistics_items' => 'stat_country;stat_users;stat_items;stat_items_shared;stat_folders;stat_folders_shared;stat_admins;st',
'agses_authentication_enabled' => '0',
'personal_saltkey_security_level' => '0',
'ldap_new_user_is_administrated_by' => '0',
'ldap_port' => '389',
'enable_http_request_login' => '0',
'admin_2fa_required' => '1',
'otv_is_enabled' => '0',
'ldap_and_local_authentication' => '0',
'secure_display_image' => '1',
'upload_zero_byte_file' => '0',
'upload_all_extensions_file' => '0',
'files_with_defuse' => 'done',
'ldap_new_user_role' => '',
'disable_show_forgot_pwd_link' => '1',
'password_overview_delay' => '4',
'roles_allowed_to_print_select' => '',
'clipboard_life_duration' => '30',
'mfa_for_roles' => '',
'settings_tree_counters' => '0',
'enable_massive_move_delete' => '0',
'email_debug_level' => '0',
'ga_reset_by_user' => '',
'onthefly-backup-key' => '',
'onthefly-restore-key' => '',
'ldap_user_dn_attribute' => 'distinguishedname',
'ldap_dn_additional_user_dn' => 'OU=Privileged,OU=Users,OU=Vienna',
'ldap_user_object_filter' => '',
'ldap_bdn' => 'DC=Upper,DC=local',
'ldap_hosts' => 'sv-int-main-dc.upper.local',
'ldap_password' => '#OFyPLss#$58Kl',
'ldap_username' => 'CN=ldap-teampass,OU=Service Accounts,OU=Vienna,DC=Upper,DC=local',

Logs

Web server error log

Undefined variable: post_data - C:\wamp\www\prd\teampass\sources\main.queries.php (478)

Teampass 10 last system errors

removed for securit reason, only some duplicate keys (sql) exceptions.

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

Insert the log here and especially the answer of the query that failed.

There is noe error in the web-browser developer console.

@nratineau
Copy link
Contributor

@rizi Hi! Are you still having the issue?
If so can you edit the following file and retry:
sources/main.functions.php
replace line 282:

        $user_key = $protected_key_encoded->unlockKey($psk);

by

        $protected_key = new \Defuse\Crypto\KeyProtectedByPassword($protected_key_encoded);
        $user_key = $protected_key->unlockKey($psk);

@ServiceMRE
Copy link

I have the same problem, described in another problem, thanks to you, I think I found the solution.
You were almost right, except for the var name.
So the correct solution was:

In the file /source/main.functions.php, line 282:

replace :

    try {
        $user_key = $protected_key_encoded->unlockKey($psk);
        $user_key_encoded = $user_key->saveToAsciiSafeString();

by:

    try {
        $protected_key_encoded = \Defuse\Crypto\KeyProtectedByPassword::loadFromAsciiSafeString($protected_key_encoded);
        $user_key = $protected_key_encoded->unlockKey($psk);
        $user_key_encoded = $user_key->saveToAsciiSafeString();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants