Skip to main content

No project description provided

Project description

crackers: A Tool for Synthesizing Code-Reuse Attacks from p-code Programs

Build docs.rs

This package contains the Python bindings for crackers, a tool for synthesizing code-reuse attacks (e.g., ROP) built around the Z3 SMT Solver and Ghidra's SLEIGH code translator.

For more details, please refer to the GitHub project.

Usage

PyPI

The easiest way to use crackers is through the PyPI package. For every release, we provide wheels for [MacOS, Windows, Linux] x [3.11, 3.12, 3.13, 3.14].

A simple usage looks like the following:

import logging

from crackers.crackers import DecisionResult
from crackers.jingle import ModeledBlock, State

logging.basicConfig(level=logging.INFO)

from z3 import BoolRef, BoolVal, simplify

from crackers.config import (
    MetaConfig,
    LibraryConfig,
    SleighConfig,
    ReferenceProgramConfig,
    SynthesisConfig,
    ConstraintConfig,
    CrackersConfig,
)
from crackers.config.constraint import (
    RegisterValuation,
    RegisterStringValuation,
    MemoryValuation,
    PointerRange,
    CustomStateConstraint,
    CustomTransitionConstraint,
    PointerRangeRole,
)
from crackers.config.log_level import LogLevel
from crackers.config.synthesis import SynthesisStrategy


# Custom state constraint example
def my_constraint(s: State, _addr: int) -> BoolRef:
    rdi = s.read_register("RDI")
    rcx = s.read_register("RCX")
    return rdi == (rcx ^ 0x5A5A5A5A5A5A5A5A)


# Custom transition constraint example
def my_transition_constraint(block: ModeledBlock) -> BoolRef:
    # Dummy: always true
    return BoolVal(True)


meta = MetaConfig(log_level=LogLevel.INFO, seed=42)
library = LibraryConfig(
    max_gadget_length=8, path="libz.so.1", sample_size=None, base_address=None
)
sleigh = SleighConfig(ghidra_path="/Applications/ghidra")
reference_program = ReferenceProgramConfig(
    path="sample.o", max_instructions=8, base_address=library.base_address
)
synthesis = SynthesisConfig(
    strategy=SynthesisStrategy.SAT,
    max_candidates_per_slot=200,
    parallel=8,
    combine_instructions=True,
)

constraint = ConstraintConfig(
    precondition=[
        RegisterValuation(name="RDI", value=0xDEADBEEF),
        MemoryValuation(space="ram", address=0x1000, size=4, value=0x41),
        RegisterStringValuation(reg="RSI", value="/bin/sh"),
        CustomStateConstraint.from_callable(my_constraint),
    ],
    postcondition=[
        RegisterValuation(name="RBX", value=0x1337),
    ],
    pointer=[
        PointerRange(role=PointerRangeRole.READ, min=0x80_0000, max=0x80_8000),
        CustomTransitionConstraint.from_callable(my_transition_constraint),
    ],
)
config = CrackersConfig(
    meta=meta,
    library=library,
    sleigh=sleigh,
    specification=reference_program,
    synthesis=synthesis,
    constraint=constraint,
)
r = config.run()
match r:
    case DecisionResult.AssignmentFound(a):
        for g in a.gadgets():
            for i in g.instructions:
                print(i.disassembly)
            print()
        for name, bv in a.input_summary(True):
            print(f"{name} = {simplify(bv)}")

Research Paper

crackers was initially developed in support of our research paper, Synthesis of Code-Reuse Attacks from p-code Programs, presented at Usenix Security 2025.

If you found the paper or the implementation useful, you can cite it with the following BibTeX:

