I have a binary that is SUID which I can currently use a buffer overflow exploit to obtain an elevated EUID shell.
However I haven't worked much with changing IDs through shellcode, and the file I need to access requires me to have a GID equal to the EUID I have obtained. However, after obtaining my shell, my GID stays the same as previously.
My question: What system calls or shellcode do I need to execute to elevate my GID to be equal to my EUID when the shell is spawned?
Also: So far I have tried setregid and setegid system calls in shellcode before spawning the shell, however both return "-1" when using a GID that is not already my unprivileged GID.
Thank you.