Git Product home page Git Product logo

recmd's Introduction

RECmd

Ongoing Projects

  • Kroll Batch File - Development roadmap for the Kroll Batch File. Please feel free to contribute by adding ideas or by finishing tasks in the To Do column. Any help is appreciated!

Command Line Interface

RECmd version 1.6.0.0

Author: Eric Zimmerman ([email protected])
https://github.com/EricZimmerman/RECmd

Note: Enclose all strings containing spaces (and all RegEx) with double quotes

        d               Directory to look for hives (recursively). -f or -d is required.
        f               Hive to search. -f or -d is required.

        q               Quiet mode. When true, hide processing details. Default is FALSE

        kn              Display details for key name. Includes subkeys and values
        vn              Value name. Only this value will be dumped
        bn              Use settings from supplied file to find keys/values. See included sample file for examples
        csv             Directory to save CSV formatted results to. Required when -bn is used.
        csvf            File name to save CSV formatted results to. When present, overrides default name
        saveTo          Saves --vn value data in binary form to file. Expects path to a FILE
        json            Export --kn to directory specified by --json. Ignored when --vn is specified
        jsonf           File name to save JSON formatted results to. When present, overrides default name

        details         Show more details when displaying results. Default is FALSE

        Base64          Find Base64 encoded values with size >= Base64 (specified in bytes)
        MinSize         Find values with data size >= MinSize (specified in bytes)

        sa              Search for <string> in keys, values, data, and slack.
        sk              Search for <string> in key names.
        sv              Search for <string> in value names
        sd              Search for <string> in value record's value data
        ss              Search for <string> in value record's value slack
        literal         If true, --sd and --ss search value will not be interpreted as ASCII or Unicode byte strings
        nd              If true, do not show data when using --sd or --ss. Default is FALSE
        regex           If present, treat <string> in --sk, --sv, --sd, and --ss as a regular expression. Default is FALSE

        dt              The custom date/time format to use when displaying time stamps. Default is: yyyy-MM-dd HH:mm:ss.fffffff
        nl              When true, ignore transaction log files for dirty hives. Default is FALSE
        recover         If true, recover deleted keys/values. Default is TRUE

        vss             Process all Volume Shadow Copies that exist on drive specified by -f or -d . Default is FALSE
        dedupe          Deduplicate -f or -d & VSCs based on SHA-1. First file found wins. Default is TRUE

        sync            If true, the latest batch files from https://github.com/EricZimmerman/RECmd/tree/master/BatchExamples are downloaded and local files updated. Default is FALSE

        debug           Show debug information during processing
        trace           Show trace information during processing

Example: RECmd.exe --f "C:\Temp\UsrClass 1.dat" --sk URL --recover false --nl
         RECmd.exe --f "D:\temp\UsrClass 1.dat" --StartDate "11/13/2014 15:35:01"
         RECmd.exe --f "D:\temp\UsrClass 1.dat" --RegEx --sv "(App|Display)Name"

Documentation

Command line Registry access, including batch mode!

See the manual for more examples.

If you get an error message like "error loading plugin" when running RECmd after downloading the ZIP archive and extracting it using Windows' ZIP tool, use the following PowerShell command to unblock the DLLs:

PS> Unblock-File .\Plugins\*.dll

Batch Files

RECmd uses Batch Files to make your Registry output more actionable. Learn about Batch Files here!

As of September 2021, there is a README specifically for the Kroll_Batch file used by RECmd and KAPE. Find it here!

RLA

Command Line Interface

rla version 1.6.0.0

Author: Eric Zimmerman ([email protected])
https://github.com/EricZimmerman/RECmd

Note: Enclose all strings containing spaces (and all RegEx) with double quotes

        d               Directory to look for hives (recursively). -f or -d is required.
        f               Hive to process. -f or -d is required.

        out             Directory to save updated hives to. Only dirty hives with logs applied will end up in --out directory

        ca              When true, always copy hives to --out directory, even if they aren't dirty. Default is TRUE
        cn              When true, compress names for profile based hives. Default is TRUE

        debug           Show debug information during processing
        trace           Show trace information during processing

Example: rla.exe --f "C:\Temp\UsrClass 1.dat" --out C:\temp
         rla.exe --d "D:\temp\" --out c:\temp

