slimm609 / checksec

Checksec
https://slimm609.github.io/checksec
Other
2.05k stars 306 forks source link

Search libc at user defined place, allow cross plattform analysis #205

Closed sreschke80 closed 2 years ago

sreschke80 commented 2 years ago

Issue tracker

If any of these values are not included, the issue will be closed and not worked

Issue

The libc is searched through the complete filesystem. This can take a very long time and does not support analysis of cross plattform analysis. For example one wants to analyse libraries for Android on a Linux PC. The Linux PC uses glibc on x64 and Android another libc on ARM.

The optional parameter libcfile allows to specify a libc.so file or a search path, where libc should be found. If libc is not found, the search is done through the complete filesystem.

Debug Report

Checksec debug uid=1000(sreschke) gid=1000(sreschke) groups=1000(sreschke),4(adm),8(mail),20(dialout),24(cdrom),27(sudo),30(dip),46(plugdev),113(lpadmin),128(sambashare),132(wireshark),135(vboxusers),137(notes),139(davfs2),141(untersee) Linux workstation-sre 4.15.0-193-generic #204-Ubuntu SMP Fri Aug 26 19:20:21 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux checksec version: 2.6.0 -- 2022052701 OS=Ubuntu VER=18.04 -rwxr-xr-x 1 root root 35064 Jan 18 2018 /bin/cat /bin/cat: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 3.2.0, BuildID[sha1]=747e524bc20d33ce25ed4aea108e3025e5c3b78f, stripped lrwxrwxrwx 1 root root 21 May 21 2019 /usr/bin/awk -> /etc/alternatives/awk -rwxr-xr-x 1 root root 658072 Feb 11 2018 /usr/bin/gawk /usr/bin/gawk: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 3.2.0, BuildID[sha1]=c8501e8e996c37ed412a87269b6395bc6afbbebb, stripped -rwxr-xr-x 1 root root 22600 Aug 9 2019 /sbin/sysctl /sbin/sysctl: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 3.2.0, BuildID[sha1]=a00798d18069ef7db0dac6f99e562eb52da1da33, stripped -rwxr-xr-x 1 root root 109000 Jan 30 2018 /bin/sed /bin/sed: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 3.2.0, BuildID[sha1]=10744c40e02644c1d07a1298982dd6dc198deadc, stripped -rwxr-xr-x 1 root root 35032 Jan 18 2018 /bin/uname /bin/uname: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 3.2.0, BuildID[sha1]=2b4b6989bb8cf1061951e98ab1cc8e6130f6aa5c, stripped lrwxrwxrwx 1 root root 24 Oct 20 2021 /usr/bin/objdump -> x86_64-linux-gnu-objdump -rwxr-xr-x 1 root root 414256 Oct 20 2021 /usr/bin/x86_64-linux-gnu-objdump /usr/bin/x86_64-linux-gnu-objdump: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 3.2.0, BuildID[sha1]=3cf1d03e9374912c2529dffa9430a6d3f4051c6c, stripped -rwxr-xr-x 1 root root 43192 Jan 18 2018 /bin/mktemp /bin/mktemp: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 3.2.0, BuildID[sha1]=8258387eab419d6c48de0e1f6d6518eac46dac36, stripped -rwxr-xr-x 1 root root 723944 Jul 4 13:25 /usr/bin/openssl /usr/bin/openssl: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 3.2.0, BuildID[sha1]=7c7a35f470131d5bfe29c2e48079fb7fa4771b4e, stripped -rwxr-xr-x 1 root root 219456 Sep 18 2019 /bin/grep /bin/grep: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 3.2.0, BuildID[sha1]=4806f6fd2346800fffcaeedb877623aa54cf94e8, stripped -rwxr-xr-x 1 root root 80088 Jan 18 2018 /usr/bin/stat /usr/bin/stat: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 3.2.0, BuildID[sha1]=a8ada86d60f0d5361c99eb114227dea0b8b133b4, stripped -rwxr-xr-x 1 root root 22792 May 12 2020 /usr/bin/file /usr/bin/file: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 3.2.0, BuildID[sha1]=2b26928f841d92afa31613c2c916a3abc96bbed8, stripped -rwxr-xr-x 1 root root 238080 Nov 5 2017 /usr/bin/find /usr/bin/find: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 3.2.0, BuildID[sha1]=b920f53e0c67a31d8ef07b84b1344f87a0e82d71, stripped -rwxr-xr-x 1 root root 43224 Jan 18 2018 /usr/bin/head /usr/bin/head: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 3.2.0, BuildID[sha1]=f53353500249659d3b82d732445de676de95b24a, stripped -rwxr-xr-x 1 root root 133432 Aug 9 2019 /bin/ps /bin/ps: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 3.2.0, BuildID[sha1]=58b99c8d60ac34519f0295af42103dda69f180f6, stripped -rwxr-xr-x 1 root root 43192 Jan 18 2018 /bin/readlink /bin/readlink: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 3.2.0, BuildID[sha1]=427b7c5d8766a0185381c7ad75855d4758030fb2, stripped -rwxr-xr-x 1 root root 35000 Jan 18 2018 /usr/bin/basename /usr/bin/basename: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 3.2.0, BuildID[sha1]=cb1bb6b3247280ca512b0443ab48fdcf87e32aef, stripped -rwxr-xr-x 1 root root 43224 Jan 18 2018 /usr/bin/id /usr/bin/id: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 3.2.0, BuildID[sha1]=cba786491810c0767b2a66ab876bcb7783955cad, stripped lrwxrwxrwx 1 root root 10 May 21 2019 /usr/bin/which -> /bin/which -rwxr-xr-x 1 root root 946 Dec 30 2017 /bin/which /bin/which: POSIX shell script, ASCII text executable -rwxr-xr-x 1 root root 499264 Apr 8 2019 /usr/bin/wget /usr/bin/wget: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 3.2.0, BuildID[sha1]=970fffbfe51d7e5331e8226842ebf75d5c926dda, stripped -rwxr-xr-x 1 root root 223304 Oct 18 18:45 /usr/bin/curl /usr/bin/curl: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 3.2.0, BuildID[sha1]=72f23eea6078a436cfa5fa66a4dc6a3af3055f10, stripped lrwxrwxrwx 1 root root 24 Oct 20 2021 /usr/bin/readelf -> x86_64-linux-gnu-readelf -rwxr-xr-x 1 root root 596440 Oct 20 2021 /usr/bin/x86_64-linux-gnu-readelf /usr/bin/x86_64-linux-gnu-readelf: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 3.2.0, BuildID[sha1]=95c700acb6ff82dd5498bb2c0c7b32c73e5fb89a, stripped *** can not find command eu-readelf

Command run to produce the error

./checksec --file=../local/arm64-v8a/libwebsrv.so RELRO STACK CANARY NX PIE RPATH RUNPATH Symbols FORTIFY Fortified Fortifiable FILE Full RELRO Canary found NX enabled DSO No RPATH No RUNPATH 1479 Symbols find: '/.local': Permission denied

OS version and Kernel version

Ubuntu LTS 18.04 $ uname -a Linux workstation-sre 4.15.0-193-generic #204-Ubuntu SMP Fri Aug 26 19:20:21 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

Debug output

./checksec --debug --file=/home/sreschke/gutool/project/obj/local/arm64-v8a/libwebsrv.so RELRO STACK CANARY NX PIE RPATH RUNPATH Symbols FORTIFY Fortified Fortifiable FILE Full RELRO Canary found NX enabled DSO No RPATH No RUNPATH 1479 Symbols find: '/.local': Permission denied

And now an endless list of files with Permission denied follows, because on my user does not have all rights.

sreschke80 commented 2 years ago

Replaced by https://github.com/slimm609/checksec.sh/pull/206

sreschke80 commented 2 years ago

PR created, can be closed.