My KeePass to LastPass Migration Woes!

, , 21 Comments

Preliminary

This blog post details the technical difficulties faced when trying to migrate from using KeePass to LastPass. KeePass has been an excellent password companion for the last 6 years and I’ve been using MiniKeePass for iOS, loading my password safe from Dropbox quite happily. But since starting to use a Chromebook I’ve been increasingly frustrated in this area. There are a few Chrome extensions that provide access to KeePass. CKP has 4.5 stars in the Chrome app store, but I’ve found this browser extension clunky and annoying to say the least. Manual search in CKP doesn’t work properly and despite the good reviews overall the experience in my opinion is poor. Not to mention it only gives read-only access to the password safe.

So I finally bit the bullet and decided to migrate to LastPass, after months of frustration trying to access my password safe from ChromeOS.

Here I document my migration woes, for no other reason than to provide help to anyone who might be googling for this info!

The import

LastPass supports importing from KeePass. You have to export to XML then upload the XML. Sounds simple, but fraught with the following problems.

Tip #1: use Firefox. Don’t question this, just install Firefox and run the import in Firefox. This solves a lot of issues.

Tip #2: if you used folders in KeePass, consider exporting each folder as a separate XML file. If you export the whole database, the result is that *all* your folders will be in a top-level folder. There’s no obvious way to change this later.

Problem: import process hangs

Solution:

  • My KeePass database had a folder structure. As per Tip #2 above, split up your export into different XML files, one per top-level folder. To do this, right click on your folder in KeePass and there’s your option to export
  • The process can still hang, and I scoured the XML file for possible issues, however I learned after much trial and error that the hanging was random and not related to strange characters. Delete the folder that may or may not have been imported into LastPass by right-clicking on the folder in the web interface. Again – don’t attempt this in any other browser than Firefox, results are highly unreliable in Chrome! Then simply re-attempt to import. For me at least, it worked on the second or third try.

Problem: Items are imported as note ITEMS, not website ITEMS

I used KeePass to store credentials for websites, banking, etc., as well as other personal info like driver’s licence info etc.

LastPass stores items as different object types. Anything you import that had something in the URL field in KeePass will be stored into a website item. Anything else will become a “Secure Note” of type “General”.

So if you’re like me and didn’t really bother putting anything in the URL field in some / many / all of your entries in KeePass, you’ll need to do the following.

Screenshots

What you need to do is edit your XML file before importing to give the URL field some value. I gave mine this: http:/0 as if you accidentally attempt to launch the website we don’t want LastPass attempting to send your credentials to a website that actually exists like www.null.com (yes, it exists…)

To do the above, using Sublime Text Editor:

  • Remove leading whitespace from the XML file, otherwise the following step won’t work. Press Ctrl-H to find and replace, click the Regex button, and use this string ^[^\S\r\n]+ and make sure nothing is typed into the replace box. Replace all to remove leading spaces / tabs
  • You now want to find and replace all instances of the URL field where it’s blank, but not where it’s not. Find multiline string

<Key>URL</Key>
<Value />

with

<Key>URL</Key>
<Value>http://0</Value>

Use Ctrl-Enter to split the lines in the find and replace fields.

Now hit Replace, save the file, and try the import. This time you should notice the icon next to all items is not the purple pen (secure note), but the white box (website).

 

21 Responses

  1. Dan

    January 10, 2016 8:13 pm

    Huge thanks for the fix for importing items as notes. That was a large roadblock to successful migration!

  2. Jonas

    July 27, 2016 10:34 am

    As with Dan, thanks for the extremely helpful tips to avoid an import as a note!

  3. Dave

    December 30, 2016 12:57 pm

    Thanks for doing this investigation, and for posting about it.

    Is this still the state of the art?

  4. VB

    May 6, 2017 10:07 am

    Just googled my problem and found here a solution.
    Thank you random blogger that solved yet another problem of mine 😉

  5. Rodrigo

    December 2, 2017 8:11 pm

    Thank you! Very good workaround for this silly issue to import keepass data, also liked that regex, well done!!

  6. Petr 'PePa' Pavel

    May 15, 2018 11:27 am

    Just wanted to mention that LastPass now supports KeePass folders and I was able to process 1259 passwords in a single export.

    Also, it’s possible to replace empty urls without getting rid of the white space first.
    Open the xml file and directly use this regular expression in Sublime:
    Find: URL(\s+)
    Replace: URL$1http://0
    This deals with various indentation levels (the white space that Mat was removing).

  7. Petr 'PePa' Pavel

    May 15, 2018 11:29 am

    Eech, all tags have been removed 🙁 Let me try again.

    Just wanted to mention that LastPass now supports KeePass folders and I was able to process 1259 passwords in a single export.

    Also, it’s possible to replace empty urls without getting rid of the white space first.
    Open the xml file and directly use this regular expression in Sublime:
    Find: <Key>URL</Key>(\s+)<Value />
    Replace: <Key>URL</Key>$1<Value>http://0</Value&gt;
    This deals with various indentation levels (the white space that Mat was removing).

  8. gadfly1974

    June 21, 2018 4:44 pm

    Thank you! This is exactly what I needed.

    Exporting folder by folder and using Firefox was perfect!

  9. Giles Levy

    November 19, 2018 5:50 pm

    Only thing different for me was using \r\n for line break in Visual Studio.
    Otherwise, followed your directions and everything worked great – thank you!
    (Tried to do this last year without your help and gave up.)

  10. Kent Richardson

    March 9, 2020 5:47 am

    Highly recommend you go into your KeePass database maintenance and choose to delete all history one or more days old. I had MANY entries in KeePass with references in the History tab. What it does it copy every one of them into the Notes field in LastPass. I though it was dupe info, but it was the history. And, the one of the bottom is the current record. Fortunately, figured this out in my export of my smaller folders before I did my big websites folder.

  11. Boyd P

    March 10, 2020 11:09 pm

    Thank you!! This is amazingly still an accurate way to do this, 4 years later. Seriously, you would think LastPass had a better way of importing. The mind reels.

  12. Brian

    May 17, 2020 2:48 pm

    Helped a friend migrate from KeePass to LastPass recently. Import worked fine, but we found that all HISTORY from KeePass entries is imported in the notes field. Not a huge deal, but annoying to find a bunch of old junk in your password entries. Just a word of caution to others migrating. I’ve been unable to find a solution or workaround, so he’s just going with it for now and cleaning up old entries as he has time.

  13. RJ

    May 26, 2020 10:56 pm

    Wow, it’s concerning that all these issues are still relevant five years later. Another problem when importing from KeePass (even with this these workarounds) is that my KeePass notes for a given entry sometimes end up duplicated in LastPass. I could manually delete the duplications, but all of this has convinced me that I don’t trust LastPass with my sensistive data. Checking out other password managers instead.

Leave a Reply