Skip to content

Instantly share code, notes, and snippets.

@lionaneesh
Created September 8, 2019 18:21
Show Gist options
  • Save lionaneesh/cc3df084de99e3223b9972c778d16e46 to your computer and use it in GitHub Desktop.
Save lionaneesh/cc3df084de99e3223b9972c778d16e46 to your computer and use it in GitHub Desktop.
Backdoor, Reverse, Affinity CTF 2019
undefined8 main(int argc,char **argv)
{
__uid_t __uid;
__uid_t _Var1;
__gid_t __gid;
int iVar2;
char *sh_color;
ulong uVar3;
xor_4f(&DAT_003020c0,8);
sh_color = getenv(&DAT_003020c0);
if ((sh_color == (char *)0x0) || (uVar3 = passenvvariable(sh_color), (int)uVar3 != 0)) {
__uid = geteuid();
_Var1 = getuid();
if (__uid != _Var1) {
while( true ) {
__gid = getgid();
iVar2 = setgid(__gid);
if (iVar2 == 0) break;
sleep(1);
}
while( true ) {
__uid = getuid();
iVar2 = setuid(__uid);
if (iVar2 == 0) break;
sleep(1);
}
}
xor_4f(s_"$)&)_003020b8,6);
execvp(s_"$)&)_003020b8,argv);
}
else {
xor_4f(s_`-&!`<'_003020b0,7);
while (iVar2 = setuid(0), iVar2 != 0) {
sleep(1);
}
execlp(s_`-&!`<'_003020b0,s_`-&!`<'_003020b0,0);
}
return 1;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment