October 8, 2022 at 9:11 PM
October 8, 2022 at 9:12 PM (October 8, 2022, 09:10 PM)Giovanni0 Wrote:(October 8, 2022, 09:04 PM)achillescarter Wrote:(October 8, 2022, 09:02 PM)yumi Wrote: Linux Privilege Escalation using LD_Preload - Hacking Articles wizard@photobomb:/tmp$ sudo LD_PRELOAD=/tmp/shell.so /opt/cleanup.sh sudo LD_PRELOAD=/tmp/shell.so /opt/cleanup.sh ERROR: ld.so: object '/tmp/shell.so' from LD_PRELOAD cannot be preloaded (invalid ELF header): ignored. ERROR: ld.so: object '/tmp/shell.so' from LD_PRELOAD cannot be preloaded (invalid ELF header): ignored. ERROR: ld.so: object '/tmp/shell.so' from LD_PRELOAD cannot be preloaded (invalid ELF header): ignored. October 8, 2022 at 9:19 PM (October 8, 2022, 09:11 PM)pandu Wrote:(October 8, 2022, 08:56 PM)11231123 Wrote: For root: Compile a library, that will execute your payload. https://book.hacktricks.xyz/linux-hardening/privilege-escalation#:~:text=LD_PRELOAD%20%26%20LD_LIBRARY_PATH October 8, 2022 at 9:22 PM (October 8, 2022, 09:19 PM)SirKonafa Wrote:(October 8, 2022, 09:11 PM)pandu Wrote:(October 8, 2022, 08:56 PM)11231123 Wrote: For root: Compile a library, that will execute your payload. The problem with this is I can't run the "gcc" wizard@photobomb:/tmp$ gcc -fPIC -shared -o pe.so pe.c -nostartfiles gcc -fPIC -shared -o pe.so pe.c -nostartfiles Command 'gcc' not found, but can be installed with: October 8, 2022 at 9:23 PM (October 8, 2022, 09:22 PM)achillescarter Wrote:(October 8, 2022, 09:19 PM)SirKonafa Wrote:(October 8, 2022, 09:11 PM)pandu Wrote:(October 8, 2022, 08:56 PM)11231123 Wrote: For root: Compile a library, that will execute your payload. Compile it locally on your own machine then transfer it to the target machine. October 8, 2022 at 9:29 PM BTW, if you are having trouble with compiling the library and such, the /opt/cleanup.sh script also runs stuff like cd,find,chown with relative paths. So, you can also go the path hijacking route too. October 8, 2022 at 9:34 PM (October 8, 2022, 09:19 PM)SirKonafa Wrote:(October 8, 2022, 09:11 PM)pandu Wrote:(October 8, 2022, 08:56 PM)11231123 Wrote: For root: Compile a library, that will execute your payload. sudo -l doesn't give any information about LD_LIBRARY_PATH. Also, that hacking article mentioned that if u run: sudo -l and you see the output like: env_keep += LD_PRELOAD Then u could gain root via this method! October 8, 2022 at 9:37 PM October 8, 2022 at 9:38 PM (October 8, 2022, 09:37 PM)testbypsy Wrote:(October 8, 2022, 09:29 PM)11231123 Wrote: BTW, if you are having trouble with compiling the library and such, the /opt/cleanup.sh script also runs stuff like cd,find,chown with relative paths. So, you can also go the path hijacking route too. ? October 8, 2022 at 9:45 PM (October 8, 2022, 09:38 PM)11231123 Wrote:(October 8, 2022, 09:37 PM)testbypsy Wrote:(October 8, 2022, 09:29 PM)11231123 Wrote: BTW, if you are having trouble with compiling the library and such, the /opt/cleanup.sh script also runs stuff like cd,find,chown with relative paths. So, you can also go the path hijacking route too. you get asked for a password kiddo ! (October 8, 2022, 09:38 PM)11231123 Wrote:(October 8, 2022, 09:37 PM)testbypsy Wrote:(October 8, 2022, 09:29 PM)11231123 Wrote: BTW, if you are having trouble with compiling the library and such, the /opt/cleanup.sh script also runs stuff like cd,find,chown with relative paths. So, you can also go the path hijacking route too. oh dang , it works , my bad i was also including the export command :) |

