Giter VIP home page Giter VIP logo

xom-switch's Introduction

DISCONTINUATION OF PROJECT.

This project will no longer be maintained by Intel.

Intel has ceased development and contributions including, but not limited to, maintenance, bug fixes, new releases, or updates, to this project.

Intel no longer accepts patches to this project.

If you have an ongoing need to use this project, are interested in independently developing it, or would like to maintain patches for the open source software community, please create your own fork of this project.

XOM-Switch

(eXecutable-Only Memory Switch)

xom-switch is the eXecutable-Only-Memory (XOM) enabling tool for x86 Linux system. It aims to mitigate code disclosure guided ROP attacks. This is is the 1st tool using Intel's Memory Protection Keys (MPK) feature for XOM enabling. xom-switch protects all code modules in the runtime including executable and dependent libraries without requiring source code or heavyweight binary translation/rewriting. xom-switch uses non-intrusive way to intercept program runtime by instrumenting program loader (ld.so).

BlackHat Asia 2018 Description and Presentation

xom-switch could run in Amazon AWS C5 Instance. Try it out!

Fedora 28 will support GOT protection in lazy binding using memory protection keys. Link1, Link2.

Background

Why eXecutable-Only Memory

Hardware Support

Software Enabling

Getting Started

Platform Prerequsites

To run xom-switch properly, you need to have hardware and OS support first:

  • Intel CPU with protection keys feature on, e.g, INTEL® XEON® SCALABLE PROCESSORS AND
  • Linux kernel 4.9 or later. OR
  • Use VM in AWS, choose Amazon Linux 2 LTS Candidate AMI 2017.12.0 (HVM) and then C5 Instance.

Software Prerequsites

xom-switch requires two tools:

  • common tools: bc, binutils, gcc, python 2.7
  • radare2 (v2.3.0): a static binary analyzer, which could be found in here

Components

xom-switch consists of three modules:

  • binary rewriter: a static binary rewriter for x86 ELF binaries.
  • patch: C code pieces (see tutorial to write your own instrumentation) that will be patched into program loader.
  • analysis: analyzer/instrumentor of the program loader using radare2.

Patching

  • install python 2.7 and radare2
  • patch your loader: src/analysis/patch-loader.sh /lib64/ld-linux-x86-64.so.2 /your/new/ld.so
  • copy your loader to system dir: sudo mv /your/new/ld.so /lib64/ld-xom.so
  • patch your libc.so (optional): src/analysis/patch-libc.sh /lib/x86_64-linux-gnu/libc.so.6 /your/new/libc.so

Note: patching your libc allows you to apply XOM to their child processes spawned through execve(2).

Running

  • apply XOM to your program: /lib64/ld-xom.so /path/to/your/program
  • apply XOM to your program and its children: LD_PRELOAD=/your/new/libc.so /lib64/ld-xom.so /path/to/your/program

License

This code is published under GPLv2 version.

Project Status

This code is for demo purpose only and the status of code is beta.

Know Limitation

xom-switch has known limitation in the following cases:

  • When binaries has data embedded in the middle of code, xom-switch may crash. To avoid that xom-switch has a white list embedded in code. see
  • Since code modules (exe and libs) are not compiled with XOM support, there would be at least two code pages (the 1st and last code page) for each module where code and data co-exist. xom-switch avoids the issue by marking them as readable and executable. In the future, we will solve that using static analysis.

Task List

  • Support CentOS 7.2.
  • Support CentOS 7.4.
  • Support Ubuntu 16.04.
  • Support Ubuntu 17.04.
  • Support simple instrumentation like function interception.
  • Support Amazon Linux 2 LTS Candidate AMI 2017.12.0 (HVM) C5 VM.
  • Adding page fault handling to let go legitimate data read.

xom-switch's People

Contributors

henry5421 avatar mingwayzhang avatar rdower avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

xom-switch's Issues

Can we inject sections to the beginning of .bss section?

If I understand it right, in section_basic.py you will inject new sections right after the .bss section (aligned to 0x1000), and overwrite the following contents.

However, the type of .bss is SHT_NOBITS and occupies no space in the file. In other words, the offset of .bss and that of the following section (e.g., .symtab) are actually the same, so you are injecting new sections to the middle of the following section.

Not sure if current implementation would cause a potential problem, but it looks like the injecting point could be moved forward a lot.

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.