Skip to content

Instantly share code, notes, and snippets.

@doraeric
Created July 14, 2020 08:29
Show Gist options
  • Save doraeric/f13bd9e8de22faa385ba4526c9aa6099 to your computer and use it in GitHub Desktop.
Save doraeric/f13bd9e8de22faa385ba4526c9aa6099 to your computer and use it in GitHub Desktop.

In ubuntu 16.04 docker container

Get correct glibc version source code

This is for gdb debug and pwn, reverse

go to launchpad, apt source cannot get specific version, check version by apt-cache policy libc6, the version is 2.23-0ubuntu11, even 0ubuntu11 need to be the same with source. Finally, run dpkg-source -x glibc_2.23-0ubuntu11.dsc.

Only get source:

cd /tmp
apt install apt-rdepends
apt download $(apt-rdepends libc6-dbg|grep -v "^ ")
apt install dpkg-dev && apt source libc6
# if dpkg-source failed
dpkg-source -x <package>.dsc

Get source and build

sudo apt build-dep libc6
sudo apt install build-essential
# 1
apt source libc6
cd <package>
dpkg-buildpackage -us -uc
# 2
# sudo apt install fakeroot
# export LANG=C LD_LIBRARY_PATH=""
apt source --compile libc6

On host

docker cp ubuntu:/tmp/dl /tmp

for i in *.deb; do dpkg -x $i <path>; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment