All notable changes to this project will be documented in this file.
2.6.0 - 2023-11-30
- Added ability to set processor type using
processorwithinrun_decoder()or the--processorCLI flag.
2.5.3 - 2023-09-27
- Updated
kordesii.utils.yarato handle changes made in YARA 4.3.0
2.5.2 - 2023-01-30
- Fixed bug in
idivopcode emulation.
2.5.1 - 2022-12-01
- Removed the concept of hidden operands and instead allow all operands, both explicit and implied, to be accessed.
- Fix bug in ROL opcode implementation. (#35)
2.5.0 - 2022-09-14
- function_tracing
- Backported function call emulation from rugosa.
- Backported change from
ProcessorContext.func_callstoProcessorContext.call_historyfrom rugosa. - Backported ability to stream emulated memory from rugosa.
2.4.1 - 2022-03-23
- function_tracing
- Added
PathAddBackslashSHLWAPI hook (@ddash-ct)
- Added
- Updated to support IDA 7.7
- function_tracing
- Mask off any CSIDL flags before resolving folder in
SHGetFolderPath(@ddash-ct)
- Mask off any CSIDL flags before resolving folder in
- Removed unnecessary pinning of
flaskandpygmentsdependency.
2.4.0 - 2021-10-06
- function_tracing
- Added support for the ARM architecture. (NOTE: This is still in its beta stage, please report any issues.)
- Added
.instructionattribute to ProcessorContext. This returns anInstructionobject used to obtain dynamic information about the instruction the context is current pointing at. - Added support for replacing or adding the implementation of an instruction opcode using
hook_opcode(). (See documenation for more information.)
- function_tracing
- Changed signature for instruction hook callbacks.
- Callbacks should now accept only 2 arguments: the cpu context and instruction object.
- Refactorings to better support multiple architectures.
- Changed signature for instruction hook callbacks.
- Updated server dependencies.
- IDA Proxy utility is deprecated in favor of using dragodis.
- function_tracing
- Instruction hook callbacks using 4 parameters is deprecated and should be changed to the 2 parameter format: cpu context and instruction object.
- function_tracing
- Fixed bug in
fstFPU opcode causing astruct.error
- Fixed bug in
2.3.0 - 2021-06-04
- function_tracing
- Added recording of ChangeServiceConfig2A description actions.
- Added tracking for Service objects.
- Decoded strings in generated test cases are now alphabetized.
- function_tracing
- Modified the methodology to decompile functions to improve obtaining the function signature.
- Updated implementation for high-level object tracking to be based on recorded actions to improve performance and correctness.
- Updated implementation for action tracking to improve performance.
ActionandObjecttypes are no longer imported within the base ofkordesii.utils.function_tracing. They must be imported fromkordesii.utils.function_tracing.actionsandkordesii.utils.function_tracing.objectsrespectively.
- Fix
ida_re.Matchto return -1 when a capture group does not contribute to the match but is requested. - In IDA 7.6, imported functions are now function pointers, add checks accordingly. (@ddash-ct)
- Fixed bug in .idb file cleanup. The idb will now be properly cleaned up when the
--cleanupflag is set. (#30)- In order to better match expected default behaviour, cleanup will now be disabled by default.
2.2.0 - 2020-10-30
- function_tracing
- Added additional WinAPI function hook support
- Added recording of ShellOperation actions
- Added
calls_fromandcalleesproperties tokordesii.utils.Functionobject. - Added
is_64bitoption when running a decoder. This allows the user to force the use ofida64oridaif option isTrueorFalserespectively. This option can also be set in the command line using the--64bitor--32bitflags.
- Added
.split()function toEncodedStringclass, which replacesdecoderutils.split_decoded_string()
- function_tracing
- Fix to account for getting the correct function data using the operand even if the offset is invalid. This provides better support for dynamically resolved function calls. (@ddash-ct)
- Fixed typo in
jnp/jpoopcodes forfunction_tracing - Fixed incorrect handling of IDIV signed division
- General fixes to improve support when running under Linux.
kordesii.utils.split_decoded_string()is deprecated in favor of usingkordesii.utils.EncodedString.split()
2.1.0 - 2020-06-05
- function_tracing
- Added ability to follow loops during emulation by enabling the
follow_loopsflag. (See documenation for more information.) - Full subroutines can be emulated using
create_emulated()oremulate_call()(See documenation for more information.) - Added ability to modify the function arguments using the
FunctionArgobjects returned by theget_function_arg_objects()function in the CPU context. (See documentation for more information.) - Added
passed_in_argsproperty in the CPU context which returns a list ofFunctionargobjects for the arguments of the function the context is currently in. - Added
function_argsproperty in the CPU context which is a shortcut forget_function_arg_objects()for the current call instruction. - Added
disable()function inEmulatorwhich allows disabling unnecessary opcodes or function hooks. - Added WinAPI function hooks
- Added ability to set variable values retrieved from
ProcessorContext.variables - Added support for instruction hooks. (See documentation for more information.)
- Added support for more x86/64 opcodes: STD, SCAS*
- Created
kordesii.utils.iter_dynamic_functions()which iterates dynamically resolved function signatures. - Added recording of interesting actions and high level objects: Files and Registry Keys (See documentation for more information.)
- Added ability to follow loops during emulation by enabling the
- Input file paths in test cases now support environment variable expansion.
- Input file paths in test cases can include
{MALWARE_REPO}which will be replaced by the currently set malware repository path. - IDA Proxy
- The stack trace in IDA is now locally printed to stderr when an exception occurs in a
run_in_idadecorated function. run_in_idadecorated functions can now execute otherrun_in_idadecorated functions within the same module.
- The stack trace in IDA is now locally printed to stderr when an exception occurs in a
- function_tracing
- Getting and retrieving registers from
ProcessorContext.registersis no longer case insensitive. Register names must be all lower case. This was done in order to improve emulation speed.- However,
reg_read()andreg_write()are not affected by this.
- However,
- Renamed
CustomBasicBlockstoBasicBlocksto be more consistent with other objects. - Passed in arguments that come from memory or the stack are now added to the
ProcessorContext.variablesattribute after the first instruction of the function is emulated. - Updated
kordesii.utils.iter_functions()to include dynamically resolved function signatures. - Allow call operand type to be taken into account when pulling a function signature. This provides better support for dynamically resolved function calls. (@ddash-ct)
- Getting and retrieving registers from
- Moved functions and classes:
kordesii.utils.decoderutils.SuperFunc_t->kordesii.utils.Functionkordesii.utils.decoderutils.EncodedString->kordesii.utils.EncodedStringkordesii.utils.decoderutils.EncodedStackString->kordesii.utils.EncodedStackStringkordesii.utils.decoderutils.find_destination->kordesii.utils.find_destinationkordesii.utils.decoderutils.re_find_functions->kordesii.utils.ida_re.find_functionskordesii.utils.decoderutils.yara_find_decode_functions->kordesii.utils.yara.find_functionskordesii.utils.utils.*->kordesii.utils.*kordesii.utils.function_tracing.flowchart.FlowChart->kordesii.utils.Flowchart
- Remote logs using IDA proxy are now displayed.
- If a log level is passed into
kordesii.setup_logging()it will now be used set to the root logger for you. - function_tracing
- Fixed issue sometimes causing an incorrect stack cleanup when emulating the
callopcode.
- Fixed issue sometimes causing an incorrect stack cleanup when emulating the
- Old locations for moved functions and classes mentioned above are deprecated and will be removed in a future version.
- Deprecated
FunctionTracerandget_tracer()in exchange for creating a global instance of anEmulatorobject. This object just needs to be instantiated once on the top of your modules and is used in the same way as a function tracer but for any function. It is also used to apply call hooks.- See documentation for more information.
kordesii.utils.decoderutils.make_superfunc_t_from_matches()- The
identifierproperty inkordesii.utils.Function(renamed fromSuperFunc_t) is deprecated and should not be used.
- function_tracing
- Removed broken and unused
path_to_ea()function inFlowchart
- Removed broken and unused
2.0.1 - 2020-05-01
- Setup fixes for PyPi deployment
2.0.0 - 2020-02-20
- Dropped support for Python 2 and IDA versions <= 7.3
- Added support for Python 3 and IDA version 7.4 (in Python 3 mode)
- Removed
requirements.txtfile. - Removed previously deprecated components:
iter_functions()inkordesii.utils.decoderutilsProcessorContext.get_variable_name()kordesii.utils.utils.IterApis()decoderutils.INVALIDanddecoderutils.UNUSEDenumsdecoderutils.output_strings()as_bytes,byte_length,calc_size(),size,get_bytes(), anddecoded_stringinEncodedStringclassbfs_iter_heads(),bfs_iter_blocks(),dfs_iter_heads(), anddfs_iter_blocks()infunction_tracing.Flowchartdecoderdir,disabledebug,list_decoders(), andget_decoder_path()inReporterclassget_errors(),get_debug(),error(), anddebug()inReporterclasskordesii-tool,kordesii-client,kordesii-server, andkordesii-testcommand line toolskordesii.tools.tool,kordesii.tools.test, andkordesii.tools.clientmodulesdecoderutils.generic_run_yara()kordesii.utils.idayaramodulepatch_decoded()anddefine_string()indecoderutilsget_segment_bytes(),get_segment_start(),IDA_MatchObject, andIDA_reinkordesii.utils.utils
1.7.0 - 2020-01-15
NOTE: This is the last version to support Python 2 and IDA 7.0-7.3. The next release will only support Python 3 and IDA >= 7.4.
- Added
--forceflag toTesterfor adding or updating testcases to ignore errors if set. (@ddash-ct) - function_tracing:
- Added support for more x86/64 opcodes: AAA, AAD, AAM, AAS, CMC, CQO, CWD, POPF, POPFD, POPFQ, PUSHF, PUSHFD, PUSHFQ
- Added support for builtin functions: memchr, strpbrk, strchr, strstr
- Added experimental feature which allows you to run IDA code remotely. (See documentation for more information.)
- Changed
iter_functions()anditer_imports()functions to include matching functions with underscores or integer suffixes.- e.g.
iter_functions("memcpy")would match onmemcpy,_memcpy, and_memcpy_0
- e.g.
- function_tracing:
- If IDA fails to guess a function type, a function signature will now be forced using cdecl calling convention if the
num_argsparameter is set forget_function_args()or theforceparameter forget_function_signature(). This is useful for functions that were dynamically declared. - Segment data is now retrieved on-demand. This helps to greatly speed up emulation for samples containing large data segments.
- If IDA fails to guess a function type, a function signature will now be forced using cdecl calling convention if the
- Renamed and moved component:
kordesii.utils.utils.IDA_re()->kordesii.utils.ida_re.Pattern()kordesii.utils.utils.get_segment_bytes()->kordesii.utils.segments.get_bytes()kordesii.utils.utils.get_segment_start()->kordesii.utils.segments.get_start()
setuptoolsis now required for decoder package discovery. (This is no longer optional.)
ida_re.search()will now properly search all segments if a segment is not provided.- function_tracing:
- Fixed stack delta calculation in CALL opcode by using
get_sp_delta()when function data cannot be obtained. - Fixed bug in displacement operands to interpret
baseandindexproperties as signed integers. (@ddash-ct) - Fixed logic error in rotate and shift opcodes due to incorrectly placed parenthesis.
- Added a check to ensure stack variables have a non-zero base before being added to the context's variable set.
Memory.realloc()now appropriately copies the data from the previous address if a relocation occurs.
- Fixed stack delta calculation in CALL opcode by using
iter_functions()inkordesii.utils.decoderutilsis deprecated in favor of using the one inkordesii.utils.utils
1.6.1 - 2019-09-13
- Fixed typo in fpu computation opcodes causing an AttributeError. (@ddash-ct)
1.6.0 - 2019-09-10
- function_tracing:
- Added
base_addrattribute toOperandobject. This attribute is the referenced memory address of an operand minus any indexing. (e.g. Theebp+var_8from[ebp+ecx*2+var_8]) - Added
variablesattribute toProcessorContext. This object can be used to query variables that have been encountered during emulation. (See documentation for more information.) - Added initial support for x87 FPU registers and opcodes which involve loading, storing, and computing floating point numbers (e.g. FLD, FST, FADD)
- Warning: Internal opcodes like FLDENV and FSAVE as well as proper handling of rounding and stack faults are not fully supported.
- Added
callersandcalls_toproperties toSuperFunc_t.- These can be use to get the functions that call the given function and the addresses where the given function is called respectively.
- Added
api_callsproperty toSuperFunc_twhich returns acollections.Counterobject that contains API function names and the number of times they are called in the given function. - Added
num_argsparameter to*_function_args()functions which allows the user to force a specific number of arguments. Extra arguments not detected by the disassmbler will be assumed to be "int" type. - Added
get_function_signature()function toProcessorContext, which returns aFunctionSignatureobject that allows for modification of the function signature before pulling argument values. (See documentation for more information.)
- Added
StackStringNGdecoder which usesfunction_tracingto extract stack strings.- Added
iter_imports(),iter_exports(), andget_import_addr()functions tokordesii.utils.utils.
- Alternative IDA installation directory can now be provided with the
IDA_DIRenvironment variable. - Improved speed of CPU emulation.
- kordesii server is now implemented with Flask instead of Bottle.
- If using the server as a WSGI app, the app instance must be created with
the factory function
kordesii.tools.server.create_app().
- If using the server as a WSGI app, the app instance must be created with
the factory function
- Renamed
obtain_export_by_name()toget_export_addr() - Renamed
obtain_function_by_name()toget_function_addr()
- function_tracing:
- Fixed case sensitivity for function hook lookups.
- Fixed incorrect results that can occur when searching
Memoryfor a single character. - Removed
__alloca_probefunction hook since it was producing an incorrect return value and is no longer required. - Fixed incorrect overflow flag calculation in some opcodes.
- Fixed incorrect "sib" scale in operand displacement calculation.
- Emulating paths with parent blocks at an address greater than itself is now fully supported.
- The
errorkey in the API results now correctly contains a list of strings.
ProcessorContext.get_variable_name()is deprecated in favor of using the newvariablesattribute.- The
IterApis()class is deprecated in favor of usingiter_imports()oriter_functions().
1.5.0 - 2019-06-20
- function_tracing:
- Created a global
TracerCachethat can be accessible using theget_tracer()function.- (This removes the need for initiating your own tracer cache.)
- Added
operandsattribute toProcessorContextobject.- This attribute is a list of
Operandobjects for the current instruction (the instruction to be executed) that can be used to query the characteristics of the operand as well as extract a value or referenced memory address.
- This attribute is a list of
- Support for emulating some builtin C/C++ and Windows library functions
- Support for hooking custom functions with the
hook()function accessible fromFunctionTracer,TracerCache, or throughhook_tracers().- (See README for an example on how to hook a function.)
- Support for emulating
rep*instructions. - Support for
movdqa,movdqu, andmovdopcodes. - Ability to emulate the caller functions using the
depthparameter. - Ability to access the history of a given pointer within a context using
get_pointer_history() - Ability to access the original location of a pointer within a context using
get_original_location()
- Created a global
- Added
publish()function toEncodedStringandEncodedStackStringobject. - Documentation for CPU Emulation
- function_tracing:
- Renamed
traceandtrace_iterinFunctionTracertoget_operand_valueanditer_operand_valueto improve clarity and consistency. - The
get_operand_valueanditer_operand_valueno longer accepts a data type and now returns a tuple containing the context and value (just likeget_function_args).- This function returns either a contained value for operands like registers and immediates or a memory address
for memory references (e.g.
[rsi+8]). It is then up to the user to use theread_datafunction in the context to read out the data they need.
- This function returns either a contained value for operands like registers and immediates or a memory address
for memory references (e.g.
read_data()function inProcessorContextwill now default to a C string if size isn't provided.
- Renamed
- Calling
calc_size()from theEncodedStringobject is no longer necessary. Encoded data will automatically be extracted during initialization.
decoderutils.INVALIDanddecoderutils.UNUSEDenums are deprecated in exchange for usingNonedirectly.decoderutils.output_strings()is deprecated in exchange for calling.publish()on theEncodedStringobject.as_bytes,byte_length,calc_size(),get_bytes(), andsizeare deprecated in theEncodedStringobject. Please access theencoded_dataanddecoded_dataattributes directly instead.- function_tracing:
bfs_iter_heads(),bfs_iter_blocks(),dfs_iter_heads(), anddfs_iter_blocks()inFlowChartare all deprecated in favor of using theheads()andblocks()functions with the optionaldfsparameter.
- Fixed issue with logs not being displayed if the log port was still bound to a previous process.
- function_tracing:
- Fixed bug with
shropcode - Fixed issue with missing trailing null byte when extracting a little endian wide byte with
read_data()(#7) - Refactored memory controller to eliminate unexpected mapping errors.
- Fixed bug with
- Removed
find_unrefd_encoded_strings()function indecoderutils
1.4.1 - 2019-04-10
- Added more framework tests.
- Fixed tuple error when attempting to use the
--add-filelistoption inkordesii test. - Fixed issue with external decoder sources not being detected correctly.
1.4.0 - 2019-03-20
- New
seralizermodule.- Access via
kordesii.get_serializer(), and set key/value pairs withserializer.set(key, value). - Retrieve serialized data from
Reporterobjects with theother_dataattribute orget_serialized().
- Access via
- Support for using setuptool's entry_points to allow for formal python packaging of decoders. (See documentation for more information.)
- Ability to register decoder source(s) using
register_decoder_directory()orregister_decoder_package()functions. - Support for relative input paths in test cases.
- Created a new command line tool called
kordesiiwhich encompasses parsing and testing in one tool.- This tool simplifies and cleans up the old CLI flags and uses subcommands for better organization.
- Ability to set a parser source with
--parser-sourceflag. FunctionTracercaching withfunction_tracing.TracerCache
- "decodertests" folder has been moved to within the "decoders" folder and renamed "tests".
- Improved CPU emulation results by modifying necessary registers to satisfy jump conditions.
- Updated documentation!
- The
decoderdirattribute as well as thelist_decoders()andget_decoder_path()functions in the Reporter class have been deprecated in favor of the new decoder registration methods. - The
disabledebugattribute in the Reporter class is deprecated. Log level should be set using thelogginglibrary. - The
get_errors(),get_debug(),error(), anddebug()functions in Reporter are deprecated in favor of using the logging library to log and handle messages. - The
kordesii-toolandkordesii-testtools are deprecated in exchange for using the newkordesiitool and will be removed in a future version.
- Fixed missing
log_config.ymlerror.
1.3.0 - 2019-02-11
- Created
kordesii.decoder_entryfunction decorator to be used to wrap the decoder entry point function.- This replaces the need to create a
if __name__ == "__main__":condition statement.
- This replaces the need to create a
- Created
kordesii.utils.yarawhich acts as a drop-in replacement foryarathat effectively converts offsets to virtual addresses.- This is replaces many of the existing yara utility functions.
- Renamed IDA API function calls to the new 7.* snake_case names. This removes the need to enable
their compatibility layer:
AUTOIMPORT_COMPAT_IDA695 - Renamed and moved modules:
kordesii.utils.tracingutils->kordesii.utils.tracingkordesii.utils.function_tracingutils- >kordesii.utils.function_tracingkordesii.utils.kordesiiidautils->kordesii.utils.utilskordesii.utils.functioncreator->kordesii.utils.function_creator
- Renamed and moved classes and functions:
kordesii.kordesiireporter.kordesiireporter->kordesii.reporter.Reporterkordesii.kordesiitester.kordesiitester->kordesii.tester.Tester
- Removed
append_debugfromkordesiiidahelperin exchange for using Python's builtinloggingfunctionality. - Moved the content of
kordesii.kordesiiidahelpertokordesiiand provided easy import from within the rootkordesiimodule. - Removed the need for decoders to end with
_StringDecode.
- Old yara utility functions that have now been replace by
kordesii.utils.yaradecoderutils.generic_run_yara()- All of
kordesii.utils.idayara
1.2.0 - 2018-10-31
function_tracingutilsutility used for emulation and tracing function parameters and operand values.- multi-process testing infrastructure
EncodedStackStringobject that can be used for strings pulled from stack.factoryfunction inEncodedStringobjectIDA_reobject used to perform regex searching with offsets converted to virtual addresses.
- Moved support from IDA 6.* to 7.*
- (Stick to version 1.1.* for IDA 6.* support)
- Improvements to
SuperFunc_tobject - Improved codec detection and added better decoding safety for
EncodedStringobject. - Testing now uses multiprocessing
decoded_stringattribute inEncodedStringobject. Usedecoded_datainstead.- Moved
patch_decodedanddefine_stringintoEncodedStringobject.
1.1.0 - 2018-04-11
- This CHANGELOG
- Tagged releases.
- Code cleanup and bugfixes
- Overhaul functioncreator algorithms (this changes the function names)
- Speed improvements and code simplification to tracingutils
- Initial contribution.