injector
                                
                                
                                
                                    injector copied to clipboard
                            
                            
                            
                        Added fix for sandboxed apps like Flatpaks
On Linux, there is a virtual rootfs path at /proc/<pid>/root, which represents what the process thinks is the rootfs, and also allows you to access those files.
For example, on Flatpak the libc path would be: /app/libc.so. But there is no /app on my system, that directory only exists in the sandboxed rootfs. Luckily, we can still access it through /proc/<pid>/root/app/libc.so.
This fix adds the prefix /proc/<pid>/root to the libc path before calling open_libc, since the root directory exists in both regular processes and sandboxed ones.
Screenshot injecting into Counter-Strike Source, running from Flatpak Steam.
Still works on regular processes also:
$ ./target 
[*] Target Process
Waiting...................................... <LIBTEST LOADED> ..........
                                    
                                    
                                    
                                
Thanks for pointing!
I fixed it by another way. Your code seems to work for processes in containers based on pivot_root, but not chroot.