Page 1 of 1

linux elf segment option excluded from protection failed

Posted: Tue Aug 19, 2025 2:27 am
by leonaiverson
hi.
i have a linux elf with a self define setion (__attribute__((section(".sigdata"), used)) unsigned char g_sig[256];)to be proteced. i wanna use vmp in this way: compile origin executable elf file,and protect it with vmp,then cal signature data of protected elf file ,at the end objcopy --update-section to overwrite the user defined section. without vmprotect shelling , objcopy --update-section work fine.but after vmprotect shelling objcopy --update-section report the input file has no sections.i test several option possible related (Details->Segments->Exclued from protection or option->File->pack the output file..),no one work.
is it a bug ? or i use in a wrong way?or something cant be handled technologically?
by the way i use the V3.9.6.2385 windows version to proction linux elf file.

Re: linux elf segment option excluded from protection failed

Posted: Tue Aug 19, 2025 12:22 pm
by Admin
Please notice that a "segment" and a "section" are different things. Try to use the following script:

Code: Select all

function OnBeforeSaveFile()
	local file = vmprotect.core():outputArchitecture()
	local section = file:sections():itemByName('.sigdata')
	if section then
		section:setExcludedFromStrip(true)
	end
end

Re: linux elf segment option excluded from protection failed

Posted: Tue Aug 26, 2025 7:27 am
by leonaiverson
thx for your reply. yeah your script worked , after compiling with the scirpt code,the output can be handled with "objcopy --update-section " (no error msg report ),but when run the "objcopy" handled file it crushed and report "cannot execute binary file: Exec format error" ,it seems the file had been demaged by the command.
and the scirpt code report script error when i use it in windows conditon(windows version vmprotect to protect windwos exe)。it report,"attempt to call a nill value(method 'itemByName')"。Forgive me for not familiar with the lua language.
best wishes.

Re: linux elf segment option excluded from protection failed

Posted: Tue Aug 26, 2025 7:41 am
by Admin
I don't recommend to modify a protected application because it may work incorrectly.

P.S. The PE format contains only "segments" unlike ELF and Mach-O where "segments" and "sections" are available.

Re: linux elf segment option excluded from protection failed

Posted: Tue Aug 26, 2025 8:03 am
by leonaiverson
yeah.thx for your help.i'll use it in another nornal way.