Skip to main content

🫙 kavanoz 🫙

Statically unpacking common android banker malware. Ever wanted to get payload from packed malware without running android emulator ? Me neither.

👀 Installation

pip install kavanoz

To install from source, clone the repository and do an editable install with -e. Which means if you edit or add new plugins to the project it will be used without reinstalling.

git clone https://github.com/eybisi/kavanoz.git
cd kavanoz
pip install -e .

⚡ Usage

from cmdline

kavanoz /tmp/filepath

You can use -vvv parameter to print verbose logs. (useful for debugging plugins)

as python library

from kavanoz.core import Kavanoz
from kavanoz import utils

utils.set_log("DEBUG")
k = Kavanoz(apk_path="tests/test_apk/coper.apk")
for plugin_result in k.get_plugin_results():
    if plugin_result["status"] == "success":
        print("Unpacked")
        print(plugin_result)
        break

🐍 Scripts:

⚙️ Development

Make sure to install kavanoz as editable (with -e). To add new plugins just create new file in loader folder. Extend Unpacker class from unpack_plugin.py file. Define start_decrypt function with your implementation.

def start_decrypt(self, apk_object: APK, dexes: "list[DEX]"):

Add following function to make early exit from plugin.

def lazy_check(self,apk_object:APK, dexes: "list[DEX]"):

If extraction is successful assign self.decrypted_payload_path with extracted file path. You can use helper functions from unpacker class:

  • get_array_data
  • get_smali
  • find_method(class_name,method_name,descriptor="")
  • check_and_write_file(file_data) : checks file has dex, zip and zlib headers and writes unpacked dex with name : "external-{m[:8]}.dex"

Make sure to run python -m unittest before opening a PR. In order to get test apk files, use git lfs pull command.

📖 Tips

  • self.dexes hold dex objects. You can get class with dex.get_class(smali_annotation_of_class).
  • You can use get_smali function and give target method obj to get smali represantation of target method. Then apply some regex to get data from smali. There are lots of defined regexs in smali_regexes.py file to lookup.
  • Most of the time packers use file from asset folder. You can get files with self.apk_object.get_files()
  • Most of the time packers use Application class to start unpacking sequence. Use application = self.apk_object.get_attribute_value("application", "name") to get application class defined in manifest file.

Thanks:

apkdetect.com for unique samples to work with.

Metadata

Release files for kavanoz 0.0.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for kavanoz 0.0.6
File Size Uploaded Provenance Actions
kavanoz-0.0.6.tar.gz 431.8 kB Without provenance Details for kavanoz-0.0.6.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for kavanoz 0.0.6
File Interpreter ABI Platform Actions
kavanoz-0.0.6-py3-none-any.whl Python 3 none any Details for kavanoz-0.0.6-py3-none-any.whl

Total release size: 873.3 kB

Release files / kavanoz-0.0.6.tar.gz

Download URL kavanoz-0.0.6.tar.gz
Size 431.8 kB
Tags Source
SHA-256 checksum
How to use checksums
18cd374f58ca84bd5cea8325e4c11f940a9783146ba4da7df6c777dfd179d631
BLAKE2b-256 checksum
How to use checksums
3bbf93c721d70ce3c6e30108e71b5724d20d4a1c31f9b9d7096fa3c4b7a41321
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.9.21

Release files / kavanoz-0.0.6-py3-none-any.whl

Download URL kavanoz-0.0.6-py3-none-any.whl
Size 441.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a1e9e7af03745d74924f6977b8bfe42a92a3a4ada9e43074e7d9c01d671c2049
BLAKE2b-256 checksum
How to use checksums
c016784ab84660944e848800bc48b2b17eeda4302d633c27d1d4b236a1375e9a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.9.21

Security for kavanoz 0.0.6

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page