Giter Site home page Giter Site logo

nccgroup / xendbg Goto Github PK

View Code? Open in Web Editor NEW
74.0 11.0 12.0 16.77 MB

A feature-complete reference implementation of a modern Xen VMI debugger. ARCHIVED: Development continues at https://github.com/spencermichaels/xendbg.

Home Page: https://www.nccgroup.trust/us/about-us/newsroom-and-events/blog/2019/january/xendbg-a-full-featured-debugger-for-the-xen-hypervisor/

License: MIT License

CMake 0.42% C++ 94.40% C 3.64% Python 1.36% Shell 0.18%

xendbg's Introduction

xendbg - A modern Xen debugger

xendbg is a feature-complete reference implementation of a modern Xen VMI debugger, superseding Xen's own limited and rarely-maintained gdbsx. It can debug both paravirtualized (PV) and hardware virtualized (HVM) guests, and provides both a standalone REPL and an LLDB server mode.

Note: The author of this program no longer works at NCC Group. As such, this repository has been archived, and development has moved to a new fork at SpencerMichaels/xendbg. Please direct any new issues, pull requests, and communication there.

Features

  • Supports 32- and 64-bit x86 Xen guests, both PV and HVM
  • LLDB server mode
  • Standalone REPL mode
  • Register read/write
  • Memory read/write
  • Breakpoints
  • Watchpoints (HVM only due to Xen API limitations)

Server mode

When started with --server, xendbg will start up an LLDB server on the specified port. A Xen domain may also be specified using the --attach option, which will tell xendbg to connect to that domain immediately and close the connection when it is destroyed. Otherwise, it will open one port per Xen domain, starting at the given port and counting up. The server will open and close ports as domains are created and destroyed, and will only exit when the user explicitly sends a CTRL-C.

In either case, LLDB can then connect to any of xendbg's ports using the gdb-remote command, providing the user with a seamless and familiar debugging experience.

LLDB mode

LLDB

REPL mode

If started without --server, xendbg will run a standalone REPL in the foreground. This mode still provides all of the debugging features that the LLDB server supports, and some users may prefer it over LLDB's CLI interface. xendbg's REPL, while somewhat simpler than that of the LLDB CLI, does provide common CLI debugger comfort features, including tab completion, expressions, and variables.

Type help at the REPL for a full list of commands.

Features

  • Contextual tab completion: Hit <tab> at any point to list completion options; if only one option is available, it will be expanded automatically.
  • Expressions: Any statements that take numerical values can also take expressions, e.g. disassemble $rip+0x10 0x20. Besides addition, subtraction, multiplication, division, and parenthesization, expressions also support:
    • The C-style dereference operator *, which will interpret its operand as an address in guest memory and read either a 32- or 64-bit value from that location, depending on the bitness of the guest.
    • Symbol resolution via the & operator.
  • Symbols: Symbols can be loaded via symbol load <filename>, and thereafter any valid symbol name prefixed with & will evaluate to the address of that symbol and can be used in an expression, e.g. print &rumprun_main1
  • Variables: Any C-style variable name prefaced with a dollar sign $ is treated as a variable. Variables can be set with set $my_var = {expression} and unset with unset $my_var. In addition, when attached to a guest, its registers will be given variable semantics, so they can be read/written directly via the set/print commands, e.g. set $rax = $rbx + 0x1000.

REPL mode

Command line options

-h,--help                   Print this help message and exit
-n,--non-stop-mode          Enable non-stop mode (HVM only), making step,
                              continue, breakpoints, etc. only apply to the
                              current thread.
-d,--debug                  Enable debug logging.
-s,--server PORT            Start as an LLDB stub server on the given port.
                              If omitted, xendbg will run as a standalone REPL.
-i,--ip PORT Needs: --server
                            Start the stub server on the given address.
-a,--attach DOMAIN          Attach to a single domain given either its domid
                              or name. If omitted, xendbg will start a server
                              for each domain on sequential ports starting from
                              PORT, adding and removing ports as domains start
                              up and shut down.

