Make ELF formatted apps configurable

Related tags

Utilities elfredo
Overview

elfredo

elfredo

`elfredo` is a library that allows you to patch executables after they were compiled. It utilize an extra embedded section to store data/configurations that one might want to change without recompiling the binary.

Unfortunately I was able to make objcopy work only up to 113,650 bytes 😞

There are two main components to any project that uses elfredo:

  • Customizing your embeditor to mach your datatype (step 1)
  • Calling the get_embedded_data method to retrieve the embedded data (step 2)

After these two are implemented you end up with two binaries:

  • [app executable].elf - Your editable app
  • [embeditor executable].elf - The binary that you use to change the embedded data

Steps to integrate (See ./example):

  1. Write your configurable data structure in the embeditor binary:
// my_embeditor.rs
use elfredo::embeditor::run_embeditor;
use serde::{Deserialize, Serialize};

#[derive(Serialize, Deserialize, Debug)]
pub struct Person {
    name: String,
    id: u32,
}

fn main() {
    // This will print the embedded data if exists
    if let Err(err) = run_embeditor::() {
        panic!("{}", err);
    }
}
  1. Read the configurations by using elfredo's api:
// main.rs
use elfredo::get_embedded_data;
mod my_embeditor;
use my_embeditor::Person;

fn main() -> Result<(), failure::Error> {
    let person = get_embedded_data::().unwrap();
    println!("{:?}", person);
    Ok(())
}
  1. Embed new data to the elf
john@ubuntu:/mnt/hgfs/elfredo/example$ cat person.json
{
"name": "Ronald",
"id": 5
}

john@ubuntu:/mnt/hgfs/elfredo/example$ cargo run --bin embeditor ../target/debug/example person.json
   Compiling elfredo v0.1.0 (/mnt/hgfs/elfredo)
   Compiling example v0.1.0 (/mnt/hgfs/elfredo/example)
    Finished dev [unoptimized + debuginfo] target(s) in 24.99s
     Running `/mnt/hgfs/elfredo/target/debug/embeditor ../target/debug/example person.json`
"/tmp/.tmpXh5QHg"

john@ubuntu:/mnt/hgfs/elfredo/example$ ../target/debug/example
Person { name: "Ronald", id: 5 }

Roadmap

  • Dynamic elf patching on linux
  • Dynamic PE patching on windows (Using Resources WinAPI)
  • Dynamic MAC-o patching
You might also like...
This app reads a csv file and sends an email with a formatted Handlebars file.

Bulkmail This app reads a csv file and sends an email with a formatted Handlebars file. This can be run on Linux for AMD64 and ARMv7. Upstream Links D

Number names is a Rust library to provide formatted string names for cardinal and ordinal numbers.

Number Names Number names is a Rust library to provide formatted string names for cardinal and ordinal numbers. At this time, only American English is

`Debug` in rust, but only supports valid rust syntax and outputs nicely formatted using pretty-please
`Debug` in rust, but only supports valid rust syntax and outputs nicely formatted using pretty-please

dbg-pls A Debug-like trait for rust that outputs properly formatted code Showcase Take the following code: let code = r#" [ "Hello, World!

Simple macros to write colored and formatted text to a terminal. Based on `termcolor`, thus also cross-platform.
Simple macros to write colored and formatted text to a terminal. Based on `termcolor`, thus also cross-platform.

Bunt: simple macro-based terminal colors and styles bunt offers macros to easily print colored and formatted text to a terminal. It is just a convenie

An architecture-agnostic ELF file flattener for shellcode

Summary elfloader is a super simple loader for ELF files that generates a flat in-memory representation of the ELF. Pair this with Rust and now you ca

This crate allows to generate a flat binary with the memory representation of an ELF.

flatelf Library This crate allows to generate a flat binary with the memory representation of an ELF. It also allows to generate a FLATELF with the fo

A small utility for modifying ELF shared library loading order.

elfpromote A small utility for modifying ELF shared library loading order. Usage $ cargo install elfpromote $ ldd blueboat_server linux-vdso.s

Coffee is a loader for ELF (Executable and Linkable Format) object files written in Rust
Coffee is a loader for ELF (Executable and Linkable Format) object files written in Rust

Coffee is a loader for ELF (Executable and Linkable Format) object files written in Rust. It provides a mechanism to load and parse ELF files similar to COFFLoader, but specifically designed for ELF files used in Unix-like systems.

Scan the symbols of all ELF binaries in all Arch Linux packages for usage of malloc_usable_size

Scan the symbols of all ELF binaries in all Arch Linux packages for usage of malloc_usable_size (-D_FORTIFY_SOURCE=3 compatibility)

A OAuth2 server library, for use in combination with actix or other frontends, featuring a set of configurable and pluggable backends.

