dlech / KeeAgent

ssh agent plugin for KeePass 2.x
http://lechnology.com/software/keeagent
Other
522 stars 35 forks source link

Keepass Portable version sometimes will crash when decoding keys #366

Closed minusInfinite closed 1 year ago

minusInfinite commented 1 year ago

This has been noticed when updating the Portable version use from 2.51.1 to 2.52 and KeeAgent from 12.x to 13.x

When opening a database with SSH keys set to be added to the agent on open after the last key is decoded KeePass will crash with the log events quoted below. This generally occurs after the first time the plugin complies and loads, the database is closed and reopened. It does not occur when KeeAgent is removed, or on my installed version at home. Clearing the Plugin Cache will often resolve the issue until the next time KeePass is reopened.

Log Name: Application Source: Application Error Date: 6/10/2022 7:11:35 AM Event ID: 1000 Task Category: (100) Level: Error Keywords: Classic User: N/A

Description: Faulting application name: KeePass.exe, version: 2.52.0.0, time stamp: 0x631afe2c Faulting module name: KERNELBASE.dll, version: 10.0.19041.1949, time stamp: 0xcb12e58e Exception code: 0xe0434352 Fault offset: 0x0000000000034fd9 Faulting process id: 0x4edc Faulting application start time: 0x01d8d8fad747890c Faulting application path: C:...\KeePass.exe Faulting module path: C:\WINDOWS\System32\KERNELBASE.dll Report Id: d364b654-9493-4fde-a80b-6b8eb167f152 Faulting package full name: Faulting package-relative application ID:

Log Name: Application Source: .NET Runtime Date: 6/10/2022 7:11:34 AM Event ID: 1026 Task Category: None Level: Error Keywords: Classic User: N/A

Description: Application: KeePass.exe Framework Version: v4.0.30319 Description: The process was terminated due to an unhandled exception. Exception Info: System.InvalidOperationException at System.ComponentModel.AsyncOperation.VerifyNotCompleted() at System.ComponentModel.AsyncOperation.Post(System.Threading.SendOrPostCallback, System.Object) at System.Progress`1[[System.Double, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].InvokeHandlers(System.Object) at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean) at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean) at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem() at System.Threading.ThreadPoolWorkQueue.Dispatch()

The only other plugin I use is KeePassNatMsg, I've tested this issue on a fresh download of KeePass Portable and only KeeAgent and a similar exception/crash will sometimes be experienced.

If I need to provide any other details or testing please let me know.

dlech commented 1 year ago

I don't see any KeeAgent code in this stack trace, so I'm not sure what could be done here.

minusInfinite commented 1 year ago

I've tested other options and found the database can be opened with an error while KeeAgent is set to Client Mode or Agent mode with the option to "Automatically Add Key to Agent on open/close" turned off from my keys. This appears to stop KeePass from crashing unless I load more than one key into the Agent.

Removing an added key and adding another into the agent will also cause the same crash.

When KeeAgent is in Client mode it doesn't appear to know if the ssh-agent service is running. I gather this is just not implemented yet and Pagent is the only option on Windows as an alternative agent.

BWibo commented 1 year ago

I am having a similar issue with Keepass Portable 2.52 and KeeAgent 0.13.2.0 on latest Win10 x64. When I open the database, Keepass sometimes crashes. I'm running the exact same setup on my Workstation and Laptop. The Laptop is much older and when I logon to windows it's under heavy load until all applications are loaded. I observed that the crash is much more likely to happen, when I try to open DB at that time. So it appears this could be somehow related to the current usage of my hardware resources. Is there any good guide on how to get logfiles for Keepass Portable fom Win10, then I can contribute logging here.

minusInfinite commented 1 year ago

Just to advise, 13.3 appear to have resolved this. I currenty don't have access to the computer I usually use portable on but I downloaded portable and this plugin and loaded multiple SSH key and expreenced no crash.

I'll advise if I continue to have any issues once I'm back using my other setup.

loeffelpan commented 1 year ago

I'm facing the same issues with native installed KeePass 2.52 and 0.13.3 KeeAgent, too. Removing KeeAgent from Plugin-folder resolves this. Windows eventlog shows the same error like in https://github.com/dlech/KeeAgent/issues/366#issue-1398387864.

I would like to provide log you need, to dig into this. Can you please show how to create those logs?

dlech commented 1 year ago

Can anyone provide an example database that triggers the crash?

BWibo commented 1 year ago

I create a test database and was able to reproduce the crash with it. It's here: https://github.com/dlech/KeeAgent/issues/382#issuecomment-1418290359