dlech / KeeAgent

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

Keepass crashes while decrypting private keys (most of the time) #382

Closed attisan closed 1 year ago

attisan commented 1 year ago

hi, since the last two updates (currently on 0.13.3.0) keepass will crash most of the time while keeagent is Decryping SSH Private Key (actually Decrypting #374) without further notice - it is just gone. How can I assist on debugging this problem? (I have about 20 entries).

dlech commented 1 year ago

You can build and run a debug version of KeePass + KeeAgent in Visual Studio, then we can see exactly where the crash is.

dlech commented 1 year ago

Or if you can create a new SSH key that triggers the crash and share it here I can have a look.

shadow00 commented 1 year ago

Can confirm, I have the same issue (since v0.13, iirc). It happens more frequently (in fact, almost certainly) when my cpu is already under high load (80-90%), to the point that I have to restart keepass several times before it succeeds. I don't think it's related to a specific key, because sometimes it crashes almost immediately, while other times it crashes towards the end (I have 13 ed25519 keys and 4 rsa-4096 keys, most of them with a short comment). It's almost as if it crashes when the operation is taking too long. However, I have no idea if the keys are always loaded in the same order or not, so I don't know for sure that it's not a specific key.

I'm about to try v0.13.4, will report back if I notice any difference.

dlech commented 1 year ago

I don't expect the new version to make a difference. Unless someone can share a database to reproduce the problem, we can't really make any progress here.

BWibo commented 1 year ago

I can confirm this. The issue could be the same as in #366.

BWibo commented 1 year ago

I managed to reproduce the crash with the test database attached. It resembles the SSH key situation in my original database:

Version info:

Here is the test database: crash.zip Password:

changeMe
BWibo commented 1 year ago

Any progress on this or anything else I can contribute to resolve this?

I'm using Windows Subsystem Linux 2 and the approach described here to use my SSH keys in WSL2. I am also runing Docker within the WSL2. Maybe this causes problems?

@attisan @shadow00: Are you using a similar setup?

A workaround that currently works for me is using KeepassCX with the native Windows 10 OpenSSH Agent. I needed to upgrade Windows 10 OpenSSH Agent (v 8.1, see here) to get this running.

attisan commented 1 year ago

@BWibo my use case for this module regards accessing linux servers through winscp and vscode (remote extension).

After reading what @shadow00 wrote, I'm now have something of a workaround - as I start my computer and leave it to boot and to "settle in" while I fetch my coffee before logging into windows 🙄. this way I have a rather good success rate. so it seems really tide to the CPU usage.

shadow00 commented 1 year ago

@BWibo I'm running an older version of Win10 and I use this in combination with Git Bash. No WSL.

But I'm pretty sure that the setup itself doesn't matter - I think it's an issue with the loading of the keys themselves.

Thanks for the suggestion to upgrade the windows openssh agent - sometimes I can't stop whatever I'm doing just to reduce the cpu load and get keeagent to start without crashing, so it would be nice to have KPXC as a backup for ssh too.

dlech commented 1 year ago

I am not able to reproduce the issue. I tried using the database from https://github.com/dlech/KeeAgent/issues/382#issuecomment-1418290359 and I used CpuStres to try to reproduce the suspected high CPU condition. All keys loaded without crashing. Using KeePass 2.53.1 and KeeAgent 0.13.4 on Windows 11 22H2.

dlech commented 1 year ago

I think I spoke too soon. After some more tries, I am able to get a crash.

dlech commented 1 year ago

Closing as duplicate of #366 since I am getting the same stack trace as reported there.