oxide-auth A OAuth2 server library, for use in combination with common web servers, featuring a set of configurable and pluggable backends. About oxid

Configurable, extensible, interactive line reader

linefeed linefeed is a configurable, concurrent, extensible, interactive input reader for Unix terminals and Windows console. API Documentation linefe

Highly modular & configurable hash & crypto library
Highly modular & configurable hash & crypto library

Octavo Highly modular & configurable hash & crypto library written in pure Rust. Installation [dependencies] octavo = { git = "https://github.com/libO

A highly configurable logging framework for Rust

log4rs log4rs is a highly configurable logging framework modeled after Java's Logback and log4j libraries. Warning If you are using the file rotation

Rust crate for configurable parallel web crawling, designed to crawl for content

url-crawler A configurable parallel web crawler, designed to crawl a website for content. Changelog Docs.rs Example extern crate url_crawler; use std:

Sōzu HTTP reverse proxy, configurable at runtime, fast and safe, built in Rust. It is awesome! Ping us on gitter to know more

Sōzu · Sōzu is a lightweight, fast, always-up reverse proxy server. Why use Sōzu? Hot configurable: Sozu can receive configuration changes at runtime

🚀Memory safe, blazing fast, configurable, minimal hello world written in rust(🚀) in a few lines of code with few(1092🚀) dependencies🚀
🚀Memory safe, blazing fast, configurable, minimal hello world written in rust(🚀) in a few lines of code with few(1092🚀) dependencies🚀

🚀 hello-world.rs 🚀 🚀 Memory safe, blazing fast, minimal and configurable hello world project written in the rust( 🚀 ) programming language 🚀 🚀 W

Efficient, lightweight, configurable file organizer.

FileClassed Efficient, lightweight, configurable file organizer. This project is very simple : it takes a file in certains directories (that can be co

A thread pool for running multiple tasks on a configurable group of threads.
A thread pool for running multiple tasks on a configurable group of threads.

Threadfin A thread pool for running multiple tasks on a configurable group of threads. Extra features: Dynamic pool size based on load Support for asy

An extension to the bevy_ecs_tilemap, allowing for configurable tilesets, auto tiling, and more
An extension to the bevy_ecs_tilemap, allowing for configurable tilesets, auto tiling, and more

bevy_ecs_tilemap_tileset A mouthful, I know. Working on a better name. An extension to the wonderful bevy_ecs_tilemap crate for Bevy, allowing for con

Owner
Asaf Fisher
Security Researcher
Asaf Fisher
Rust + Yew + Axum + Tauri, full-stack Rust development for Desktop apps.

rust-yew-axum-tauri-desktop template Rust + Yew + Axum + Tauri, full-stack Rust development for Desktop apps. Crates frontend: Yew frontend app for de

Jet Li 54 Dec 23, 2022
cargo, make me a project

cargo-generate cargo, make me a project cargo-generate is a developer tool to help you get up and running quickly with a new Rust project by leveragin

null 1.2k Jan 3, 2023
Make any NixOS system netbootable with 10s cycle times.

nix-netboot-serve Dynamically generate netboot images for arbitrary NixOS system closures, profiles, or configurations with 10s iteration times. Usage

Determinate Systems 152 Dec 24, 2022
A lite tool to make systemd work in any container(Windows Subsystem for Linux 2, Docker, Podman, etc.)

Angea Naming from hydrangea(アジサイ) A lite tool to make systemd work in any container(Windows Subsystem for Linux 2, Docker, Podman, etc.) WSL1 is not s

いんしさくら 16 Dec 5, 2022
Make the github cli even better with fuzzy finding

github-repo-clone (grc) Github Repo Clone is a command line utility written in rust that leverages the power of fuzzy finding with the github cli Usag

Jared Moulton 2 Jul 9, 2022
Rust macro to make recursive function run on the heap (i.e. no stack overflow).

Decurse Example #[decurse::decurse] // ?? Slap this on your recursive function and stop worrying about stack overflow! fn factorial(x: u32) -> u32 {

Wisha W. 18 Dec 28, 2022
Make friends while searching.

searchbuddy Make friends while searching! Searchbuddy is a browser extension that lets you chat with people that are searching for what you're searchi

Joseph Gerber 14 May 23, 2022
Thin wrapper around [`tokio::process`] to make it streamable

This library provide ProcessExt to create your own custom process

null 4 Jun 25, 2022
Bolt is a desktop application that is designed to make the process of developing and testing APIs easier and more efficient.

Bolt ⚡ Bolt is a desktop application that is designed to make the process of developing and testing APIs easier and more efficient. Quick start ??‍??

0xHiro 6 Mar 26, 2023
A fast and small Rust library to make Electron apps more secure.

electron-hardener A Rust library and command line tool to harden Electron binaries against runtime behavior modifications. This provides a way to hard

1Password 364 Dec 23, 2022