Git Product home page Git Product logo

keefarce's Introduction

KeeFarce

KeeFarce allows for the extraction of KeePass 2.x password database information from memory. The cleartext information, including usernames, passwords, notes and url's are dumped into a CSV file in %AppData%

General Design

KeeFarce uses DLL injection to execute code within the context of a running KeePass process. C# code execution is achieved by first injecting an architecture-appropriate bootstrap DLL. This spawns an instance of the dot net runtime within the appropriate app domain, subsequently executing KeeFarceDLL.dll (the main C# payload).

The KeeFarceDLL uses CLRMD to find the necessary object in the KeePass processes heap, locates the pointers to some required sub-objects (using offsets), and uses reflection to call an export method.

Prebuilt Packages

An appropriate build of KeeFarce needs to be used depending on the KeePass target's architecture (32 bit or 64 bit). Archives and their shasums can be found under the 'prebuilt' directory.

Executing

In order to execute on the target host, the following files need to be in the same folder:

  • BootstrapDLL.dll
  • KeeFarce.exe
  • KeeFarceDLL.dll
  • Microsoft.Diagnostic.Runtime.dll

Copy these files across to the target and execute KeeFarce.exe

Building

Open up the KeeFarce.sln with Visual Studio (note: dev was done on Visual Studio 2015) and hit 'build'. The results will be spat out into dist/$architecture. You'll have to copy the KeeFarceDLL.dll files and Microsoft.Diagnostic.Runtime.dll files into the folder before executing, as these are architecture independent.

Compatibility

KeeFarce has been tested on:

  • KeePass 2.28, 2.29 and 2.30 - running on Windows 8.1 - both 32 and 64 bit.

This should also work on older Windows machines (win 7 with a recent service pack). If you're targeting something other than the above, then testing in a lab environment before hand is recommended.

Acknowledgements

  • Sharp Needle by Chad Zawistowski was used for the DLL injection tesh.
  • Code by Alois Kraus was used to get the pointer to object C# voodoo working.

License

BSD License, see LICENSE file

keefarce's People

Contributors

denandz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

keefarce's Issues

Only selected database is dumped

Hi! Congratulations it is a great tool.
Below I describe a situation that is not really a problem but an improvement and I don't found anything about it in TODO section.

If a user have 2 or more databases only the database selected is dumped.

Workaround: I used a script to monitor the title of the window "KeePass.exe" process name to identify when victim selected another database.

Steps to reproduce:
1 - Install keepass with default settings;
2 - Create two databases with names: "database-01.kdbx" and "database-02.kdbx";
3 - Create different datas in each database;
4 - Run keefarce.exe, in selected database at a time.

Result: only database is dumped at a time and result file is superscript for each run.

No pre-compiled binaries for Linux?

I tried the x64.zip contents but was told

mono KeeFarce.exe 
Cannot open assembly 'KeeFarce.exe': File does not contain a valid CIL image.

Doesn't do anything

Hello,

I built this with Visual Studio 2015 Community on Windows 10, copied the DLLs into the dist\Debug\Win32 folder (where the KeeFarce.exe was created) and ran it normally and as an administrator. KeePass 2.29 was running unlocked at the time of all executions.

A window opened for a split second then disappeared. No new files created.

I then ran it via PowerShell several times, checking the %APPDATA% folder:

PS F:\Downloads\KeeFarce-master\KeeFarce-master\src\dist\Debug\Win32> .\KeeFarce.exe
[.] Injecting BootstrapDLL into 1424
CallExport: Could not get module Snapshot for remote process.
CallExport failed
[.] Done! Check %APPDATA%/keepass_export.csvPS F:\Downloads\KeeFarce-master\KeeFarce-master\src\dist\Debug\Win32> .\KeeF
arce.exe
[.] Injecting BootstrapDLL into 1424
CallExport: Could not get module Snapshot for remote process.
CallExport failed
[.] Done! Check %APPDATA%/keepass_export.csvPS F:\Downloads\KeeFarce-master\KeeFarce-master\src\dist\Debug\Win32> .\KeeF
arce.exe
[.] Injecting BootstrapDLL into 1424
CallExport: Could not get module Snapshot for remote process.
CallExport failed
[.] Done! Check %APPDATA%/keepass_export.csvPS F:\Downloads\KeeFarce-master\KeeFarce-master\src\dist\Debug\Win32>

But no file keepass_export.csv exists therein:


PS F:\Downloads\KeeFarce-master\KeeFarce-master\src\dist\Debug\Win32> cd $env:APPDATA
PS C:\Users\brian\AppData\Roaming> dir


    Directory: C:\Users\brian\AppData\Roaming


Mode                LastWriteTime         Length Name
----                -------------         ------ ----
d-----        4/26/2015  12:40 PM                Adobe
d-----        4/28/2015   6:58 AM                Apple Computer
d-----        4/26/2015   1:15 PM                Battle.net
d-----       10/31/2015   6:34 AM                Dropbox
d-----        8/20/2015  12:34 PM                inkscape
d-----       10/30/2015  11:06 PM                KeePass
d-----        4/28/2015   9:09 PM                Macromedia
d---s-       10/31/2015   7:37 AM                Microsoft
d-----       10/31/2015   9:01 AM                NuGet
d-----       10/30/2015  11:06 PM                vlc
-a----        8/20/2015   6:48 PM            600 winscp.rnd

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.