I'm researching the possibility that modifiable environment variables could have security implications. I mounted all writable volumes with noexec. LD_PRELOAD could be an attack surface, but I don't think it will have any effect because of noexec.
Is there anything more to consider in this situation? If possible, how can code (whether binary or shell script) be injected and executed?
OS is Linux. Note that, the EnvironmentFile of systemd is used.
Defenced:
- shared-library from directories with noexec set cannot be loaded. So, Attackers cannot use LD_PRELOAD.
systemd service :
[Service]
ExecStart=/my-program.sh
EnvironmentFile=/writable-directory/env.txt
/my-program.sh :
#!/bin/bash
some scripts...
openssl...