TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

KeePass – questionable security

366 pointsby sdrapkinalmost 10 years ago
I&#x27;ve been a long-time user of KeePass. I inspected its 2.x .NET source code today and quickly noticed the following issues which I find quite concerning:<p>The kdbx database is encrypted with AES in CBC&#x2F;PKCS7 mode <i>without</i> proper authentication. HMAC is nowhere to be found in the code, other than when used for sha1-totp. There are SHA2 hashes that seem to guard the integrity of ciphertext, while these might catch a typical file corruption they will not prevent malicious tampering. Even if the hashes are used prior to encryption, that&#x27;s still MtE - not EtM.<p>KeePass likely does not have an online threat model, so attacks like Padding-Oracle might not be applicable, but a lack of AEAD is IMHO highly concerning because it indicates that the author(s) are winging it when it comes to doing crypto right.<p>Byte array comparisons are done with this function from MemUtil.cs:<p><pre><code> public static bool ArraysEqual(byte[] x, byte[] y) { &#x2F;&#x2F; Return false if one of them is null (not comparable)! if((x == null) || (y == null)) { Debug.Assert(false); return false; } if(x.Length != y.Length) return false; for(int i = 0; i &lt; x.Length; ++i) { if(x[i] != y[i]) return false; } return true; } </code></pre> There are many other questionable patterns, code smells, and &quot;I-invented-it&quot; approaches that indicate a non-expert .NET programming skill. They can&#x27;t even implement a Singleton correctly (see CryptoRandom.cs).<p>Has anyone ever done a security audit of KeePass 2.x or does everyone just believe that it&#x27;s &quot;good enough&quot;?<p>P.S. None of this detracts from the fact that KeePass is a very useful, free utility with a lot of effort put into it. I thank all contributors for making&#x2F;improving it over the years.

39 comments

