Skip to content

Instantly share code, notes, and snippets.

View novafacing's full-sized avatar
dilly dally shilly shally

Rowan Hart novafacing

dilly dally shilly shally
View GitHub Profile
@novafacing
novafacing / RPATH_VS_RUNPATH.md
Last active August 29, 2023 23:04
RPATH vs RUNPATH in readelf

RPATH vs RUNPATH

I'm doing some ELF parsing and I need to simulate ld.so's lookup routine (man ld.so). To do that, I need to grab RPATH as well as RUNPATH from binaries, so to test my tool I naturally need to make some binaries with each of those. Here's how you do it.

cat <<EOF > /tmp/a.c
int main(){}
EOF
# sh <(curl -L https://nixos.org/nix/install)
# nix-build https://github.com/LnL7/nix-darwin/archive/master.tar.gz -A installer
# ./result/bin/darwin-installer
# Go through installer, put this file where you want it
# darwin-rebuild switch -I darwin-config=${HOME}/wherever/you/put/it/configuration.nix
# There will probably be errors :)
{ config, pkgs, lib, ... }:
let
username = "novafacing";
@novafacing
novafacing / solve_mra.py
Created May 3, 2021 00:40
Solve script for MRA from Defcon 29 Quals
from pwn import *
from subprocess import run, PIPE
from pathlib import Path
import re
import random
context.arch = "arm"
context.bits = 64
PC_REG = r"\(void \(\*\)\(\)\) (0x[0-9a-f]+)"