Documentation

RLA is a single purpose tool to replay transaction logs in Registry hives. This is useful when parsing with tools that don't recognize and replay transaction logs on their own.

Download Eric Zimmerman's Tools

All of Eric Zimmerman's tools can be downloaded here. Use the Get-ZimmermanTools PowerShell script to automate the download and updating of the EZ Tools suite. Additionally, you can automate each of these tools using KAPE!

Special Thanks

Open Source Development funding and support provided by the following contributors:

recmd's People

Contributors

andrewrathbun avatar bmackalicious avatar dfirjos avatar ericzimmerman avatar esecrpm avatar karch4n6 avatar karneades 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

recmd's Issues

I am not getting results when I use reb files on macOS

** RECmd version # **
2.0.0.0

Describe the bug
I get no results when using reb files on macOS. It says it found 0 key/value pairs. The exact same command and package on Windows finds 546 key/value pairs.

They both find the same number of hives (on macOS and on Windows), and I know Registry parsing seems to be correct because I can use parameters like sd/sk to search content which works and returns expected results.

Command used:

dotnet /Tools/RECmd/RECmd.dll -d '/Cases/12345/Systems/ABC1/hives' --bn '/Tools/RECmd/AllRegExecutablesFoundOrRun.reb' --csv /Cases/12345/Systems/ABC1/RECmdOutput/RegEXEsFoundOrRun --nl

I'm running dotnet v6.0.101 on macOS Big Sur 11.6.5.

To Reproduce
Steps to reproduce the behavior:

  1. Run the above command on a folder containing Registry hives on macOS
  2. Results on Windows shows 546 identified key/value pairs, on macOS it shows none

Expected behavior
It should find the same key/value pairs as when ran on the same data on Windows.

get all information from hive

