; Ä Private netmail/matrix/fido ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄMatrixÄ
; Msg  :  239     [1-243]                    Uns Pvt Rcv K/s
; From : Ingo Alberts                        26-Jan-96  16:40:00  2:240/5300.1
; To   : Ralph Roth                                               2:246/2101.2
; Subj : Re: Anti Debugger Tricks
; ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄNETMAILÄ
; Hallo Ralph,
;
; zu Deiner Message an Max Maischein vom 25.01.96,
; Sbj. "Anti Debugger Tricks" im Echo "ASM86.GER", erhalten: 26.01.96
;
;
; RR> Ich habe neulich ein paar ASM Files bekommen, in denen Du
; RR> Anti-Debugger Tricks presentierst. Auch aus HackStop haste ein
; RR> paar Tricks "gerippt", haetest mir wenigstens die Teile zukommen
; RR> lassen. Anyway...
;
; Da waren von HS welche dabei?
;
; Den "Anfang" von HS habe ich ja "ueberstanden", aber dann bleibt S-Ice
; einfach stehen.... Man muesste eine Qualified Breakpoint-Routine
; schreiben, um gewisse Faelle abzufangen...
;
; Die Stelle, die den Code ab cs:16h durch den loop_xor ax,bx etc
; neu aufbaut, 161h bytes lang (cx...) , dann int1 und int3 auf
; cs:27h "verbiegt", gefolgt von den "hidden instructions",
; die "enttarnt" einen jmp auf int3 ergeben....
;
; Das dann nocheinmal (ab cs=0b22:0016h) und ca 1.2kb code
; initialisieren. Dann hatte ich keine Geduld mehr (fuer's erste)
; und ein verhaengnisvolles "run" folgte....
;
; ...nebst der gerade aufkommenden Einsicht, dasse es wohl wenig
; Sinn macht, derart kleine Fragmente zu jetzt hier darzustellen...;)
; Wenn man da an die folgeneden ueber 2.5kb denkt.... oerks! :)
;
; Kam darauf, es ueberhaupt mal anzusehen aufgrund W.Marquart's
; und Max Maischein's HS-Hack's (Versuchen...)
;
; V1.11 kann mit wenigen Aenderungen auch "erkannt" werden, wobei
; der Nutzen der Erkennung an sich noch Fraglich ist.
;
; Ein Interessantes Teil ist Dein HS allemal....
; Beinahe unhackable ? (zumindestens ohne Periskop oder ICE und wer hat
; soetwas schon als Privatmensch?)
;
; Aber worum es eigentlich geht:
;
; RR> Also, ich mache jetzt eine kl. AntiHacking Guide. Bitte alle die
; RR> was dazu haben mir per NM senden. Kommt dann rein. 40 KB ASCII
; RR> stehen schon.
;
; Habe einen Auszug eines Teils eines Disk-Kopierschutzes eines
; Install.exe eines aelteren Games, dessen Orig.Disk (Archer's Pool)
; ich noch hatte, erstellt, mit IDA ....
;
; Das Install benutzt gemessen an HS anscheinend recht simple Tricks:


;
; ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»
; º This file is generated by Interactive DisAssembler (IDA)        º
; º Copyright (c) 1991-95 by Ilfak Guilfanov. (2:5020/209@fidonet)  º
; ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ¼
;

;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
                push    ax
                push    si
                push    ds
                xor     ax, ax
                mov     ds, ax
                assume ds:nothing
                call    trap_i2         ; ds=vectable=0000

trap_i2:                                ; trapi2 jetzt vector_1
                pop     word ptr ds:4
                add     word ptr ds:4, 42h; add to ofs vec_1
                push    cs
                pop     word ptr ds:6
                mov     si, ds:4

dec_len:
                mov     ax, 3Bh

neg_bytes:                              ; CODE XREF: code:4688j
                neg     byte ptr cs:[si]
                inc     si              ; decode some intructions...
                dec     ax
                jnz     neg_bytes
                mov     si, sp

xor_them:
                xor     byte ptr ss:[si+0Bh], 3
                test    byte ptr ss:[si+0Bh], 1
                jnz     loc_0_46CC
                lds     si, ds:0
                assume ds:data
                mov     ax, [si-2]
                not     ax
                rol     ax, 1
                xor     ax, [si]
                cmp     al, 0CCh        ; is still int 3?
                jz      is_int3
                xchg    ax, [si]        ; fool debugger!

is_int3:                                ; CODE XREF: code:46A7j
                pop     ds
                pop     si
                pop     ax
                iret
;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
                sti                     ; ab hier code nach neg(byte)
                push    ax              ; 3bh bytes lang
                push    si
                push    ds
                xor     ax, ax
                mov     ds, ax
                assume ds:nothing
                lds     si, ds:0
                assume ds:data
                mov     ax, [si-2]
                not     ax
                rol     ax, 1
                xor     ax, [si]
                xchg    ax, [si]
                cmp     al, 0CCh ; 'Ì' ; <void>
                jz      loc_0_46E6
                mov     si, sp

loc_0_46CC:                             ; CODE XREF: code:4696j
                lds     si, ss:[si+6]
                mov     ax, [si-2]
                not     ax
                rol     ax, 1
                xor     [si], ax
                push    ds
                xor     ax, ax
                mov     ds, ax
                assume ds:nothing
                mov     ds:0, si
                pop     word ptr ds:2

loc_0_46E6:                             ; CODE XREF: code:46C8j
                pop     ds
                assume ds:data
                pop     si
                pop     ax
                iret
;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
                mov     dx, bx          ; bis hier neg'ed
                retn
;ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
