linux elf segment option excluded from protection failed

Issues related to VMProtect
Post Reply
leonaiverson
Posts: 8
Joined: Fri Mar 14, 2025 3:31 am

linux elf segment option excluded from protection failed

Post 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.
Admin
Site Admin
Posts: 2729
Joined: Mon Aug 21, 2006 8:19 pm
Location: Russia, E-burg
Contact:

Re: linux elf segment option excluded from protection failed

Post 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
leonaiverson
Posts: 8
Joined: Fri Mar 14, 2025 3:31 am

Re: linux elf segment option excluded from protection failed

Post 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.
Admin
Site Admin
Posts: 2729
Joined: Mon Aug 21, 2006 8:19 pm
Location: Russia, E-burg
Contact:

Re: linux elf segment option excluded from protection failed

Post 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.
leonaiverson
Posts: 8
Joined: Fri Mar 14, 2025 3:31 am

Re: linux elf segment option excluded from protection failed

Post by leonaiverson »

yeah.thx for your help.i'll use it in another nornal way.
Post Reply