If you're lucky and the binary is uncompressed, that string might just be in there raw
this post was submitted on 07 May 2025
5 points (100.0% liked)
Nix / NixOS
2203 readers
65 users here now
Main links
Videos
founded 2 years ago
MODERATORS
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.