1

I am trying to compile dirtycow exploit file which can be found in here.

gcc -pthread dirty.c -o dirty -m32 -lcrypt

Because my target is 32 bit I compile it with -m32 and -lycrypt to make sure it works like intended. But an error occurs at compile time,

/usr/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/libcrypt.so when searching for -lcrypt
/usr/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/libcrypt.a when searching for -lcrypt
/usr/bin/ld: cannot find -lcrypt
/usr/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/libcrypt.so when searching for -lcrypt
collect2: error: ld returned 1 exit status

lcrypt error

I've install multilib and i386 with this command

sudo apt-get install gcc-multilib libc6-dev-i386

but it is still not working.

here is libcrypt list in my device:

$ locate libcrypt
/usr/i686-w64-mingw32/lib/libcrypt32.a
/usr/i686-w64-mingw32/lib/libcryptnet.a
/usr/i686-w64-mingw32/lib/libcryptsp.a
/usr/i686-w64-mingw32/lib/libcryptxml.a
/usr/lib/i386-linux-gnu/libcrypt.so.1
/usr/lib/i386-linux-gnu/libcrypt.so.1.1.0
/usr/lib/nsight-compute/host/linux-desktop-glibc_2_11_3-x64/libcrypto.so.1.0.0
/usr/lib/nsight-systems/host-linux-x64/libcrypto.so.1.0.0
/usr/lib/x86_64-linux-gnu/libcrypt.a
/usr/lib/x86_64-linux-gnu/libcrypt.so
/usr/lib/x86_64-linux-gnu/libcrypt.so.1
/usr/lib/x86_64-linux-gnu/libcrypt.so.1.1.0
/usr/lib/x86_64-linux-gnu/libcrypto.a
/usr/lib/x86_64-linux-gnu/libcrypto.so
/usr/lib/x86_64-linux-gnu/libcrypto.so.1.1
/usr/lib/x86_64-linux-gnu/libcryptsetup.so.12
/usr/lib/x86_64-linux-gnu/libcryptsetup.so.12.6.0
/usr/lib/x86_64-linux-gnu/pkgconfig/libcrypt.pc
/usr/lib/x86_64-linux-gnu/pkgconfig/libcrypto.pc
/usr/share/bug/libcryptsetup12
/usr/share/doc/libcrypt-dev
/usr/share/doc/libcrypt1
/usr/share/doc/libcryptsetup12
/usr/share/doc/libcrypt1/README.md.gz
/usr/share/doc/libcrypt1/TODO.md.gz
/usr/share/doc/libcrypt1/changelog.Debian.gz
/usr/share/doc/libcrypt1/changelog.gz
/usr/share/doc/libcrypt1/copyright
/usr/share/doc/libcryptsetup12/changelog.Debian.gz
/usr/share/doc/libcryptsetup12/changelog.gz
/usr/share/doc/libcryptsetup12/copyright
/usr/x86_64-w64-mingw32/lib/libcrypt32.a
/usr/x86_64-w64-mingw32/lib/libcryptdlg.a
/usr/x86_64-w64-mingw32/lib/libcryptdll.a
/usr/x86_64-w64-mingw32/lib/libcryptext.a
/usr/x86_64-w64-mingw32/lib/libcryptnet.a
/usr/x86_64-w64-mingw32/lib/libcryptsp.a
/usr/x86_64-w64-mingw32/lib/libcryptsvc.a
/usr/x86_64-w64-mingw32/lib/libcryptui.a
/usr/x86_64-w64-mingw32/lib/libcryptxml.a
/var/cache/apt/archives/libcrypt-dev_1%3a4.4.17-1_amd64.deb
/var/cache/apt/archives/libcrypt1_1%3a4.4.17-1_amd64.deb
/var/cache/apt/archives/libcrypt1_1%3a4.4.17-1_i386.deb
/var/lib/dpkg/info/libcrypt-dev:amd64.list
/var/lib/dpkg/info/libcrypt-dev:amd64.md5sums
/var/lib/dpkg/info/libcrypt1:amd64.list
/var/lib/dpkg/info/libcrypt1:amd64.md5sums
/var/lib/dpkg/info/libcrypt1:amd64.shlibs
/var/lib/dpkg/info/libcrypt1:amd64.symbols
/var/lib/dpkg/info/libcrypt1:amd64.triggers
/var/lib/dpkg/info/libcrypt1:i386.list
/var/lib/dpkg/info/libcrypt1:i386.md5sums
/var/lib/dpkg/info/libcrypt1:i386.shlibs
/var/lib/dpkg/info/libcrypt1:i386.symbols
/var/lib/dpkg/info/libcrypt1:i386.triggers
/var/lib/dpkg/info/libcryptsetup12:amd64.list
/var/lib/dpkg/info/libcryptsetup12:amd64.md5sums
/var/lib/dpkg/info/libcryptsetup12:amd64.shlibs
/var/lib/dpkg/info/libcryptsetup12:amd64.symbols
/var/lib/dpkg/info/libcryptsetup12:amd64.triggers

is there way how to fix it? or shall I make a 32 bit VM to compile this?

1 Answer 1

4

You need to install libc6-dev:i386, which is the package containing /usr/lib/i386-linux-gnu/libcrypt.so (which is what the linker needs):

sudo apt install libc6-dev:i386
1
  • 2
    Thanks, this was the ticket. For those struggling to get this on a fresh install of Kali Linux, first do sudo dpkg --add-architecture i386 and sudo apt-get update do you can get this package.
    – Ryan Kozak
    Commented Feb 16, 2021 at 18:14

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .