Simple Loader (Alt. API Hashing)

This is a Simple DLL Loader that demonstrates alternatives to ror13 API hashing.

Project Files

How to use

cpl link loader.spec /path/to/file.dll out.bin %apihash="djb2"

Valid algorithms are: crc32, djb2, fnv1a, joaat, ror13, and sdbm.

Notes

loader.c is unchanged from our Simple DLL Loader project. What's different here is loader.spec. Instead of the command dfr "resolver" "ror13", we call "apihash.spec" %apihash. The call command loads another file and executes the callable label specified as its first argument.

Callable labels are defined as name.arch: in a .spec file. apihash.spec has x86 and x64 callable label definitions for crc32, djb2, fnv1a, joaat, ror13, and sdbm hashes.

apihash.spec uses redirect "hash_module" "algorithm_module" to redirect calls and references for the local function hash_module to our alternate API hashing implementation.

hash_function and hash_module are ror13 hashing functions used by LibTCG's findModuleByHash and findFunctionByHash to lookup Win32 APIs.

The hash_function contract is easiest. It expects a NULL-terminated ASCII string as its argument. The function simply walks individual bytes until the NULL terminator is encountered.

The hash_module contract is weirder. The module string is a UTF16-LE encoded MODULE.DLL string with a set length. This function must uppercase its argument (without modifying it) and walk the length count number of individual bytes.

apihash.c implements Crystal Palace DFR-compatible hash_function and hash_module for crc32, djb2, fnv1a, joaat, and sdbm algorithms.

Meta-Information

This project sets meta-information at the top of the loader.spec file (e.g., name, describe, author, etc.). This information isn't required. And, it doesn't affect how the .spec file works. It's purpose is to make a .spec file self-documenting and to support modular systems of .spec files. This information is interogable via cpl info, the Java API, and the JSON-over-HTTP sidecar server.

Conversation

License

This project is licensed under the BSD License.