Building and installing

Automatically

Ubuntu users can easily build and install xendbg by running install.sh in the root of the project (see also build.sh). The script will install the necessary packages, pull and build the third-party dependencies, and finally build and install xendbg.

Manually

xendbg depends on the packages listed below. Exact names may differ on non-Ubuntu systems; these are from Ubuntu. Note that xendbg must be built with clang and libc++, as it uses C++17 features whose libstdc++ implementations are known to differ depending on the version of GCC.

libcapstone-dev
libspdlog-dev
libxen-dev
libreadline-dev
clang
libc++abi-dev
libc++1
libc++-dev

xendbg also requires some third-party dependencies that are not available as Ubuntu packages.

xendbg's People

Contributors

smichaels-ncc avatar spencermichaels avatar chaosdata avatar nderjung avatar

Stargazers

Kvar Izunia avatar  avatar  avatar hnkz avatar  avatar Simone Ferrini avatar Benoît Amiaux avatar  avatar Jevin Sweval avatar Christopher Pelloux avatar boy1337 avatar Kareem avatar Austin Songer,MIS,CEH,ESCA,Project+ (Navy Veteran) avatar Mohamed Saher avatar Tamas K Lengyel avatar Ioannis Sfyrakis avatar kickass156 avatar Nick Spinale avatar Ronan Abhamon avatar Markus Boehme avatar Daniel Isaksen avatar QGW avatar Nikolay Kolev avatar Fotis Niarchos avatar  avatar Boran Car avatar Sebastian avatar 张德帅 avatar  avatar WAH avatar  avatar Denis Denisov avatar G.Grandes avatar wrmsr avatar Erik Nilsen avatar Rich Persaud avatar  avatar Olivier Lambert avatar Yusuf Arslan Polat avatar Val Packett avatar Vinh Quốc Nguyễn avatar Kağan IŞILDAK avatar  avatar deki0r avatar Xi Kangjie avatar well.james avatar d366 avatar  avatar  avatar Aaron A. Glenn avatar Mick avatar andrea denisse avatar Bernardo Damele A. G. avatar  avatar icxldd avatar  avatar  avatar  avatar jay avatar rys avatar Mathieu Tarral avatar Iqbal Rifai avatar Wynter Woods avatar Pedro Lara Campos avatar Twister avatar Alexandro Sanchez avatar  avatar Edison Austria avatar dukebarman avatar Nguyen Anh Quynh avatar Ryota Sakai avatar Ren Kimura avatar Roman Bazhin avatar

Watchers

Jevin Sweval avatar Felix Ingram avatar James Cloos avatar Raviv Cohen avatar Sharan avatar Ollie avatar Matt Lewis avatar  avatar jay avatar  avatar  avatar

xendbg's Issues

Terminating with uncaught exception

Hi,
I was trying to use xendbg for debugging Rumprun on Xen PV. However, when I give the continue command, debugger terminates. The following are the steps I followed.

# xendbg
> guest attach 16
Attached to guest 16 (rumprun-back.bin).
rumprun-back.bin > symbol load vifconf/back.bin
rumprun-back.bin > breakpoint create &rumpuser_mutex_tryenter
Created breakpoint #1.
rumprun-back.bin > breakpoint list
1: 0x161c0 (rumpuser_mutex_tryenter)
rumprun-back.bin > continue
terminating with uncaught exception of type xd::xen::XenException: Failed to get PV CPU context for VCPU 4294967295 of domain 16
Aborted (core dumped)

Am I missing something?

Problems building the xendbg

Hi

I seem to be having some problem building the project. Every time I try and build the system using the script I get this error:
Screenshot from 2019-11-04 00-07-27
I would be grateful if someone could explain to me how to fix this. I am running ubuntu 18.04 BTW and installing the dependencies seems to have worked correctly

Thanks Kareem

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.