Skip to content
Advertisement

Why string shown up in Shared Library file like .so file in Linux?

May I know why the .so file in linux will show up the string value from my cpp code? Even with fvisibility=hidden set in gcc make.

for example, i set “Hello World” and it will show up.

I tried google but found nothing related..

Thanks.

Advertisement

Answer

-fvisibility=hidden only affects the linker visibility, i.e. whether symbols are visible when a linker tries to link against your file. It does not specify any active obfuscation.

Your strings are still placed inside a data section and need to be loaded into the memory space of the process when your library is loaded, so they will still need to be visible when inspecting the file. If you need them to be obfuscated, you will need to obfuscate them yourself and decode them at runtime (knowing that a sufficiently determined attacker can still reverse engineer or debug your library).

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement