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 (
    BinaryFileSpecification,
    ConstraintConfig,
    CrackersConfig,
    LibraryConfig,
    MetaConfig,
    ReferenceProgramConfig,
    SleighConfig,
    SynthesisConfig,
)
from crackers.config.constraint import (
    CustomStateConstraint,
    CustomTransitionConstraint,
    MemoryValuation,
    PointerRange,
    PointerRangeRole,
    RegisterStringValuation,
    RegisterValuation,
)
from crackers.config.log_level import LogLevel
from crackers.config.specification import BinaryFileSpecification, RawPcodeSpecification
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)


pcode = """
RBX = COPY 0x1337:8
BRANCH *[ram]0xdeadbeef:8
"""

meta = MetaConfig(log_level=LogLevel.DEBUG, seed=42)
library = LibraryConfig(
    max_gadget_length=8, path="libnscgi.so", sample_size=None, base_address=None
)
sleigh = SleighConfig(ghidra_path="/Applications/ghidra")
reference_program = RawPcodeSpecification(raw_pcode=pcode)
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} = {hex(simplify(bv).as_long())}")

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.8.0.tar.gz (80.5 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.8.0-cp314-cp314t-manylinux_2_28_x86_64.whl (1.8 MB view details)

Uploaded CPython 3.14tmanylinux: glibc 2.28+ x86-64

crackers-0.8.0-cp314-cp314t-manylinux_2_28_aarch64.whl (1.8 MB view details)

Uploaded CPython 3.14tmanylinux: glibc 2.28+ ARM64

crackers-0.8.0-cp314-cp314-win_amd64.whl (1.4 MB view details)

Uploaded CPython 3.14Windows x86-64

crackers-0.8.0-cp314-cp314-manylinux_2_28_x86_64.whl (1.8 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.28+ x86-64

crackers-0.8.0-cp314-cp314-manylinux_2_28_aarch64.whl (1.9 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.28+ ARM64

crackers-0.8.0-cp314-cp314-macosx_11_0_arm64.whl (1.6 MB view details)

Uploaded CPython 3.14macOS 11.0+ ARM64

crackers-0.8.0-cp313-cp313t-manylinux_2_28_x86_64.whl (1.8 MB view details)

Uploaded CPython 3.13tmanylinux: glibc 2.28+ x86-64

crackers-0.8.0-cp313-cp313t-manylinux_2_28_aarch64.whl (1.9 MB view details)

Uploaded CPython 3.13tmanylinux: glibc 2.28+ ARM64

crackers-0.8.0-cp313-cp313-win_amd64.whl (1.4 MB view details)

Uploaded CPython 3.13Windows x86-64

crackers-0.8.0-cp313-cp313-manylinux_2_28_x86_64.whl (1.8 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.28+ x86-64

crackers-0.8.0-cp313-cp313-manylinux_2_28_aarch64.whl (1.9 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.28+ ARM64

crackers-0.8.0-cp313-cp313-macosx_11_0_arm64.whl (1.6 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

crackers-0.8.0-cp312-cp312-win_amd64.whl (1.4 MB view details)

Uploaded CPython 3.12Windows x86-64

crackers-0.8.0-cp312-cp312-manylinux_2_28_x86_64.whl (1.8 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ x86-64

crackers-0.8.0-cp312-cp312-manylinux_2_28_aarch64.whl (1.9 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ ARM64

crackers-0.8.0-cp312-cp312-macosx_11_0_arm64.whl (1.6 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

crackers-0.8.0-cp311-cp311-win_amd64.whl (1.4 MB view details)

Uploaded CPython 3.11Windows x86-64

crackers-0.8.0-cp311-cp311-manylinux_2_28_x86_64.whl (1.8 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ x86-64

crackers-0.8.0-cp311-cp311-manylinux_2_28_aarch64.whl (1.9 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ ARM64

crackers-0.8.0-cp311-cp311-macosx_11_0_arm64.whl (1.7 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

File details

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

File metadata

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

File hashes

Hashes for crackers-0.8.0.tar.gz
Algorithm Hash digest
SHA256 6146d48f6396c27708eeed9a51705ab3a0e403b098077462a696975b225eb8ee
MD5 1f9cdffeafa46857b0cb0ba573a0327f
BLAKE2b-256 017790fceeb15302b4fd85d5fc5a1316245c76dc386ac0c7af7fccf2c039650f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for crackers-0.8.0-cp314-cp314t-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 338b75faac0f75e057c49334724bd656e8521e5c94099da271f86ca14b3c526b
MD5 e6bcf5e27501002bae4e02f9b41a3b9f
BLAKE2b-256 e789889844e04f6f40a485e85aff73be4070a51099f64664a544bae8d7326057

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for crackers-0.8.0-cp314-cp314t-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 066902539d9328725bdd1ab4f939ed26932bd2721576ffb73d4b21fdfc8557d8
MD5 2851eb9bf3de1dc3942a0c79df6323e3
BLAKE2b-256 ffef6de58ec10c5405272b4ecf0608aacafd98e98ccd7eabd7e82047f0790bb1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for crackers-0.8.0-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 ad955fa4dafdb0142bb027636f4e7a31c7c18a2396dda8967608f6f9f3eead24
MD5 f3a9aa921627d5da49fb7f56e6ddf1bd
BLAKE2b-256 b72a80bfff3c69ceda63f5685300d9bf642a0e9814be2956424692fb63c99468

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for crackers-0.8.0-cp314-cp314-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 ac9a8dad4a405e6a59312af6118c00ad37870d7fd965a524124ec1ae758c2575
MD5 d31db7a9fab5791fd26069660231afb8
BLAKE2b-256 47c8ee8e1cfc15bf94beb8164e98bc29a29360a74ed7c22d2a1512b373e515a0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for crackers-0.8.0-cp314-cp314-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 dfb563c2d7cce0593c61b573bc177540e52229cbf5f625f3c1c9092035eedb78
MD5 1cd464051b8b4ea83e33b25bbe90296c
BLAKE2b-256 e70e753385347be27fbd455aa79339cba7e4f5e33444d8e92b986b8564029900

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for crackers-0.8.0-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 daf934d2348dd21d56459ab750b5a3753d4a746e33eacdcc48f81cb3ceb1240a
MD5 a05a936bf2cf6cf0989cc2d342ff31a8
BLAKE2b-256 edacfe9d128eb3e4b2e30eb62590b291075ea7954760149e08eada7f00e974c6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for crackers-0.8.0-cp313-cp313t-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 edbffa5c2bfc7d904bf4073c360434611fb7c9c7b07c8a5c7b0547420a021ee0
MD5 ce19121c12a3d3d943e3c9d36c828447
BLAKE2b-256 d10eb92bbf8feaca7e6dd2e0c61b384803b1ae4af1d460a4eedfe54af07e49a5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for crackers-0.8.0-cp313-cp313t-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 7f3c496ff19693ac0d0cd1b01801d045e937b68390c2a52faa03c867fbacc46d
MD5 b4a4d0b1dfbe8f3cfb75381ea5c77275
BLAKE2b-256 632a2db01132e941da9095a4d749865a7d4e4a55587e77c5807a31a8a40d1821

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for crackers-0.8.0-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 b3138a52338d759753838896ddb7de45ac0fa8660524f3185372996b43d11d88
MD5 5f41db6ec43be04fc4cd7bfb0fd4ec5c
BLAKE2b-256 836803428025eac305232ce87969d2d1d1af35bdbe125cb3ba4abc7f8b6c64b5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for crackers-0.8.0-cp313-cp313-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 b51f20f77638620a84d11c07cc1df2d709cbd2dd3a7d83e627293c0323d5365e
MD5 c1ff8ec0619d472380b2dd16f75d370f
BLAKE2b-256 08bea4d6e1f0ee60b4cc9a581892c48d9d87aea1954c8f80b26f87c9977f132f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for crackers-0.8.0-cp313-cp313-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 eaaf89efb4595ed745a6db978f8a5109b530b65bdf4d9ea7a31732c8109c0ff0
MD5 9ab0c1c29e06c1e977508dae716ecd07
BLAKE2b-256 9352400c1ef81da84d31def8dfbb63707a6a0a932f8543d617050c1b446dcfbd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for crackers-0.8.0-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 2cff1a752e9aea281c483991b337e21ae0af53f6b975d94324712e8a73fb95b6
MD5 d9aeb0ac428e06ce7dc13fbfa636b82b
BLAKE2b-256 d2a38c79f056c79fcdbe6c2bc056c9e4455e6b544e6bf84599ab153a4a4333ea

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for crackers-0.8.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 4598839cdb691c5092aa94f2db4101f8a06618dd5c7cad2a899c52b93a1958a0
MD5 304a7d85357a9920bc4f787e71f13406
BLAKE2b-256 d45068f35891ea88ba6c75b3f504e25e7089258bc51ed8ef2b8185164cb87384

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for crackers-0.8.0-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 2aa1601477ccf1770129ee0a24397ef7031ed749a90b29a330bef45f1b93d8cc
MD5 e26850a86db96cccac8ed05148276db3
BLAKE2b-256 db59cb660e989ba4f825c0206e591499278564555f604ecfcb396a3256179fcf

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for crackers-0.8.0-cp312-cp312-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 f5f6fcd5ae4397084392ce6f1a86ab54345b9767f87b23e995a8ec350ea52eca
MD5 1c5241d9990219cd8e332f736f461a18
BLAKE2b-256 8f34ba68f78f1286b2dc8c4e646f7c31b02211913623bddf5e6c63f818136b98

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for crackers-0.8.0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b8272db106a8ee2bb6435147852ef35f2ba8e3406f37bb1e5df784f7973c2b33
MD5 82dc2cf409696f4127d66c2572ad6577
BLAKE2b-256 dd996d81e15ff125c0072bbe955ad05cadefcb9826448f20b5be771dc68a73bf

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for crackers-0.8.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 d5bf9f51304aa7afb5151cd6275ce92826f2f85bd524f0a9a7633098c0e41d6d
MD5 1c38e89ae48485fac8753fd0ec543299
BLAKE2b-256 ce1e07712c3d15dd4c70ba88602ab09131f183271d847c8e54d29c2737d7396f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for crackers-0.8.0-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 b99fd1bf0b5c7504b578e35186876f4523bd928552a2795bbef13af33a511847
MD5 e25458375dad0b9e9e79f04b24c1c9fa
BLAKE2b-256 66848167ef09a7a39c845d805c8a846743f03b34b5651df32aa92fe931b8c602

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for crackers-0.8.0-cp311-cp311-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 010744b86925b732cde32e60f27eca7b1a433dde2aa88493878444ea7541fe3c
MD5 9e4ccfae4fc54107e029c5eae7041eb2
BLAKE2b-256 3a6ccf7d0946933660a47bd67fd65eba7f753122cf3ec5a1d97b2ac7174ff7cd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for crackers-0.8.0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 4c671f75ae6523a4589a32b2aa2b2d3bb9a12561ac86743cf4a22bba7255a831
MD5 6d8782c366f490cd110d40215b2306bb
BLAKE2b-256 1cad87a5bfe000c52fd5f399755c9576a71113ae45971935a9ca2003d3389cf3

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