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
processor
withinrun_decoder()
or the--processor
CLI flag.
2.5.3 - 2023-09-27
- Updated
kordesii.utils.yara
to handle changes made in YARA 4.3.0
2.5.2 - 2023-01-30
- Fixed bug in
idiv
opcode 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_calls
toProcessorContext.call_history
from rugosa. - Backported ability to stream emulated memory from rugosa.
2.4.1 - 2022-03-23
- function_tracing
- Added
PathAddBackslash
SHLWAPI 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
flask
andpygments
dependency.
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
.instruction
attribute to ProcessorContext. This returns anInstruction
object 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
fst
FPU 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.
Action
andObject
types are no longer imported within the base ofkordesii.utils.function_tracing
. They must be imported fromkordesii.utils.function_tracing.actions
andkordesii.utils.function_tracing.objects
respectively.
- Fix
ida_re.Match
to 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
--cleanup
flag 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_from
andcallees
properties tokordesii.utils.Function
object. - Added
is_64bit
option when running a decoder. This allows the user to force the use ofida64
orida
if option isTrue
orFalse
respectively. This option can also be set in the command line using the--64bit
or--32bit
flags.
- Added
.split()
function toEncodedString
class, 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
/jpo
opcodes 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_loops
flag. (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
FunctionArg
objects returned by theget_function_arg_objects()
function in the CPU context. (See documentation for more information.) - Added
passed_in_args
property in the CPU context which returns a list ofFunctionarg
objects for the arguments of the function the context is currently in. - Added
function_args
property in the CPU context which is a shortcut forget_function_arg_objects()
for the current call instruction. - Added
disable()
function inEmulator
which 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_ida
decorated function. run_in_ida
decorated functions can now execute otherrun_in_ida
decorated 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.registers
is 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
CustomBasicBlocks
toBasicBlocks
to be more consistent with other objects. - Passed in arguments that come from memory or the stack are now added to the
ProcessorContext.variables
attribute 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.Function
kordesii.utils.decoderutils.EncodedString
->kordesii.utils.EncodedString
kordesii.utils.decoderutils.EncodedStackString
->kordesii.utils.EncodedStackString
kordesii.utils.decoderutils.find_destination
->kordesii.utils.find_destination
kordesii.utils.decoderutils.re_find_functions
->kordesii.utils.ida_re.find_functions
kordesii.utils.decoderutils.yara_find_decode_functions
->kordesii.utils.yara.find_functions
kordesii.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
call
opcode.
- 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
FunctionTracer
andget_tracer()
in exchange for creating a global instance of anEmulator
object. 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
identifier
property 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.txt
file. - Removed previously deprecated components:
iter_functions()
inkordesii.utils.decoderutils
ProcessorContext.get_variable_name()
kordesii.utils.utils.IterApis()
decoderutils.INVALID
anddecoderutils.UNUSED
enumsdecoderutils.output_strings()
as_bytes
,byte_length
,calc_size()
,size
,get_bytes()
, anddecoded_string
inEncodedString
classbfs_iter_heads()
,bfs_iter_blocks()
,dfs_iter_heads()
, anddfs_iter_blocks()
infunction_tracing.Flowchart
decoderdir
,disabledebug
,list_decoders()
, andget_decoder_path()
inReporter
classget_errors()
,get_debug()
,error()
, anddebug()
inReporter
classkordesii-tool
,kordesii-client
,kordesii-server
, andkordesii-test
command line toolskordesii.tools.tool
,kordesii.tools.test
, andkordesii.tools.client
modulesdecoderutils.generic_run_yara()
kordesii.utils.idayara
modulepatch_decoded()
anddefine_string()
indecoderutils
get_segment_bytes()
,get_segment_start()
,IDA_MatchObject
, andIDA_re
inkordesii.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
--force
flag toTester
for 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_args
parameter is set forget_function_args()
or theforce
parameter 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()
setuptools
is 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
base
andindex
properties 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.decoderutils
is 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_addr
attribute toOperand
object. This attribute is the referenced memory address of an operand minus any indexing. (e.g. Theebp+var_8
from[ebp+ecx*2+var_8]
) - Added
variables
attribute 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
callers
andcalls_to
properties 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_calls
property toSuperFunc_t
which returns acollections.Counter
object that contains API function names and the number of times they are called in the given function. - Added
num_args
parameter 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 aFunctionSignature
object that allows for modification of the function signature before pulling argument values. (See documentation for more information.)
- Added
StackStringNG
decoder which usesfunction_tracing
to 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_DIR
environment 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
Memory
for a single character. - Removed
__alloca_probe
function 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
error
key in the API results now correctly contains a list of strings.
ProcessorContext.get_variable_name()
is deprecated in favor of using the newvariables
attribute.- The
IterApis()
class is deprecated in favor of usingiter_imports()
oriter_functions()
.
1.5.0 - 2019-06-20
- function_tracing:
- Created a global
TracerCache
that can be accessible using theget_tracer()
function.- (This removes the need for initiating your own tracer cache.)
- Added
operands
attribute toProcessorContext
object.- This attribute is a list of
Operand
objects 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
, andmovd
opcodes. - Ability to emulate the caller functions using the
depth
parameter. - 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 toEncodedString
andEncodedStackString
object. - Documentation for CPU Emulation
- function_tracing:
- Renamed
trace
andtrace_iter
inFunctionTracer
toget_operand_value
anditer_operand_value
to improve clarity and consistency. - The
get_operand_value
anditer_operand_value
no 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_data
function 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 inProcessorContext
will now default to a C string if size isn't provided.
- Renamed
- Calling
calc_size()
from theEncodedString
object is no longer necessary. Encoded data will automatically be extracted during initialization.
decoderutils.INVALID
anddecoderutils.UNUSED
enums are deprecated in exchange for usingNone
directly.decoderutils.output_strings()
is deprecated in exchange for calling.publish()
on theEncodedString
object.as_bytes
,byte_length
,calc_size()
,get_bytes()
, andsize
are deprecated in theEncodedString
object. Please access theencoded_data
anddecoded_data
attributes directly instead.- function_tracing:
bfs_iter_heads()
,bfs_iter_blocks()
,dfs_iter_heads()
, anddfs_iter_blocks()
inFlowChart
are all deprecated in favor of using theheads()
andblocks()
functions with the optionaldfs
parameter.
- Fixed issue with logs not being displayed if the log port was still bound to a previous process.
- function_tracing:
- Fixed bug with
shr
opcode - 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-filelist
option inkordesii test
. - Fixed issue with external decoder sources not being detected correctly.
1.4.0 - 2019-03-20
- New
seralizer
module.- Access via
kordesii.get_serializer()
, and set key/value pairs withserializer.set(key, value)
. - Retrieve serialized data from
Reporter
objects with theother_data
attribute 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
kordesii
which 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-source
flag. FunctionTracer
caching 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
decoderdir
attribute 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
disabledebug
attribute in the Reporter class is deprecated. Log level should be set using thelogging
library. - 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-tool
andkordesii-test
tools are deprecated in exchange for using the newkordesii
tool and will be removed in a future version.
- Fixed missing
log_config.yml
error.
1.3.0 - 2019-02-11
- Created
kordesii.decoder_entry
function 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.yara
which acts as a drop-in replacement foryara
that 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.tracing
kordesii.utils.function_tracingutils
- >kordesii.utils.function_tracing
kordesii.utils.kordesiiidautils
->kordesii.utils.utils
kordesii.utils.functioncreator
->kordesii.utils.function_creator
- Renamed and moved classes and functions:
kordesii.kordesiireporter.kordesiireporter
->kordesii.reporter.Reporter
kordesii.kordesiitester.kordesiitester
->kordesii.tester.Tester
- Removed
append_debug
fromkordesiiidahelper
in exchange for using Python's builtinlogging
functionality. - Moved the content of
kordesii.kordesiiidahelper
tokordesii
and provided easy import from within the rootkordesii
module. - Removed the need for decoders to end with
_StringDecode
.
- Old yara utility functions that have now been replace by
kordesii.utils.yara
decoderutils.generic_run_yara()
- All of
kordesii.utils.idayara
1.2.0 - 2018-10-31
function_tracingutils
utility used for emulation and tracing function parameters and operand values.- multi-process testing infrastructure
EncodedStackString
object that can be used for strings pulled from stack.factory
function inEncodedString
objectIDA_re
object 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_t
object - Improved codec detection and added better decoding safety for
EncodedString
object. - Testing now uses multiprocessing
decoded_string
attribute inEncodedString
object. Usedecoded_data
instead.- Moved
patch_decoded
anddefine_string
intoEncodedString
object.
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.