Is there a way extracting all information to a csv from a hive (including deleted keys and values.

i have tried
recmd.exe --f "myhive" --nl --csv "mycsv.csv" --recover --details --regex --sa *
recmd.exe --f "myhive" --nl --csv "mycsv.csv" --recover --details --regex --sa .*

but no result found

RLA --out parameter

** RECmd version # **
2.0.0.0

Describe the bug
RLA command line, does not correctly build the output directory.
Executed Command line: C:\tools\rla\rla.exe -f "C:\test_pinqp\DESKTOP-B3FG6UV\C\Windows\System32\config\SOFTWARE" --out "C:\test_pinqp\DESKTOP-B3FG6UV\C\Windows\System32\config\SOFTWARE\output"

To Reproduce
Steps to reproduce the behavior:

  1. Create output folder: mkdir "C:\test_pinqp\DESKTOP-B3FG6UV\C\Windows\System32\config\SOFTWARE\output"
  2. Execute RLA with file source and out parameter. Please see above.

Expected behavior
Expected to clean the dirty HIVE to the new folder defined in the --out parameter.

Screenshots
image

Additional context
Issue might be at line 535 and 536 of the source code:
var outFile = hiveToProcess.Replace(":", "").Replace(Path.PathSeparator.ToString(), "_");
var outFileAll = Path.Combine(@out, outFile);

RLA --out parameter behaviour with -f

RLA version #
2.0.0.0

Describe the bug
Note: As ever, an excellent tool and very grateful for all your efforts in creating and maintaining them!
RLA: when targeting a particular hive file with the -f parameter, the --out recreates the full directory path (not required in my use case).
Command line:
C:\DFIR\Tools\net6\rla.exe -f "E:\Testing\Hostname\Collection\Windows\System32\config\SAM" --out "E:\Testing\Hostname\Collection\Windows\System32\config\Clean"

I've read the other issue entries and saw your comments in issue #55 about preserving the source path, in case you were processing multiple NTUSER.dat files (as an example), and I concur with this logic for the -d switch. But, I think for the -f switch where you are specifying a particular file it doesn't work as well?

In my use case I am processing individual hives before running other tools on them seperately, so it is counter-productive for it to reproduce the full source path, for example the cleaned hive file gets output to the following directory:

E:\Testing\Hostname\Collection\Windows\System32\config\Clean\E\Testing\Hostname\Collection\Windows\System32\config

Note: If you can specify the paths using relative paths it seems to work (i.e. doesn't create the original source path), but I can't relative paths in my use case and have to use the full paths to each file / directory. e.g. I have my tools on C:\ and my artifacts on E:.

To Reproduce

  1. Copy a sample registry file to a directory
  2. Run C:\DFIR\Tools\net6\rla.exe -f "E:\Testing\Hostname\Collection\Windows\System32\config\SAM" --out "E:\Testing\Hostname\Collection\Windows\System32\config\Clean"
  3. Go to: E:\Testing\Hostname\Collection\Windows\System32\config\Clean
  4. Find the preserved source path directory structure and follow it down to the clean file: E:\Testing\Hostname\Collection\Windows\System32\config\Clean\E\Testing\Hostname\Collection\Windows\System32\config

Expected behavior
When using the -f switch I would expect the clean file to be output to the path specified without retaining the source path. Or have another switch that enables / disables the preservation of the original source path?

Screenshots
image

Unable to load live registry in RegExplorer 1.6

** RECmd version # **
1.6 RegExplorer

Describe the bug

Attempt to get an MFT record with an old reference, Error message: Attempt to get an MFT record with an old reference, Stack trace:    at DiscUtils.Ntfs.MasterFileTable.GetRecord(FileRecordReference fileReference)
   at DiscUtils.Ntfs.File.LoadAttributes()
   at DiscUtils.Ntfs.NtfsFileSystem..ctor(Stream stream)
   at RawCopy.Helper.VerifyFileSystemOpen(String path) in D:\Code\RawCopy\RawCopy\Helper.cs:line 457
   at RawCopy.Helper.RawFileExists(String path) in D:\Code\RawCopy\RawCopy\Helper.cs:line 141
   at RawCopy.Helper.GetFiles(List`1 fileNames, Boolean dedupe) in D:\Code\RawCopy\RawCopy\Helper.cs:line 65
   at RegistryExplorer.Forms.Main.<LoadHive>d__45.MoveNext() in D:\Code\RegistryViewerZ\RegistryViewerZ\Forms\Main.cs:line 885

To Reproduce
Steps to reproduce the behavior:

  1. Go to File, Live System, attempt to open SOFTWARE,SYSTEM, or current user hive
  2. No hive opens, messages shows error above

Expected behavior
Open live hives

RLA --out parameter

** RECmd version #
2.0.0.0

Describe the bug
RLA command line, does not correctly export to the output directory.
Command line: -d C:\temp\registry --out C:\temp\registry\output

To Reproduce
Create Output folder
Execute RLA with file source and out parameter. Please see above.

Expected behavior
Expected to clean the dirty HIVE to the new folder defined in the --out parameter.

This was previously identified and resolved in RLA --out parameter #47
#47

Screenshots
Screenshot 2024-01-25 160344

Batch file: How to find values with specific data

Malware uses new file associations with the exefile handler to bypass AVs. E.g. adding a registry key for .test under Classes and for the default value use exefile. I would like to add an entry to the Kroll batch file to find all file associations which use the exefile file handler (normally only one, the .exe one).

How should the entry look like in a batch file to iterate through all values for a given key and find those with specific data?

I added a Sigma rule for that https://github.com/Karneades/sigma/blob/master/rules/windows/registry_event/win_registry_file_association_exefile.yml or our team tweeted about that too https://twitter.com/swisscom_csirt/status/1463070008867704835

RLA

Command line: -d D:\test\DESKTOP-1\uploads\auto\C\Users\b --out D:\test\DESKTOP-1\uploads\auto\C\Users\b\t

    Hives found: 2
Processing hive D:\test\DESKTOP-1\uploads\auto\C\Users\b\NTUSER.DAT
Two transaction logs found. Determining primary log...
Primary log: D:\test\DESKTOP-1\uploads\auto\C\Users\b\ntuser.dat.LOG2, secondary log: D:\test\DESKTOP-1\uploads\auto\C\Users\b\ntuser.dat.LOG1
Replaying log file: D:\test\DESKTOP-1\uploads\auto\C\Users\b\ntuser.dat.LOG2
Replaying log file: D:\test\DESKTOP-1\uploads\auto\C\Users\b\ntuser.dat.LOG1
At least one transaction log was applied. Sequence numbers have been updated to 0x100A12. New Checksum: 0xAF344325
There was an error: Index was outside the bounds of the array.
System.IndexOutOfRangeException: Index was outside the bounds of the array.
   at rla.Program.DoWork(String f, String d, String out, Boolean ca, Boolean cn, Boolean debug, Boolean trace)

Processing hive D:\test\DESKTOP-1\uploads\auto\C\Users\b\AppData\Local\Microsoft\Windows\UsrClass.dat
Two transaction logs found. Determining primary log...
Primary log: D:\test\DESKTOP-1\uploads\auto\C\Users\b\AppData\Local\Microsoft\Windows\UsrClass.dat.LOG2, secondary log: D:\test\DESKTOP-1\uploads\auto\C\Users\b\AppData\Local\Microsoft\Windows\UsrClass.dat.LOG1
Replaying log file: D:\test\DESKTOP-1\uploads\auto\C\Users\b\AppData\Local\Microsoft\Windows\UsrClass.dat.LOG2
Replaying log file: D:\test\DESKTOP-1\uploads\auto\C\Users\b\AppData\Local\Microsoft\Windows\UsrClass.dat.LOG1
At least one transaction log was applied. Sequence numbers have been updated to 0x2C393. New Checksum: 0x449B1856
There was an error: Index was outside the bounds of the array.
System.IndexOutOfRangeException: Index was outside the bounds of the array.
   at rla.Program.DoWork(String f, String d, String out, Boolean ca, Boolean cn, Boolean debug, Boolean trace)

SAM information seems incorrect

Hi,

I'm currently doing an IR investigation and I'm planning on doing a check on all SAM registry files to see if all local admin passwords have been resetted, The REcmd tool is perfect for that, except that it seems to always show 'False' where the value is a boolean.

The version of REcmd that I'm using is '1.5.2.0' combine the command:
ReCmd.exe --f "D:\Registry\SAM_dc" --bn RECmd_Batch_MC.reb --csv D:\output

Raew5KB9wR

I've also attached a SAM registry file for convenience.
SAM.zip

Is this a bug?

I appreciate all your hard work on these tools, they have been very beneficial so far, thank you!

Registry batch reb files need a cleanup

This issue is not a feature request per se but a placeholder for a needed cleanup for the *ASEP batch examples. We have duplicates, similar keys in different files, different naming or categories for the same key... Also RegistryASEPs.reb includes all the others but not fully and we have differences between the files, e.g. some entries are only there and some only in the more specific files.

I don't think that rep includes are possible inside other .reb files (like compounds in Kape) but if we duplicate entries from the more specific into one generic "RegistryASEPs.reb" error occur or additions only made in one file.

We could of course remove RegistryASEPs.reb entirely to only have the specific files.

Question: What do you think? Do other work with those and see a value of fixing the differences?

https://github.com/EricZimmerman/RECmd/blob/master/BatchExamples/

  • RegistryASEPs.reb
  • SoftwareASEPs.reb
  • SystemASEPs.reb
  • ...

I think it is of value to cleanup them: remove duplicates, fix the differences, align the category names and keys to make the analysis easier. Furthermore, I would fix https://github.com/EricZimmerman/KapeFiles/blob/master/Modules/Registry/RECmd.mkape so either RegistryASEPs.reb is used or all the others, but not both (because of duplicated information).

If this place is wrong for such an issue, then please advice.

Ransomware warning

Hi I tried to use the program to investigate some registry files, but windows seems to automatically quarantine the file and warn for: "Ransom:Win32/WannaCrypt.A!rfn".

The file that it warns on is: "RegistryExplorer.exe"

Just want to let you know.

image

Get hive root with --bn

** RECmd version # **
2.0.0.0

Describe the bug
When using --kn, I can successfully use the alias "ROOT\*" to get all keys under the root path, without the need to know the root path name in advance. However, when using --bn, "ROOT" alias does not work.
Within the hive I'm analyzing, the root path is named "CsiTool-CreateHive-{00000000-0000-0000-0000-000000000000}" and the only method in which I was successful in fetching the data I wanted was defining:
KeyPath: CsiTool-CreateHive-{00000000-0000-0000-0000-000000000000}*

The results were:
image

To Reproduce
Mentioned above

Expected behavior
Mentioned above

Additional context
I hope I made sense

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.