다음에서 찾을 수 있는 dirtycow 익스플로잇 파일을 컴파일하려고 합니다.여기.
gcc -pthread dirty.c -o dirty -m32 -lcrypt
저는 32비트를 목표로 하고 있기 때문에 이것을 사용하여 컴파일 -m32
하고 -lycrypt
예상대로 작동하는지 확인했습니다. 그런데 컴파일 중에 오류가 발생했습니다.
/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
이 명령을 사용하여 multilib와 i386을 설치했습니다.
sudo apt-get install gcc-multilib libc6-dev-i386
하지만 여전히 작동하지 않습니다.
내 장치의 libcrypt 목록은 다음과 같습니다.
$ 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
해결 방법이 있나요? 아니면 컴파일하려면 32비트 VM을 만들어야 합니까?
답변1
libc6-dev:i386
다음을 포함하는 패키지를 설치해야 합니다 /usr/lib/i386-linux-gnu/libcrypt.so
(링커에 필요함).
sudo apt install libc6-dev:i386