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

Uploaded CPython 3.14tmanylinux: glibc 2.28+ ARM64

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

Uploaded CPython 3.14Windows x86-64

crackers-0.7.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.7.0-cp314-cp314-manylinux_2_28_aarch64.whl (1.8 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.28+ ARM64

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

Uploaded CPython 3.14macOS 11.0+ ARM64

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

Uploaded CPython 3.13tmanylinux: glibc 2.28+ ARM64

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

Uploaded CPython 3.13Windows x86-64

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

Uploaded CPython 3.13manylinux: glibc 2.28+ ARM64

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

Uploaded CPython 3.13macOS 11.0+ ARM64

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

Uploaded CPython 3.12Windows x86-64

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

Uploaded CPython 3.12manylinux: glibc 2.28+ ARM64

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

Uploaded CPython 3.12macOS 11.0+ ARM64

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

Uploaded CPython 3.11Windows x86-64

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

Uploaded CPython 3.11manylinux: glibc 2.28+ ARM64

crackers-0.7.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.7.0.tar.gz.

File metadata

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

File hashes

Hashes for crackers-0.7.0.tar.gz
Algorithm Hash digest
SHA256 0c9fb919796c3fc35bf797df10d5749f02bd96b4aa891484289602226e4949cb
MD5 430835a2d2f8e144a19a4430c317e2a3
BLAKE2b-256 7a17503417d79620f1561b79c6ae7d276a8049d0ab0a4ce0e2ef551b866629f5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for crackers-0.7.0-cp314-cp314t-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 b2f892112e17f51ed634ecd07bf0ff6d77a37267345656a065b01769d42a2358
MD5 6d559562748c5cbb2c1c2d4b3d8325f6
BLAKE2b-256 b26a42149c129efa8abfa13bedbffc94189d827e7907fa22014397c7ef1f247b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for crackers-0.7.0-cp314-cp314t-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 85e0d8260422948157d97673ed13ba39278780cbbd7a8da9f0e2e3a6666a6caf
MD5 197fff96f565bea0caf8ec08e8dcab99
BLAKE2b-256 1c9423777834f1b8032761e4e28fa74472d5373534ea15a0c827391b982d89b4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for crackers-0.7.0-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 a9211ae2e7964a053e73c9c778929e16ff38aa9faecb49a5f9432c24426d3d77
MD5 866a9df7988c45b4f87f57b8b5ce6fa0
BLAKE2b-256 2c55f0c03b57181ef6481f18b4783f74f8c4c60aa565936f6989a979bc6b53ca

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for crackers-0.7.0-cp314-cp314-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 7481c9b085cf2a2d1264f93c43a6cd4dd92c2a6db0098e732e2b31c09d9eed74
MD5 844a9c3da92428f3fae7ed05047ce542
BLAKE2b-256 f789f89eb7d3bfa0da863aa83dd015e50372af11f72fd109e0c1f05fa71ad064

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for crackers-0.7.0-cp314-cp314-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 87094189aba32d62cd46ce84e6134e0f0e551447e422df56f4f1eacf9456a4e3
MD5 1258c9eca04c7390946d45a3b447a3b1
BLAKE2b-256 43559de7b872d9f24a6c226327ee79057044744387ce8c60f0f63cd4e88fc0a8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for crackers-0.7.0-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 012bb9214b5cad059a310ef96b1a8ad996b2f0f83518910b1f1fb94bd9ef657f
MD5 2b7f2a84415d6aefa3b92553f2e88cd3
BLAKE2b-256 5c94d6ca7e9314a891499bc28b2cdd195e26a4d140eefd79f940519f616626d1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for crackers-0.7.0-cp313-cp313t-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 df3688d07c62c7f72e41dc25d641d013665d22a0c36a4dc55dbcb295afaa9cd1
MD5 b77183761b445cbb36e929735cea8dad
BLAKE2b-256 339b0c91c0db6491f005b5d0db9a983752b213f45c7fa5c80ae9e6a0099af414

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for crackers-0.7.0-cp313-cp313t-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 cf7660c5c4dbd6a99e6eee139177a5cd334630703b6059ed69c1a3ee41475150
MD5 ccef5c9d64e32f464154e42df92a92e6
BLAKE2b-256 a7c36811a675d067a8f1c7ac324300da21cd001d79ac8bf6dc6edbd1443827ff

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for crackers-0.7.0-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 39869c3a2b9ee3e0a750b93e8ec31a4523ee1b060dab4ac09795d40f5770b952
MD5 49df9affd326b55fefb38380668da53e
BLAKE2b-256 f0aeb04a669ae354a9ff1440f748d00246efc4028323d785b90c8cc4b7c75211

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for crackers-0.7.0-cp313-cp313-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 d09b47e68dfa3f3b1e7dbb32502a3719cdacb7d8d2f472dc17acecb3536a67c1
MD5 b2091961f68057626d3d66f64952f3b6
BLAKE2b-256 b9c47a4c22c028bc811ee47329f425d629ff4c7999f0a0b4cd3a2225fc136ec4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for crackers-0.7.0-cp313-cp313-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 3fe03175e65ac89942bf50c2423584449aad1559346152653b45bba33ab2f8da
MD5 d7082829f7702b70dd01509d791f2ab7
BLAKE2b-256 875e386bc2e6f9c30a8ca5b17aec081d3b78a30d04bdfb0f7f0cbe4e8f750701

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for crackers-0.7.0-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 fa445e43fbe72c9b8295998b67af2612bbc07e8997d3d349f1efeaf5c5530566
MD5 6f338b1a939d6fe1f145995501d9b107
BLAKE2b-256 7485e7131c764ce326e90e891ea0a7f97c9d7d2ac199417cd7823cca91d05d2d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for crackers-0.7.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 231ca564cac7fde21d371209d33fe277490c373ba74d35df2103a6b7b6e65b6c
MD5 3ad14a615d367e635dea5fe6d7c91e97
BLAKE2b-256 53c81988a172a45f764cf7e4b0ff3214fa4cc4dbc7c534ba9eed93d141b3a1c7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for crackers-0.7.0-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 5d707f625cd074f82d1273f5f9653d9d96615bf8d070cf5a3598ec9c7517efeb
MD5 beb186a3c3a10e38042e1ca821b69486
BLAKE2b-256 90fcc2da3fffec1fd9e03db07a90fad0f252d2ca47f028576c12abc008daa0bb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for crackers-0.7.0-cp312-cp312-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 b6da54a395dad0b30fd5c1cdcbd81d635e7185a1573646c39c95cf577298850d
MD5 d6f9c5fdf9281be7ca697952d396a1b2
BLAKE2b-256 9bbeb31f3d542a8632ddb364b2cb45402a87976911283079a46b8fb0aa2e3a75

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for crackers-0.7.0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b22344af82a36c6e238c505de9ba966db0014c88486c3bbf5a2fedc7177c59e6
MD5 5d980ca1c37671b43266954c9ad94214
BLAKE2b-256 36fb7117fcfc6f256dd39e74ba488e0670e73903aaef7d4f69c1a59e9441a3e1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for crackers-0.7.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 f1b3781d08661f1a02285c06ff51bb588a7a1dbd509ee26f598771161c934e6e
MD5 f0bc8a84a757fcb9be76e8abd2b04ff3
BLAKE2b-256 bebc30fe257dac5e50768bc870c94f42159549f53c34d7f594dfd4c62303f980

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for crackers-0.7.0-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 a19ad54105c27eed29273b94f1aab70242a8671fedef89d53721afac975054da
MD5 1472af8b91d7f6d7655155997e97a198
BLAKE2b-256 bbea487475f6180923de76a271040889a06d6c86fb683c8c5f2f7eb777ff68b0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for crackers-0.7.0-cp311-cp311-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 f12d2f82c181059d1ffd8a4aa9100896ef3361d817d5d7fa9a6e5bbc4cde962e
MD5 6bdf112b79175d6233c34d08089589cf
BLAKE2b-256 79859cb0883a8461165a1726ceca63180abb86c319a0ee434c77fe67650ded73

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for crackers-0.7.0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 37138a7cd9846415a80d5174c424896d0f9db62d1ab4410a506f4cc8005f0b57
MD5 4ec90e501875210e852da764de1f973b
BLAKE2b-256 38b34d812208bd96e36cf3d899c5cb8453b3b6c6deebfe656a30bac9d52bd8e4

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