@inproceedings{10.5555/3766078.3766099,
author = {DenHoed, Mark and Melham, Tom},
title = {Synthesis of code-reuse attacks from p-code programs},
year = {2025},
isbn = {978-1-939133-52-6},
publisher = {USENIX Association},
address = {USA},
booktitle = {Proceedings of the 34th USENIX Conference on Security Symposium},
articleno = {21},
numpages = {17},
location = {Seattle, WA, USA},
series = {SEC '25}
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

crackers-0.6.4.tar.gz (76.2 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

crackers-0.6.4-cp314-cp314t-manylinux_2_28_x86_64.whl (1.7 MB view details)

Uploaded CPython 3.14tmanylinux: glibc 2.28+ x86-64

crackers-0.6.4-cp314-cp314t-manylinux_2_28_aarch64.whl (1.7 MB view details)

Uploaded CPython 3.14tmanylinux: glibc 2.28+ ARM64

crackers-0.6.4-cp314-cp314-win_amd64.whl (1.3 MB view details)

Uploaded CPython 3.14Windows x86-64

crackers-0.6.4-cp314-cp314-manylinux_2_28_x86_64.whl (1.7 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.28+ x86-64

crackers-0.6.4-cp314-cp314-manylinux_2_28_aarch64.whl (1.7 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.28+ ARM64

crackers-0.6.4-cp314-cp314-macosx_11_0_arm64.whl (1.5 MB view details)

Uploaded CPython 3.14macOS 11.0+ ARM64

crackers-0.6.4-cp313-cp313t-manylinux_2_28_x86_64.whl (1.7 MB view details)

Uploaded CPython 3.13tmanylinux: glibc 2.28+ x86-64

crackers-0.6.4-cp313-cp313t-manylinux_2_28_aarch64.whl (1.7 MB view details)

Uploaded CPython 3.13tmanylinux: glibc 2.28+ ARM64

crackers-0.6.4-cp313-cp313-win_amd64.whl (1.3 MB view details)

Uploaded CPython 3.13Windows x86-64

crackers-0.6.4-cp313-cp313-manylinux_2_28_x86_64.whl (1.7 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.28+ x86-64

crackers-0.6.4-cp313-cp313-manylinux_2_28_aarch64.whl (1.7 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.28+ ARM64

crackers-0.6.4-cp313-cp313-macosx_11_0_arm64.whl (1.5 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

crackers-0.6.4-cp312-cp312-win_amd64.whl (1.3 MB view details)

Uploaded CPython 3.12Windows x86-64

crackers-0.6.4-cp312-cp312-manylinux_2_28_x86_64.whl (1.7 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ x86-64

crackers-0.6.4-cp312-cp312-manylinux_2_28_aarch64.whl (1.7 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ ARM64

crackers-0.6.4-cp312-cp312-macosx_11_0_arm64.whl (1.5 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

crackers-0.6.4-cp311-cp311-win_amd64.whl (1.3 MB view details)

Uploaded CPython 3.11Windows x86-64

crackers-0.6.4-cp311-cp311-manylinux_2_28_x86_64.whl (1.7 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ x86-64

crackers-0.6.4-cp311-cp311-manylinux_2_28_aarch64.whl (1.7 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ ARM64

crackers-0.6.4-cp311-cp311-macosx_11_0_arm64.whl (1.5 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

File details

Details for the file crackers-0.6.4.tar.gz.

File metadata

  • Download URL: crackers-0.6.4.tar.gz
  • Upload date:
  • Size: 76.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.10.2

File hashes

Hashes for crackers-0.6.4.tar.gz
Algorithm Hash digest
SHA256 3b9f4495ef024bdf47bd96bc7e75349fa201e9bfd91d58a4d0293d15e3131b6d
MD5 93c5341fda851c6099cd0d8ab4596c5f
BLAKE2b-256 ecc68d6cfd7aa0d6252be7b35f8102c95ebf8475c19b7e304a660fbf74c7276f

See more details on using hashes here.

File details

Details for the file crackers-0.6.4-cp314-cp314t-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for crackers-0.6.4-cp314-cp314t-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 be686eaf698288c5ce6450e6ab74c5441e6f23396fabb1707863e0a36df2faa3
MD5 110a34724445429b9cea68760eb7a16f
BLAKE2b-256 5419e69b5b1de13a66e0e39951449834b10b48ecf00de15db14ff5f2cb424ec8

See more details on using hashes here.

File details

Details for the file crackers-0.6.4-cp314-cp314t-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for crackers-0.6.4-cp314-cp314t-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 b480767a45f54dcf6c80e15f3b74556b8cdb631c904686af2c1b8603534bf1b4
MD5 b80c1f76a9776a327c0434f755fea2a7
BLAKE2b-256 7a4428c8f2ac84a70ec00ec61d8fb6552f69f484d834d7fca7f0e37bb84ce916

See more details on using hashes here.

File details

Details for the file crackers-0.6.4-cp314-cp314-win_amd64.whl.

File metadata

File hashes

Hashes for crackers-0.6.4-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 75529d7ffe5468f6089d4f6fd7042f49295cd7fe7ad67d53215b66d0a97ed1ab
MD5 c9fbf5a02c7e52351d553fe2ed7e5005
BLAKE2b-256 7cb00a37aeff5b2c755402775146620ff8dabe6ea81823f503a9f11e37709492

See more details on using hashes here.

File details

Details for the file crackers-0.6.4-cp314-cp314-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for crackers-0.6.4-cp314-cp314-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 dd215875cb94e342476bc1e222daeaa0fb68c69dd280d814b84e243c466270d8
MD5 0dcf5bfad923ef41520c88933aa745cb
BLAKE2b-256 e386fcd502c8a445c4205b01a62ac813799df295b3418b17ce6c25034e82d5a4

See more details on using hashes here.

File details

Details for the file crackers-0.6.4-cp314-cp314-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for crackers-0.6.4-cp314-cp314-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 7e3b8e39f6a91b63a019dab65378e634d76d0a04b207176ca0e30f40938009a5
MD5 c7ea4491eabe24a288e8d863c858993e
BLAKE2b-256 1327c6d47d6e489df573711d8b2c2b23a59946a1ee59f2ea513db7e6e52a50d2

See more details on using hashes here.

File details

Details for the file crackers-0.6.4-cp314-cp314-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for crackers-0.6.4-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 dcb61b7dafcc2e556985419e4b6d5ede530e39d58fa72c3a21adcf17f6dbe231
MD5 084f3c45ff899ab48c031963f4bbfbeb
BLAKE2b-256 8d5dde09b223abe20f4e449b2dd3609db6b66abcc7aee58f5e2100e4a547f533

See more details on using hashes here.

File details

Details for the file crackers-0.6.4-cp313-cp313t-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for crackers-0.6.4-cp313-cp313t-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 3652120b74a3163f304d0bac1a520a7cd28fc28f1710700351238bcbe5f9d7ca
MD5 bae594741c0c8d5214c6e3ea653b2a9b
BLAKE2b-256 53b6b68dd08720b06b8fa732354ea67214ba7b6dfbc2a8ce0c1fbb6c5f596796

See more details on using hashes here.

File details

Details for the file crackers-0.6.4-cp313-cp313t-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for crackers-0.6.4-cp313-cp313t-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 414993fbdea4a37c9878727ebf2034c6aacc69cc17e1ceb90cdc983963767505
MD5 9b4083842aabab9f278362071350bfe6
BLAKE2b-256 d17b40550ddedfc915343d1dcc1998f24e4773c2be9794098121671dee11972a

See more details on using hashes here.

File details

Details for the file crackers-0.6.4-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for crackers-0.6.4-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 52caed2fe8b382a97b988e58971f2fcc16a7d04e7d8a48c216dd508ec610dc70
MD5 9db128c384d4d3052de388dde03c637e
BLAKE2b-256 918254aecdf640bd7fd5bcf8010126efa0c0e31ca55797fa91aec46bae306e4f

See more details on using hashes here.

File details

Details for the file crackers-0.6.4-cp313-cp313-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for crackers-0.6.4-cp313-cp313-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 07935b17c6ad39a1794cadf78ff29e1b81e9bc252114307f22928f45304e7f65
MD5 c321892b7ba1c40fc6a9d4f2a6b91780
BLAKE2b-256 03fefb61d522a64f4b6945e4e1ebf6fcd083afc16ce9912544d69ccaad1b41c6

See more details on using hashes here.

File details

Details for the file crackers-0.6.4-cp313-cp313-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for crackers-0.6.4-cp313-cp313-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 b46986fad5e21c0aa47f1a0f33a5e0a05d83cf345b6d0bc86b92aa1f0ac1dcbe
MD5 f7fe9d5e93ebab39f3ded8312f2bce8e
BLAKE2b-256 6754db24420a12ae9af82ba75620e25f971656dfa2d5b501cbf24a251163d6c1

See more details on using hashes here.

File details

Details for the file crackers-0.6.4-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for crackers-0.6.4-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 4886c75e4c3febbca4032b0b81774741975c6ab367c5c31e04bca9803d0ec445
MD5 09764fa2a1de2d770dc45f8faea57533
BLAKE2b-256 55929d3844bd57967fdb9d572073d54c15cc251fbcea74da97a87fba56453090

See more details on using hashes here.

File details

Details for the file crackers-0.6.4-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for crackers-0.6.4-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 67799f78383cee72973db1d3ac6e6c3b4492f36740ccfa70988ba18696f9720b
MD5 f7fe75e8e3d21ead7d7e4f6443a319b4
BLAKE2b-256 a83d427c335ca9659a492aaca26b9c1cb36e855af3065b870c67e8830e358af1

See more details on using hashes here.

File details

Details for the file crackers-0.6.4-cp312-cp312-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for crackers-0.6.4-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 d694462b76f04e5e60a02ef16c10dc0a100b3f4c0110d34fe96c4bd73aed38e1
MD5 caa9d241ae008a2df3e943e715c37019
BLAKE2b-256 0b49c39cc85be031ad087e3d5d5d1d5ba7d05291cfc52dc11d2b1da0f5181f39

See more details on using hashes here.

File details

Details for the file crackers-0.6.4-cp312-cp312-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for crackers-0.6.4-cp312-cp312-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 e2105a0047da5e6133902665cdd1e008def1fa5d5f45c7eb0feacc1f9bb63101
MD5 ca84f4cef1b72e7966df5147bfea15e7
BLAKE2b-256 091efb9a572c65fd16c37e8d6e35ad7ca98db86f72fa92828618d95cfcb5cf43

See more details on using hashes here.

File details

Details for the file crackers-0.6.4-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for crackers-0.6.4-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 4feffc136f4bbcdf8ee8e5dbaaa41c522f950bb196ddade50416aa3be15f72fc
MD5 74713b7b547c915cd5f62efec4917789
BLAKE2b-256 048f7cae800ee01ad7b389e66d0df3003ea1f713d0e643e0a141d909146b66d3

See more details on using hashes here.

File details

Details for the file crackers-0.6.4-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for crackers-0.6.4-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 c280ba5cf95936b1d55c973e5918da7b99d74afa72c35ec78c5e125fa0fa5061
MD5 96d904f764d3f48a732b50ae20e138d4
BLAKE2b-256 bb6506e979cad0a84828a1c16c79612487d52d9e2b131423259c939216fee067

See more details on using hashes here.

File details

Details for the file crackers-0.6.4-cp311-cp311-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for crackers-0.6.4-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 e6de4c47f6ec447e3aed030e77418082395a0646649ddabeb53defe2721d5247
MD5 cf889d8cac4314ddf7bbe98ea88bbb2a
BLAKE2b-256 7fa41d690f4f6665c396571a8676fa11a399a6c527b14342a1a7c815b933177d

See more details on using hashes here.

File details

Details for the file crackers-0.6.4-cp311-cp311-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for crackers-0.6.4-cp311-cp311-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 d41ecc59c5264a5dc01fc450bdec8df952b789440d4f3ee25b4102fa34595b48
MD5 ea72846738368d2c65aba735600187a5
BLAKE2b-256 7ed2c4b0019f7f7f29c983c331d648b78624df57fb2b8a7cb0e90499aadf9750

See more details on using hashes here.

File details

Details for the file crackers-0.6.4-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for crackers-0.6.4-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a2fbf972e626c9d42bb3049ccf41ce17104b1cf7a6506ba50e6be1a18fafe721
MD5 a20af4d6bf8fe79de60e8a84fd7b7664
BLAKE2b-256 f7598c3e6e79ef73bbccfa2a42e30d67d89cb4ee27e9f42eec4759be62523fa9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page