z3k0sec
open main menu
Part of series: cheatsheet

Fix GLIBC_2.3X error message via XenSpawn

/ 2 min read

Why XenSpawn?

Compatibility issues can arise due to differences in GLIBC versions. One common problem is encountering GLIBC_2.3X not found error messages when compiling or running binaries. This often happens when the binary is built on a system with a different GLIBC version than the target machine.

XenSpawn is a tool designed to tackle the compatibility issues by creating a controlled environment where you can compile and run your binaries with the correct library versions. By using XenSpawn, you can mitigate version discrepancies and ensure that your kernel exploits and other binaries work as intended on the target system.

https://github.com/X0RW3LL/XenSpawn

When compiling a local kernel exploit on your host machine, you might encounter an error message like this:

./exploit-1: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.33' not found (required by ./exploit-1)
./exploit-1: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found (required by ./exploit-1)

How to install XenSpawn and spawn a container

# Clone the repo locally, or download the script
kali@kali:~$ git clone https://github.com/X0RW3LL/XenSpawn.git

# cd into the cloned repo
kali@kali:~$ cd XenSpawn/

# Make the script executable
kali@kali:~/XenSpawn$ chmod +x spawn.sh

# Note: the script must be run as root
# Note: MACHINE_NAME is a custom name you will be
#       spawning the container with
kali@kali:~/XenSpawn$ sudo ./spawn.sh MACHINE_NAME

# Starting the newly spawned container
# Note: MACHINE_NAME is to be replaced with the machine name of choice
kali@kali:~/XenSpawn$ sudo systemd-nspawn -M MACHINE_NAME

Spawning container MACHINE_NAME on /var/lib/machines/MACHINE_NAME.
Press ^] three times within 1s to kill container.

root@MACHINE_NAME:~$ exit
logout
Container MACHINE_NAME exited successfully.

You can now use the new container to compile the kernel exploit, which should (hopefully) resolve the error when executed on the target machine.