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.1.tar.gz (81.3 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.1-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.1-cp314-cp314t-manylinux_2_28_aarch64.whl (1.8 MB view details)

Uploaded CPython 3.14tmanylinux: glibc 2.28+ ARM64

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

Uploaded CPython 3.14Windows x86-64

crackers-0.8.1-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.1-cp314-cp314-manylinux_2_28_aarch64.whl (1.9 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.28+ ARM64

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

Uploaded CPython 3.14macOS 11.0+ ARM64

crackers-0.8.1-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.1-cp313-cp313t-manylinux_2_28_aarch64.whl (1.8 MB view details)

Uploaded CPython 3.13tmanylinux: glibc 2.28+ ARM64

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

Uploaded CPython 3.13Windows x86-64

crackers-0.8.1-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.1-cp313-cp313-manylinux_2_28_aarch64.whl (1.9 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.28+ ARM64

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

Uploaded CPython 3.13macOS 11.0+ ARM64

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

Uploaded CPython 3.12Windows x86-64

crackers-0.8.1-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.1-cp312-cp312-manylinux_2_28_aarch64.whl (1.9 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ ARM64

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

Uploaded CPython 3.12macOS 11.0+ ARM64

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

Uploaded CPython 3.11Windows x86-64

crackers-0.8.1-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.1-cp311-cp311-manylinux_2_28_aarch64.whl (1.9 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ ARM64

crackers-0.8.1-cp311-cp311-macosx_11_0_arm64.whl (1.6 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

File details

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

File metadata

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

File hashes

Hashes for crackers-0.8.1.tar.gz
Algorithm Hash digest
SHA256 b888702611bf5bf809be48b1455ffb4cfa744f9f8fa7a916fc012a500f1b7470
MD5 852683fa90735e9e8040b8a85618f399
BLAKE2b-256 a488093b43960125e4db3d25611a7a1777a3ef13ff241a28caac264dc50b363d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for crackers-0.8.1-cp314-cp314t-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 b1c8ec14781fcae9c75a60fd88808eaada1e549f653bd200e53b19a90daa0f1c
MD5 c995a739007ed14631ad996166022fa5
BLAKE2b-256 d35d597fe538d73dae5eb9f00e9784e81d45ff5d8eafdb4d75f686d862247f83

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for crackers-0.8.1-cp314-cp314t-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 134d6e49eca19d36797f4826b32d33297fdb37868041e5e8d43e89a073e0f58c
MD5 b78f7603048299e419191f5f491b1388
BLAKE2b-256 48dfd7342e6ebdb9169fd3c1c6ee6806b39c00d26610ff035ac3154881228146

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for crackers-0.8.1-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 1745708e612c33e12a1c29c15ad01666a16c9bff69040a7a9ccc15fe8ec6ce0e
MD5 910134f3c193f7c4c39737049074b467
BLAKE2b-256 7d3a261f62fc74cac60fd55ab26f1addec0975241dced99faad80b869fce124f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for crackers-0.8.1-cp314-cp314-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 298f6db11ad06c66f2dda4347eb929e556d270fa6557eea36bc5da15026cfc2f
MD5 71370f7002452ec51b6dcd28ed239245
BLAKE2b-256 d8916b5fc95b50edda5ddee8376ff251c35ec2a2fec40c4e3f01c4f97e908569

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for crackers-0.8.1-cp314-cp314-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 94b26ef9a9db5010fe910831f6f043bc3a5baaf1b386f4680671a89850d36fbd
MD5 c890663878513cc8d07e30c79c906832
BLAKE2b-256 219de4337fca38714a17533da1762858c873db476cd6bd13932125f0914a405e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for crackers-0.8.1-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f255ee7d4212c3465b3841157e3fd62d76a7e728dc0975c5300b51f0fdc2ef25
MD5 377cacf49afba152fdc74ddbc5c78206
BLAKE2b-256 e397e8ed5eddd462882b59373b78387d3f60ec7c466cb789e59c35a880a14701

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for crackers-0.8.1-cp313-cp313t-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 18efa02db96351f50b3cc460164a12deb1988f147b29b10730f820fdc9b19249
MD5 85ea849adaf00d540bb7941d9ebc1ab4
BLAKE2b-256 0c5ca48f4eb828549b5302b001d48a20e6dc6c5de97ccd5ac412caa69748fba1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for crackers-0.8.1-cp313-cp313t-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 f31c1e14847ea42e4a078d00aebea6423e78470364ce133bdda0f6350fb00fd9
MD5 873fde2724b9fc0b1990291ffea8892c
BLAKE2b-256 b8dbec13918d59b3210fab226423bc6fda254f39ac7796f296ead687a53a8dc2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for crackers-0.8.1-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 977d7fa1f3185021682a843f81a7e24dc78cca55d528488353a765b5470f96fc
MD5 aa698c60499c28ea26b24c7b1b33b550
BLAKE2b-256 ee9b81f243ec5da9454010fccc70bd79cae4d38900e6887de5181f63fa6725b2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for crackers-0.8.1-cp313-cp313-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 9520d40d0873088e9e3f081df5d128870f88de5d1e7e85621ade716fc9842431
MD5 af196a7fcf12eab325b783133146d612
BLAKE2b-256 9f107a10e76ccfd91c1236131e2b2b2b49ce74a383039c355865469e86cea5db

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for crackers-0.8.1-cp313-cp313-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 0cc5cd67672f00e9bf8b305df200427a677ad862d40d3d7412f967263c49b6ed
MD5 7d0414ae80f0bab6c029d087334cb290
BLAKE2b-256 30f2a2e5d9c4fe6f82f2df3c4ae48369d0a8ced06bcb579e8e39f54fd01419c6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for crackers-0.8.1-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e7d44043f61e09ad1b2b6d13be9bd88274c394f9ed8b2bd172f1e2391e4b8f69
MD5 ee3aaa489b798eb4f178a6aceaf5248b
BLAKE2b-256 7f53b239c1f45df543103ae59d2d5bfa27dff3f04439007767afcc568dfb29a0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for crackers-0.8.1-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 52968434d504897a7435d7d33b1b7463297256fac87f0f482b6512d9f2c057d6
MD5 bb6504d948f8fc097cf21fb326b12a79
BLAKE2b-256 3b9a01633cf14ad59d08ca74add714a3900d16d22670282f94a21378881f83aa

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for crackers-0.8.1-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 bc900a25262c94825216c1013dd61ef7b40efc6158258ad15dc2cb86e779a321
MD5 692c5d2f50181e372abf973cde64a7d9
BLAKE2b-256 3e5ea5b6f16a74dd47cd3fbe746e13bcd3eef248aa694ea050b02a7ac5bf12d3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for crackers-0.8.1-cp312-cp312-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 3852eec4de1a114c4e969344937b09934ac374f757f058d8196f3d0bade317b4
MD5 9a4004444eb9cbfb68607e9f3dff5322
BLAKE2b-256 759914a6e1b0cf2b48a2ecfea863254f918ad08d1fe73852dcfacda1d5c00757

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for crackers-0.8.1-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 6344a457ad0bc52c6cc2851aeba818811996f78566b88a7d2b73baeb2e7fe129
MD5 16ffb279fb02de4815e25187aa45d463
BLAKE2b-256 7bed76c7c487e829245967b083a5cdc81baf195339d6a365c6d81a908a3364c9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for crackers-0.8.1-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 e6a94ca29a0bbfe13f82bb0db8ab35fbb10dc37b66b81129d24ba53b96f8be82
MD5 18b8d8fec251eeda1667005bb3e45b55
BLAKE2b-256 31c138de04d903f2152f85f115c045fef52a3fdb89e75366b72a775dce1f6670

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for crackers-0.8.1-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 7936f1fee6178ccaca24d20d41ba4937c911e1b70c4402f40c7ba953faa5cb7c
MD5 3c593e9c3c3007428c2e7ce57a13df21
BLAKE2b-256 9250509a3b4d66740b623e60f57587cdd9fadf2209c065e804d39f5dc3171d51

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for crackers-0.8.1-cp311-cp311-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 eed1312302321a971efe2bb52171dec08ede8bd926a6bc07cfcebee86fa9083f
MD5 714accb783d645797e1d875ef0ab99fb
BLAKE2b-256 91466f0b9d76292110fe447981a5f90eb5e0189ebdfd1b57a1090a724b78a496

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for crackers-0.8.1-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 40989fc56473bcfb2f484af5d477cfbf3a0ad9d20019d5c79ba962aa9b2cdf93
MD5 998e128ced5cd554f88290cc556e9bce
BLAKE2b-256 eb095a1bcbed482f5c3f795a2605c86aa348da831907dd2e6620caaf2292bcb4

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