GithubHelp home page GithubHelp logo

findlibc's Introduction

findlibc

This is a small tool I wrote to help identify a version of libc given some leaked addresses and their symbol names.

This comes in handy when tackling CTF challenges where libc isn't provided, but we're able to leak some addresses. Using these leaked addresses, we can make an educated guess as to the libc version, potentially easing the burden of exploitation.

Methodology

Given a set of 2 or more leaked symbols, it will iterate over a collection of libc files and find one whose symbol table contains a set of offsets for the provided symbol names which matches the relative offsets of the provided address leaks. That was a mouthful, these comments are a bit more thoughtful.

Usage - Interactive

The tool can be used interactively, like so: python -m findlibc.

Usage - Script

The tool can also be used in your scripts.

import findlibc

funcs = {
	"read":   0x7f76847cf250,
	"puts":   0x7f7684747690,
	"system": 0x7f768471d390,
	"free":   0x7f768475c4f0,
	"malloc": 0x7f768475c130,
}

results = findlibc.find(funcs, arch='any', many=True)

The first argument should be a dictionary of symbols. The following option arguments are first an architecture (default 'any') and second whether you want all macthes (True, returns a list of tuples) or the first match (False, default, returns a tuple).

The returned tuple(s) are (libc, filename) where libc is a pwntools.ELF and filename is a string.

Dependencies

Hard dependency on pwntools. This also implies a dependency on python2.7, as that is what pwntools supports.

If you want to get it running on any other version using a custom or unofficial pwntools fork, GLHF.

Libc Files

I've included some random libc files. These are what I had laying around in my CTF working directory.

You can get many more from here, but these will slow it down a lot. The code is written to handle this dataset, however, and will filter out extraneous libs. pwntools does choke on some parts of that set, and might need massaging.

findlibc's People

Contributors

nickcano avatar jo3bingham avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.