If you're lucky and the binary is uncompressed, that string might just be in there raw
Nix / NixOS
Main links
Videos
That's a good point! The string is in there, and I can see it with strings
. But in my research so far it's looking like making a simple string substitution might not be an option. The replacement string would be a Nix store path which would be longer. That would shift over subsequent bytes in the binary which it sounds like would produce alignment issues that would break things.
Apparently it's ok to change the length of the ELF header, which is what patchelf does. But shifting bytes in the ELF body is a problem.
Now what I haven't verified yet is whether the embedded binary is in the body or in the header. If it's in the header - or even if just the interpreter string is in the header then I might be good to go.
You could just change the path in the binary to a string that's smaller than what's in there now (or the same length), and pad any unused bytes with \0
, then symlink that path to your real binary.