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.9.0.tar.gz (83.6 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.9.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.9.0-cp314-cp314t-manylinux_2_28_aarch64.whl (1.9 MB view details)

Uploaded CPython 3.14tmanylinux: glibc 2.28+ ARM64

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

Uploaded CPython 3.14Windows x86-64

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

Uploaded CPython 3.14manylinux: glibc 2.28+ ARM64

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

Uploaded CPython 3.14macOS 11.0+ ARM64

crackers-0.9.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.9.0-cp313-cp313t-manylinux_2_28_aarch64.whl (1.9 MB view details)

Uploaded CPython 3.13tmanylinux: glibc 2.28+ ARM64

crackers-0.9.0-cp313-cp313-win_amd64.whl (1.5 MB view details)

Uploaded CPython 3.13Windows x86-64

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

Uploaded CPython 3.13manylinux: glibc 2.28+ ARM64

crackers-0.9.0-cp313-cp313-macosx_11_0_arm64.whl (1.7 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

crackers-0.9.0-cp312-cp312-win_amd64.whl (1.5 MB view details)

Uploaded CPython 3.12Windows x86-64

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

Uploaded CPython 3.12manylinux: glibc 2.28+ ARM64

crackers-0.9.0-cp312-cp312-macosx_11_0_arm64.whl (1.7 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

crackers-0.9.0-cp311-cp311-win_amd64.whl (1.5 MB view details)

Uploaded CPython 3.11Windows x86-64

crackers-0.9.0-cp311-cp311-manylinux_2_28_x86_64.whl (1.9 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ x86-64

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

Uploaded CPython 3.11manylinux: glibc 2.28+ ARM64

crackers-0.9.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.9.0.tar.gz.

File metadata

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

File hashes

Hashes for crackers-0.9.0.tar.gz
Algorithm Hash digest
SHA256 ee141d031507940ab63c7d8453eba860e9dd37f8e0f198101fca392c59810dad
MD5 98ae30f3d013e79c6f3fdb50ec5c359a
BLAKE2b-256 2fcfb82922c900094228582fdade7cd035dda49b1718d88e01d2efdd762c301a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for crackers-0.9.0-cp314-cp314t-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 d2902d95dd3bccf7696e60cd9b968f83ebfa85b1b2cf0d74315f689141b7b719
MD5 42fdd2fce7baf8a6626f18a31165e26c
BLAKE2b-256 cda7155ef57583117af265332cefa03ce2e1f14cdb77e33f68fac6851933f6b2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for crackers-0.9.0-cp314-cp314t-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 561dba7f461f4b6f106a7f75b43733b829b606192f2efad3814df0c61b910408
MD5 00f3aeb303c024e2e67bdc5098d20d54
BLAKE2b-256 2a96fb8670762b626043af670beb88924e0ec753d20375330539d88c189f6e43

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for crackers-0.9.0-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 715b2577982257698e51bf290d19b2ca4139f098728d642d2b60cf5991e34609
MD5 4f68b84dff74c352515f6a7808767b32
BLAKE2b-256 59bf6763da3f3c17dd71a08c5d24ea8c620acc6a28531f7bddf4307cafb82ea9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for crackers-0.9.0-cp314-cp314-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 9dd33688c4b405a33b3b9f4c7046a087871a88368975c2d11dfb038a401a25ff
MD5 5240d355e4ee2bc45387f6a7adcbcaf3
BLAKE2b-256 018146587c8bd79d2992315951631ba95f7e5def66a113f4280bf6da567e92a6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for crackers-0.9.0-cp314-cp314-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 96ccfccbd219198a574ab1858dc9396165e6f192e47f9adc503f9b834e5b94f8
MD5 74f219a084a0ad68923a0addc9c80b91
BLAKE2b-256 fdacf7ead8074c8228fa529e4a6613c07519a30aa8efed94f2bbb323e9c2f29c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for crackers-0.9.0-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 c3d4fb76df6a57235af8c9f6d1a7889d9f046d205c6b0bccba55fea20448a51f
MD5 596feaf340bd6203e99c1c8443adf8a0
BLAKE2b-256 134cde8cd73af16f420181aaf018f534ce12f67608ce61ff4bad4e39a505edf8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for crackers-0.9.0-cp313-cp313t-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 df91f1454842ac935afbb0e90280150b888d91ba0230957fa159fa99b33a6ad8
MD5 851f928897e22551cf024437a171791b
BLAKE2b-256 c26becd11b08a474f548f5088f47010e836f9f557ba14efd5895f9d1a06b347f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for crackers-0.9.0-cp313-cp313t-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 52132f2fa8065b408d015aa028e8b7be41ecfcd72e49af9a04304dd4fb14419d
MD5 5f024a01c3c35aff04c25ce84f7a9004
BLAKE2b-256 52ddc81bf4473452a0b6bdfcec7cc1da5d1afcb4e954f5119f0467d0b2d659fa

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for crackers-0.9.0-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 22f4c06fd8ed007755ab39a6c0b09170a92a6e1268d07d38cf0f204a6bf3cfd9
MD5 a609fc800656470c299344b515ea17b4
BLAKE2b-256 e1b988ebd5c2b5d5807b8213eee69ca96dbef026fdf68970901364b277f1f1cd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for crackers-0.9.0-cp313-cp313-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 893957152b345bcd220694e0e561e52d1b4fc8dd6ceab82dded06fb185ac432e
MD5 e25f232ebfb2d5766939b96ef12639a0
BLAKE2b-256 f0d90d94a0e5ae9dfcd617a91fb97184fe528c346b6325c08569e3f7de289f23

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for crackers-0.9.0-cp313-cp313-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 af8944f9b715a5fd044d066bc4d068e31a6907299bd9724776d3c0abd1264634
MD5 af76b44801a0e24e212a4a6c3deafd59
BLAKE2b-256 313cd56f72aed8e4e88f649980b53a3a4cc471ea965c2ea3262339f8ef67b754

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for crackers-0.9.0-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 baac9568475821f29f0649b3d72704b916b64e78302eafc01838452fcbe964d0
MD5 cc3420ae0af22948f1365c5f52147f7f
BLAKE2b-256 a1811e351bfc8a17cffaeb3918004a15746e35c8c9f5284162dd74a953599b50

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for crackers-0.9.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 1853d57c737f20442e1aa49f5e4cbfafc0ce51014186940ae2a397adf8aa5ec5
MD5 2b20c3af6d294ac9bed4c1ac8d34692d
BLAKE2b-256 661aa0770151646e550df11ecd42aed111e0c12ecc884986608cf88517096058

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for crackers-0.9.0-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 9f41989db0a1107abd4fdc21c6fa2219ce2647bff829e596bfdbb62aebc82943
MD5 523d3f507b23a921846f768f80ac671c
BLAKE2b-256 eed312ed9e669112f5aad93172dab3b304bf89015ce081b298328543d888966d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for crackers-0.9.0-cp312-cp312-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 a524dc7b10b520bb5e80a68037732606dcfb64d58d631bb60679ba736910f2a7
MD5 e99efc84d59942500aed07397f421064
BLAKE2b-256 78bbbaee9e1b1beb51f359e458ab0ce033471dae20306e629bbe2e56b0f21cb3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for crackers-0.9.0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 168c51820b0b901ac2cf8299597e4bc1247932993dad3cac4bfdf87746416613
MD5 120a07c4171db0ef9ffb41f2825b06f8
BLAKE2b-256 edad58a6593987b1d326b38602f5d7b82fe0dd312712d63387445dd46b343508

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for crackers-0.9.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 3c07406a2984e5782ba6be56862cee5c6a99fffd62b33060a816f364a8002296
MD5 edaa7feb2ef3c00934d8e1cbeb0518f7
BLAKE2b-256 f56bb4f20e346fe5a850fdba9938cc2afa4dcb3e2bb6f24fa69f02ba29663ad4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for crackers-0.9.0-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 ce6395437f5cb9e899d9c777f59586b91fd40e2b501e3591e38d92231a88b9ed
MD5 0d48d35ff8cdb5657118d5f5608fc9ec
BLAKE2b-256 eec19101d014090a0ef72b5974938a1626445993e51d8400e4e9468f48399081

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for crackers-0.9.0-cp311-cp311-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 41d762f77f75a4b5974a1ae8e667b9a19e297e870ce1c3c932d49526e97bcf44
MD5 6ae57021ab76ef4b9492450e9878c747
BLAKE2b-256 dff3af5d935270f0623378af4cef3ea25447f0ad7a31e3ea0731d660fe8e6c5f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for crackers-0.9.0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 7dddbdea8d8fb980c795d6bbf42bf262a34e24f48eb3820affb878b5cd75d4b5
MD5 35930e53520f9a5f76159f5570a897a1
BLAKE2b-256 df735a1efbec6c283598d282247c7366bcd668db4cb4fbdcdce45dfa79cbf3ea

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