tptacekalmost 10 years ago
I don&#x27;t know that an HN thread is the best venue to discuss crypto design flaws (you might be better off writing a POC of some kind and then publishing that), but yes, it is a little disquieting to see a sensitive application using AES without an authenticator.<p>To the many readers of this thread who believe they don&#x27;t care about the integrity of their password vault, just its confidentiality:<p>The problem is you can&#x27;t necessarily have confidentiality without integrity.<p>Sound cryptosystems that provide integrity checking rule out chosen ciphertext attacks against the cipher: in order to submit a ciphertext to such a system, you have to get past a cryptographically secure integrity check.<p>Without that check, attackers can feed a victim systematically corrupted ciphertexts, which the victim will dutifully decrypt, and observe the behavior of the victim in handling them. This is the basis for a whole family of &quot;error oracle&quot; side channel attacks.<p>You generally don&#x27;t want to trust the confidentiality of a cryptosystem that doesn&#x27;t check ciphertext integrity and rule out manipulated ciphertexts.<p>As the poster points out: this might matter a lot less for a system that runs purely offline. Or it might not. I lean towards &quot;not a super plausible attack vector&quot;. But who knows? Why be OK with bad crypto?
评论 #9727984 未加载
评论 #9730665 未加载
xenophonfalmost 10 years ago
&quot;On The Security of Password Manager Database Formats&quot; (<a href="https:&#x2F;&#x2F;www.cs.ox.ac.uk&#x2F;files&#x2F;6487&#x2F;pwvault.pdf" rel="nofollow">https:&#x2F;&#x2F;www.cs.ox.ac.uk&#x2F;files&#x2F;6487&#x2F;pwvault.pdf</a>) was a good review of KeePass, Password Safe, and others. As I understood it, only Password Safe provided both secrecy and data authenticity.
评论 #9727835 未加载
评论 #9728156 未加载
评论 #9728944 未加载
评论 #9727761 未加载
评论 #9729050 未加载
thompalmost 10 years ago
What about pass (<a href="http:&#x2F;&#x2F;www.passwordstore.org&#x2F;" rel="nofollow">http:&#x2F;&#x2F;www.passwordstore.org&#x2F;</a>)? No &quot;funky file formats&quot; -- just GPG and a convenient CLI.
评论 #9729035 未加载
评论 #9728753 未加载
评论 #9730069 未加载
评论 #9730696 未加载
FractalNervealmost 10 years ago
What about KeePassX? That&#x27;s what I&#x27;ve been using for a long time now. It&#x27;s not written in C#, but C++<p>EDIT: source: <a href="https:&#x2F;&#x2F;github.com&#x2F;keepassx&#x2F;keepassx" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;keepassx&#x2F;keepassx</a>
评论 #9727592 未加载
评论 #9728349 未加载
评论 #9727469 未加载
评论 #9727464 未加载
orahlualmost 10 years ago
These has been a security audit, ordered by the french ANSSI (French government IT Security agency). This audit resulted in a &quot;CSPN&quot; certificate, which basically means that 35 days were spent by a competent auditor (Thales), and no important vulnerabilities were found in KeePass 2.0 Portable.<p>Report: <a href="http:&#x2F;&#x2F;www.ssi.gouv.fr&#x2F;uploads&#x2F;IMG&#x2F;cspn&#x2F;anssi-cspn_2010-07fr.pdf" rel="nofollow">http:&#x2F;&#x2F;www.ssi.gouv.fr&#x2F;uploads&#x2F;IMG&#x2F;cspn&#x2F;anssi-cspn_2010-07fr...</a>
sdrapkinalmost 10 years ago
To those who don&#x27;t see a problem with leaking timing data:<p>KeePass goes to great lengths to do in-memory encryption of data. I&#x27;m not saying these attempts are properly done, but there is certainly no lack of trying.<p>The only reason to even bother is assume that this memory can be accessed by an attacker. So either you subscribe to that attack vector and thus must also accept the necessity of avoiding timing attacks, or you reject this threat vector and must question why KeePass engages in all kinds of memory-obfuscation security circus&#x2F;theater.
评论 #9728981 未加载
esseyealmost 10 years ago
Much like 4th page retractions on stories in newspapers, headlines will always win out in terms of the influence on the readers.<p>That said, the author of KeePass responded to all the discussions here over on the project forum at SourceForge.<p>Since a lot of people aren&#x27;t willing to even visit SF anymore, his notable responses were:<p>The header validation was fixed as of 2.20 in 2012<p>The singleton safety he was aware of, and it was only instanced prior to any threading of the application, so there could never be a thread safety issue. He has fixed this anyhow as the performance impact was minimal as of 2.30<p>The installers available via SF mirroring are signed by the author, so SF can not ever mess with them. They have no concerns about SF doing anything to their project.
negusalmost 10 years ago
Ok, your password database was affected by malicious modification. So what? How it can break the confidentiality of your data? Update: By the way, what&#x27;s wrong with the bytearray compare code snippet?
评论 #9727532 未加载
评论 #9727538 未加载
评论 #9727841 未加载
评论 #9727683 未加载
评论 #9727492 未加载
yc_Paulalmost 10 years ago
KeePass from version 1.24 &amp; 2.20 (in 2012) use header authentication to prevent data corruption attacks. <a href="http:&#x2F;&#x2F;keepass.info&#x2F;help&#x2F;kb&#x2F;sec_issues.html" rel="nofollow">http:&#x2F;&#x2F;keepass.info&#x2F;help&#x2F;kb&#x2F;sec_issues.html</a><p>cheers, Paul
TimWollaalmost 10 years ago
Apparently someone reported this thread to the author. You might want to follow the SourceForge issue: <a href="http:&#x2F;&#x2F;sourceforge.net&#x2F;p&#x2F;keepass&#x2F;discussion&#x2F;329220&#x2F;thread&#x2F;2eac8c83&#x2F;" rel="nofollow">http:&#x2F;&#x2F;sourceforge.net&#x2F;p&#x2F;keepass&#x2F;discussion&#x2F;329220&#x2F;thread&#x2F;2e...</a>
sdrapkinalmost 10 years ago
1. It would be nice if someone like CodesInChaos (ie. someone with both crypto <i>and</i> .NET expertise) were to casually audit the KeePass 2.x codebase and do a write-up.<p>2. It would be nice to create a kdbx 3.0 (ix. next-gen) storage format, which does proper AEAD.
sdrapkinalmost 10 years ago
Additional evidence of inadequate .NET implementation:<p>There is a ton of code &amp; pointless complexity to minimize the time sensitive data has to remain in plaintext in memory, and zeroing buffers asap. Clearly, the &quot;process memory compromise&quot; threat vector is taken very seriously by the authors.<p>Here&#x27;s a KeePass function that generates a key: <a href="https:&#x2F;&#x2F;github.com&#x2F;wrouesnel&#x2F;keepass&#x2F;blob&#x2F;master&#x2F;KeePassLib&#x2F;Keys&#x2F;CompositeKey.cs#L155" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;wrouesnel&#x2F;keepass&#x2F;blob&#x2F;master&#x2F;KeePassLib&#x2F;...</a><p>Does anyone see what the problem is? Hint: disposing &quot;ms&quot; in addition to closing will not fix the problem.<p>There are ~ 59 instances of this mistake in the codebase. The author(s) seem to come from c&#x2F;c++ background, and make all kinds of assumptions about how .NET works - except that .NET doesn&#x27;t work the way they think it works.<p>The generation of the Master Key: <a href="https:&#x2F;&#x2F;github.com&#x2F;wrouesnel&#x2F;keepass&#x2F;blob&#x2F;master&#x2F;KeePassLib&#x2F;Keys&#x2F;CompositeKey.cs#L243" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;wrouesnel&#x2F;keepass&#x2F;blob&#x2F;master&#x2F;KeePassLib&#x2F;...</a><p>Note that &quot;pbNewKey&quot; can be sitting in memory forever.<p>TL&#x2F;DR: KeePass memory protection is completely ineffective (I only speak for .NET implementation).
评论 #9743379 未加载
deltaecho1338almost 10 years ago
Thanks for your remarks on KeePass; I have at times been a heavy user. I&#x27;ve often wondered about its security (especially the security of its ports) but I don&#x27;t have the expertise to evaluate it myself. I&#x27;m not aware of any audits or systematic analyses as it hasn&#x27;t received the attention that mobile password managers have.<p>The truly paranoid keep their KeePass database in an encrypted volume used solely for that purpose.
negusalmost 10 years ago
Answering on whether somebody did an audit for KeePass <a href="http:&#x2F;&#x2F;keepass.info&#x2F;ratings.html" rel="nofollow">http:&#x2F;&#x2F;keepass.info&#x2F;ratings.html</a> I&#x27;m not sure but one may look at <a href="https:&#x2F;&#x2F;www.allianz-fuer-cybersicherheit.de&#x2F;ACS&#x2F;DE&#x2F;_downloads&#x2F;anwender&#x2F;software&#x2F;BSI-CS_003.html" rel="nofollow">https:&#x2F;&#x2F;www.allianz-fuer-cybersicherheit.de&#x2F;ACS&#x2F;DE&#x2F;_download...</a> and <a href="http:&#x2F;&#x2F;www.ssi.gouv.fr&#x2F;entreprise&#x2F;certification_cspn&#x2F;keepass-version-2-10-portable&#x2F;" rel="nofollow">http:&#x2F;&#x2F;www.ssi.gouv.fr&#x2F;entreprise&#x2F;certification_cspn&#x2F;keepass...</a>
hansimglueckalmost 10 years ago
The author is commenting on this thread here: <a href="http:&#x2F;&#x2F;sourceforge.net&#x2F;p&#x2F;keepass&#x2F;discussion&#x2F;329220&#x2F;thread&#x2F;2eac8c83&#x2F;" rel="nofollow">http:&#x2F;&#x2F;sourceforge.net&#x2F;p&#x2F;keepass&#x2F;discussion&#x2F;329220&#x2F;thread&#x2F;2e...</a><p>The issues raised in the thread are documented on his webpage here: <a href="http:&#x2F;&#x2F;keepass.info&#x2F;help&#x2F;base&#x2F;security.html" rel="nofollow">http:&#x2F;&#x2F;keepass.info&#x2F;help&#x2F;base&#x2F;security.html</a> <a href="http:&#x2F;&#x2F;keepass.info&#x2F;help&#x2F;kb&#x2F;sec_issues.html" rel="nofollow">http:&#x2F;&#x2F;keepass.info&#x2F;help&#x2F;kb&#x2F;sec_issues.html</a>
vixsomnisalmost 10 years ago
For anyone who has wanted to switch to KeePassX (to avoid mono dependencies, for instance), but needed the integration with keepasshttp, this project is active: <a href="https:&#x2F;&#x2F;github.com&#x2F;Ivan0xFF&#x2F;keepassx" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;Ivan0xFF&#x2F;keepassx</a><p>I haven&#x27;t switched yet to Ivan0xFF&#x27;s port yet (I&#x27;ve been using the auto-type based on window title). I may not actually switch, as the Pass project some others have posted here looks very good as a cross-platform solution (e.g., there is an android app and Firefox plugin) and there are scripts for converting existing databases to the new keystore.
评论 #9728863 未加载
anewhnaccountalmost 10 years ago
<a href="http:&#x2F;&#x2F;www.passwordstore.org&#x2F;" rel="nofollow">http:&#x2F;&#x2F;www.passwordstore.org&#x2F;</a>
评论 #9730037 未加载
评论 #9727777 未加载
评论 #9729182 未加载
snowwrestleralmost 10 years ago
Well it sounds like you just did a security audit of KeePass, albeit an incomplete and cursory one. But as a small open-source project, that&#x27;s probably better than they have now.<p>Have you considered submitting this analysis to the KeePass team? Or even better, analysis plus suggested code to fix the problems? As a user of KeePass this would be in your interest.<p>(And as a user of KeePass myself, it is in my interest to encourage experts to help that project out.)
Globzalmost 10 years ago
I have been a KeePass user for many years and I always used this in conjunction with a TrueCrypt container meaning that I keep my kdbx file inside the container.<p>Yes TrueCrypt isn&#x27;t &quot;safe&quot; but at this point it will take one highly motivated attacker to steal my &quot;important&quot; passwords.<p>Sadly I am not aware of any audits related to KeePass but I would be happy to read one!
评论 #9727577 未加载
评论 #9729631 未加载
indutnyalmost 10 years ago
Hello!<p>Nothing about KeePass, but recently I was wondering if I could write a software for deriving the keys from the master secret and seed (i.e. domain name or whatever).<p>Here is what I have came with:<p>* <a href="https:&#x2F;&#x2F;github.com&#x2F;indutny&#x2F;derivepass" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;indutny&#x2F;derivepass</a> * <a href="https:&#x2F;&#x2F;github.com&#x2F;indutny&#x2F;scrypt" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;indutny&#x2F;scrypt</a><p>It is using dump scrypt implementation (see the second link), and should be pretty easy to verify by cross-reading the source and the spec. Also, there is a boilerplate iOS application which is using `derivepass`&#x27;s derivation function and `scrypt` too.<p>Please let me know if you have any questions!
benkibbeyalmost 10 years ago
I&#x27;ve been working on a password manager for a while now. It&#x27;s been a learning experience in practically every way. I&#x27;m not a cryptographer but needed a couple features that the other password managers dont have, and would be too difficult to patch, so I wrote my own. KeePass is really good and user friendly, but like I said, is missing some things I need.<p>It&#x27;s hosted on sourceforge which I don&#x27;t plan on changing since they seem to have wisened up. If you want to try it out or help with development the project page is at <a href="http:&#x2F;&#x2F;sourceforge.net&#x2F;projects&#x2F;pwmd&#x2F;" rel="nofollow">http:&#x2F;&#x2F;sourceforge.net&#x2F;projects&#x2F;pwmd&#x2F;</a>.
Alohaalmost 10 years ago
This is why for work at least, I&#x27;ve kept to a spreadsheet on my workstation, the workstation uses full disk encryption, so I feel this is reasonably secure. For home, I&#x27;m nearly 100% apple, so I&#x27;m using keychain.
wumbernangalmost 10 years ago
It&#x27;s better than nothing and likely better than something without source.<p>Using the CLR which has no guaranteed memory zeroing and has immutable strings and GC and an exposed profiler and debugging APi is a larger concern IMHO.
评论 #9727500 未加载
评论 #9728066 未加载
评论 #9728537 未加载
stephengilliealmost 10 years ago
I suppose that using a random Android Keypass app is just asking for trouble.
clark800almost 10 years ago
Open source, open standard, generative password manager with &quot;two-factor&quot; security using both a passphrase and a private key file: <a href="http:&#x2F;&#x2F;rampantlogic.com&#x2F;entropass&#x2F;" rel="nofollow">http:&#x2F;&#x2F;rampantlogic.com&#x2F;entropass&#x2F;</a><p>It only uses the industry standard pbkdf2-sha512 hashing algorithm, with no encrypted database, so it is much simpler and isn&#x27;t susceptible to these kinds of issues.
评论 #9727957 未加载
INTPenisalmost 10 years ago
Keepass was never meant for corporate use, that much I am positive about. So personally I use gpg through the pass(1) script.<p>However, for corporate use I must recommend siptrack, a Django-based webbapp with a xmlrpc gui that tries not so much to replace keepass but rather racktables and keepass.<p>So it&#x27;s much more than password management but it uses pycrypto and doesn&#x27;t try to re-invent encryption. Future plans have it moving to pynacl too.
g5411704almost 10 years ago
If you are such a great expert .NET programmer what sees others errors, stop complaining and help him. You have his git and you can pull request.
Itsameeealmost 10 years ago
From my point of view, an authenticator (e.g. HMAC) is only necessary in case of a protocol-based transmission. -&gt; And no, I don&#x27;t mean to put the file (that is completly read first) on the dropbox. An authentication between the main memory and the CPU is obviously not required.
littlestitiousalmost 10 years ago
what is the problem with the singleton?
评论 #9728282 未加载
评论 #9727545 未加载
Grazesteralmost 10 years ago
Honest question. What&#x27;s wrong with the function? I have a similar function to ironically enough compare Hmacs in an encryption program I wrote in Java and C# When I release the source code for the java version I replaced my function with java&#x27;s own Arrays.equals though
评论 #9730179 未加载
RRRAalmost 10 years ago
What about KeePass 1.x?<p>And considering you can freely copy the database and someone corrupting your own is &quot;only&quot; going to result in you not being able to login, is that really a threat model that is more important with just encrypting everything so they can&#x27;t be read?
Cianticalmost 10 years ago
What are the alternatives really? I&#x27;d love to get rid of KeePass, it&#x27;s GUI is awful, it really doesn&#x27;t support OS X (unless some really technical person installs it). I&#x27;m unwilling to use commercial closed, cloud based password databases.
评论 #9730997 未加载
kevinSuttlealmost 10 years ago
Maybe ping the EFF? <a href="https:&#x2F;&#x2F;ssd.eff.org&#x2F;en&#x2F;module&#x2F;how-use-keepassx" rel="nofollow">https:&#x2F;&#x2F;ssd.eff.org&#x2F;en&#x2F;module&#x2F;how-use-keepassx</a>
Spooky23almost 10 years ago
Does this affect the older version of the format and KeePassX?
AlfaWolphalmost 10 years ago
Any opinion on Mitro?<p><a href="https:&#x2F;&#x2F;www.mitro.co&#x2F;" rel="nofollow">https:&#x2F;&#x2F;www.mitro.co&#x2F;</a>
rhaps0dyalmost 10 years ago
And I thought I was safe using Keepass on Dropbox.<p>Any recommendations for password managing?
评论 #9727854 未加载
评论 #9727866 未加载
评论 #9727725 未加载
评论 #9727974 未加载
orblivionalmost 10 years ago
&gt; online threat model<p>Unless you keep your encrypted password database on Dropbox.
voltagex_almost 10 years ago
Wargh, I use KeePass.
tiatiaalmost 10 years ago
It is so annoying. It must be something you know (Passcode), you are (Iris) or something you have (Key).<p>In case of Passwords, it is something you know. With limitations to the site (at least X Characters, small and capital, one number but not at the beginning, no number at the end, at least one special...). Some Banking sites even only allow a scary limited amount of characters (I think Schwab allows only 7 and no special characters).<p>Regarding a PW Manager: I found them all annoying and one has corrupted the PW database several times, resulting in a loss of the passwords.<p>My solution: A plain textfile with all my passwords. (I use Linux with an encrypted partition). If this is not secure enough for you, encrypt it with GPG.