LD_PRELOAD with setuid binary

前端 未结 5 614
野性不改
野性不改 2020-12-17 19:55

I am trying to use LD_PRELOAD to preload a library with an application that has setuid permissions. Tried LD_PRELOAD at first, and it seemed like i

5条回答
  •  自闭症患者
    2020-12-17 20:38

    Install your lib as such:

    • location: /lib or /usr/lib
    • permissions: root:root
    • has setuid and setgid on

    Make sure LD_PRELOAD is exported to your environment

    $ export LD_PRELOAD=/usr/lib/yourlib.so
    $ env | grep LD_PRELOAD  # verify
    

    Then run your program.

提交回复
热议问题