• Stars
    star
    762
  • Rank 59,625 (Top 2 %)
  • Language
    Rust
  • License
    MIT License
  • Created about 5 years ago
  • Updated 11 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

pwninit - automate starting binary exploit challenges

Checks Status Deploy Status

pwninit

A tool for automating starting binary exploit challenges

Features

  • Set challenge binary to be executable
  • Download a linker (ld-linux.so.*) that can segfaultlessly load the provided libc
  • Download debug symbols and unstrip the libc
  • Patch the binary with patchelf to use the correct RPATH and interpreter for the provided libc
  • Fill in a template pwntools solve script

Usage

Short version

Run pwninit

Long version

Run pwninit in a directory with the relevant files and it will detect which ones are the binary, libc, and linker. If the detection is wrong, you can specify the locations with --bin, --libc, and --ld.

Custom solve.py template

If you don't like the default template, you can use your own. Just specify --template-path <path>. Check template.py for the template format. The names of the exe, libc, and ld bindings can be customized with --template-bin-name, --template-libc-name, and --template-ld-name.

Persisting custom solve.py

You can make pwninit load your custom template automatically by adding an alias to your ~/.bashrc.

Example
alias pwninit='pwninit --template-path ~/.config/pwninit-template.py --template-bin-name e'

Install

Arch Linux

Install pwninit or pwninit-bin from the AUR.

Download

You can download statically-linked musl binaries from the releases page.

Using cargo

Run

cargo install pwninit

This places the binary in ~/.cargo/bin.

Note that openssl, liblzma, and pkg-config are required for the build.

Example

$ ls
hunter  libc.so.6  readme

$ pwninit
bin: ./hunter
libc: ./libc.so.6

setting ./hunter executable
fetching linker
https://launchpad.net/ubuntu/+archive/primary/+files//libc6_2.23-0ubuntu10_i386.deb
unstripping libc
https://launchpad.net/ubuntu/+archive/primary/+files//libc6-dbg_2.23-0ubuntu10_i386.deb
setting ./ld-2.23.so executable
copying ./hunter to ./hunter_patched
running patchelf on ./hunter_patched
writing solve.py stub

$ ls
hunter	hunter_patched	ld-2.23.so  libc.so.6  readme  solve.py

solve.py:

#!/usr/bin/env python3

from pwn import *

exe = ELF("./hunter_patched")
libc = ELF("./libc.so.6")
ld = ELF("./ld-2.23.so")

context.binary = exe


def conn():
    if args.LOCAL:
        r = process([exe.path])
        if args.DEBUG:
            gdb.attach(r)
    else:
        r = remote("addr", 1337)

    return r


def main():
    r = conn()

    # good luck pwning :)

    r.interactive()


if __name__ == "__main__":
    main()

More Repositories

1

org-fragtog

Automatically toggle Org mode LaTeX fragment previews as the cursor enters and exits them
Emacs Lisp
369
star
2

good-scroll.el

Attempt at good pixel-based smooth scrolling in Emacs
Emacs Lisp
191
star
3

BootMine

Bootable minesweeper game in a 512-byte boot sector
Assembly
162
star
4

godot-portal-demo

Experimenting with portals in Godot Engine
GDScript
79
star
5

WineBox86.apk

x86 Wine on ARM Android with Box86 (very much WIP)
Java
66
star
6

unf

UNixize Filename -- replace annoying anti-unix characters in filenames
Rust
57
star
7

xkcd-unreachable-rs

A Rust macro xkcd_unreachable!() inspired by https://xkcd.com/2200/
Rust
41
star
8

yew-octicons

Easy support for Octicons in yew
Rust
18
star
9

nix-snapd

Snap package for Nix and NixOS
Nix
14
star
10

userland-execve-rust

An implementation of execve() in user space
Rust
10
star
11

Sandvox

The 3D voxel falling-sand game
Rust
9
star
12

hpmor-man-pages

Harry Potter and the Methods of Rationality, Unix Man Page Edition
Python
5
star
13

nix-flatpak

Declarative Flatpak management for the Nix package manager
Python
5
star
14

llvm-rustc-bug-repro

Rust
3
star
15

turboproof

A dependently-typed lisp and proof assistant [IN DEVELOPMENT]
Rust
3
star
16

quoftc

The Quoft Programming Language Compiler
C
3
star
17

MarioLANG

A minimal MarioLANG interpreter
C
3
star
18

deriv-calc

A derivative calculator and equation simplifier in Python.
Python
3
star
19

lambda-cove

https://lambdacove.netlify.com/
HTML
2
star
20

OS

A simple OS in C
C
2
star
21

discord-bedtime

A Discord bot reminding you to sleep
Rust
2
star
22

lambda

Lambda calculus REPL written in C
C
2
star
23

nonsense-discord-bot

Rust
2
star
24

rust-spinners-rand

Get a random `Spinners` from the `spinners` crate
Rust
2
star
25

rust-musl-builder-lzma

rust-musl-builder with liblzma support
Dockerfile
2
star
26

web-dump

/tmp but for static html
HTML
2
star
27

Chip8

A chip8 emulator in C and ncurses
C
2
star
28

coq-proofs

My proofs for the Coq proof assistant
Coq
1
star
29

qemu-libretro

QEMU libretro core port
C
1
star
30

angr-bad-edition

A mediocre angr clone (WIP)
Rust
1
star
31

sandy

A fork of sandy with mods to make it more like vim
C
1
star
32

ffmpeg-fetch-small-samples

Script to fetch small files from https://samples.ffmpeg.org/
Python
1
star
33

raycaster

C
1
star
34

brainfsym

Rust library for symbolically executing brainf*** code
Rust
1
star
35

gcc-mips-spim

Buggy WIP toolchain to compile C to SPIM-compatible MIPS assembly
C
1
star
36

nixos-framework-led

NixOS module for changing the LED color on Framework laptops
Nix
1
star
37

nvim-plumb

Neovim plugin for integration with the Plan 9 plumber
Python
1
star
38

toy-git-rs

Toy git implementation in Rust
Rust
1
star