About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
7 k; R" |" e+ h- A<TBODY>
3 V* Y* c3 _; G8 y, M<TR>+ v5 ]. b! v8 o7 F: ~: M5 A  J9 M8 \
<TD><PRE>Method 01
" M6 s" T, a' d4 t) S: z=========
: P8 Y6 [' y  q- ?5 N& F: O9 J# x3 ~1 T* m0 P+ }+ ?
This method of detection of SoftICE (as well as the following one) is2 d5 B6 Y  o  E$ }) ^# }0 J
used by the majority of packers/encryptors found on Internet.
+ O$ A0 S5 W# EIt seeks the signature of BoundsChecker in SoftICE
" G! t0 T2 w# m4 q' A) Y, r3 u# ~* G3 R% n" L  B
    mov     ebp, 04243484Bh        ; 'BCHK'
* x7 i( u) X( I9 H    mov     ax, 04h$ a* g, V& k: h( t/ E0 G* W; ?  ^
    int     3         d1 {# \* |+ g; g- x" w2 y$ I
    cmp     al,4
3 u: R" D" _3 ^( t! v% N    jnz     SoftICE_Detected; \. I9 v3 S- a/ @% b, Y! u

5 v# z% |* ~# |4 o) |4 ]___________________________________________________________________________& h2 ~) k) U6 `  s! ~
! t3 H4 {+ r+ Y* S
Method 02% q3 n& H7 y* y; Q# q5 W- F8 ?! x' `
=========
# Z" _6 U4 M' }0 p
: ^+ |5 y/ h  O) a- T' RStill a method very much used (perhaps the most frequent one).  It is used; I3 @! Z/ o3 T" p
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,
0 j' T1 C) ?4 h/ L7 f! Por execute SoftICE commands...
' _  ^# l( a( e* `; IIt is also used to crash SoftICE and to force it to execute any commands
  L% u- S* r$ m4 ~/ Y5 u& |: C(HBOOT...) :-((  
7 W- N5 U& h0 j6 f9 ~2 [8 L9 s, a! V4 k) @% G5 T: B. b
Here is a quick description:
3 E% K0 B+ ]7 V# N3 p-AX = 0910h   (Display string in SIce windows)
: z% d$ S1 [4 @9 E" T3 w, Z* J-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)5 f' d  A+ @2 |# S" t" r
-AX = 0912h   (Get breakpoint infos)- ?+ M5 G) T# R2 f. s5 ^* @
-AX = 0913h   (Set Sice breakpoints)
9 I  ]4 K% m$ {3 X& N-AX = 0914h   (Remove SIce breakoints)
0 y# T1 D6 o8 `9 W) I, L4 H
7 k4 j' ^1 O) n  }' M! J  n) wEach time you'll meet this trick, you'll see:
9 i* b& A" g7 y1 Q  r5 e5 o2 j8 V-SI = 4647h2 f1 a1 C. o7 s/ r
-DI = 4A4Dh
6 N8 ^1 Q/ c/ `( r) w2 v# TWhich are the 'magic values' used by SoftIce.
: H- l3 D7 o5 O) t6 Z2 `! ]7 iFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.
$ j3 b6 o3 d! E0 j( E6 a" N9 U* z. A2 q+ q
Here is one example from the file "Haspinst.exe" which is the dongle HASP
, X& Y' x4 w  a5 s* zEnvelope utility use to protect DOS applications:
. x! C' X( ^2 s1 A: R! `
1 J0 E3 s, f1 p* J' K; O9 Q7 I8 h7 L) O3 W+ s
4C19:0095   MOV    AX,0911  ; execute command.
5 R/ f1 c3 I% E+ O, m5 ^4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).: n' W7 e" |3 k* S- r/ U
4C19:009A   MOV    SI,4647  ; 1st magic value.7 B1 ?  V, A2 _, e5 `; n% `9 K, @& [/ ]
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.5 ^( r/ u/ z$ K5 o8 c% C1 f/ K
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
0 P0 G  Q# n6 K6 m( U3 ~4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
; l1 O8 u3 N0 g1 m+ b4C19:00A4   INC    CX1 {: M- b+ a! z/ {" r, }6 y- u2 `* e
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
" A  m5 o0 X8 S: e! u9 L4C19:00A8   JB     0095     ; 6 different commands., C1 g) X2 _7 G9 \+ h" E9 Q
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
9 S9 z' Y, b$ D/ d# E4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)5 n' h# Y5 H  K1 ~$ u' f6 i% z
0 y* ]8 j% Q: _9 C: Y
The program will execute 6 different SIce commands located at ds:dx, which
& \0 }, m2 z+ k7 Dare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
! n! I+ e0 `, H6 W: T) o0 I. d
$ T) R& }- M- N* Z! }+ l: k! o* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
5 ^+ x& C+ b* x* W6 F( O4 |___________________________________________________________________________' B! R1 W! p9 u2 }4 g
: T2 O6 @5 I- W+ u/ \3 C

% g2 t" a$ K$ O/ o4 u7 pMethod 03
, @. b7 k8 z" e" i=========
7 X; @7 X( v1 P, U1 d  v  c
2 I+ l3 n9 ^* Y! ~0 H9 ALess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
: Z$ `5 S0 m! K(API Get entry point)5 G" ~2 O% y+ j9 [, }* L4 G8 |
        1 x% Z/ \' y+ `: O- ^) K) t. e

+ Q  [# m/ G2 ^2 a8 _6 J! X    xor     di,di3 m* D  h1 K7 b6 q. j; t
    mov     es,di7 }! [$ Z0 L: e! |/ Y3 U5 g
    mov     ax, 1684h       + c2 Y7 j; P, F* M4 g8 S9 e
    mov     bx, 0202h       ; VxD ID of winice
8 R, u' `# q5 S( f* i    int     2Fh
1 O' v" O+ H/ Q& u: k    mov     ax, es          ; ES:DI -&gt; VxD API entry point( u! F- _7 c$ l- y+ e- b
    add     ax, di& d) T  K/ t$ ]8 W, U/ R
    test    ax,ax
6 K6 t+ R- A  o5 O, ?- \$ u. M    jnz     SoftICE_Detected5 {2 e% L0 X# A6 D0 q

' g& s# a4 p1 {4 |# H& K) Z9 u___________________________________________________________________________1 d7 X4 H3 t0 }5 N2 X* u6 j7 p

. P( H. g5 D% M/ Y3 JMethod 04" W+ Y5 I9 C" t. [5 p+ x) Q1 U
=========: c0 X# m) _/ _. K1 E1 Q- _

. {- R) u' e* b. q3 }Method identical to the preceding one except that it seeks the ID of SoftICE0 i8 q, z* j& P7 {. u# F
GFX VxD.
+ E# O$ e! N( I" Q) h
  \" U! T6 z! a- g3 N    xor     di,di
/ F" z2 n- m' \; Y6 P( u    mov     es,di' Y5 _# _  I0 H0 c' L7 C
    mov     ax, 1684h       # ~$ d5 r7 p! R. P. g+ B5 G" o
    mov     bx, 7a5Fh       ; VxD ID of SIWVID1 P" s- k, l0 ?4 G! a) p
    int     2fh- b9 L7 X9 d9 ^; ^
    mov     ax, es          ; ES:DI -&gt; VxD API entry point) m; W' Q% A0 A9 l/ ?( p( K
    add     ax, di
5 c/ q7 _+ `; `; H    test    ax,ax
; A6 J, F( I8 @) k% V/ M/ M+ k    jnz     SoftICE_Detected4 J' v5 R! ?) o  H* S7 Z

. Y5 W3 w5 B" l__________________________________________________________________________
9 o2 x7 x4 x- s: R; A; A& E2 y* s" N$ z3 V" S/ p
- J, O& g# G( s6 D
Method 05
3 T* U* N" W, k$ ^6 ]- k% a) E7 ?, n=========
0 W+ u% i7 w) v( _3 m
1 ?' {, j& Y9 b% g+ L' @8 xMethod seeking the 'magic number' 0F386h returned (in ax) by all system
5 C4 O% |8 h% }/ A, {5 B+ H1 Fdebugger. It calls the int 41h, function 4Fh.8 x2 {0 b4 h9 l& G& e' T. ^. ]
There are several alternatives.  ' {, Y, j" u" I2 X* X! A7 o

  P2 A/ W! _$ tThe following one is the simplest:- K. H8 v, v# P, d  q8 b8 a
, s6 ~+ s: e* ~1 P
    mov     ax,4fh% N: Z; Y# W- C- ^
    int     41h8 p8 C; |( R. F5 u% L: Z6 P
    cmp     ax, 0F386
* Y( ?- e% |0 K* k* d/ G$ z; w    jz      SoftICE_detected+ _1 p7 j  T% z+ k6 |  J. j# V# B+ L
2 Z/ o& g  }- I

) N) N/ l- w$ \  L7 ONext method as well as the following one are 2 examples from Stone's ) _2 ?# l5 @9 f$ K2 y, s
"stn-wid.zip" (www.cracking.net):$ K* k0 N; C% i0 C
0 _/ \; [) z4 y
    mov     bx, cs
. M0 d' t" p" ?2 W5 r: r    lea     dx, int41handler2+ A& o! R, y. t. |
    xchg    dx, es:[41h*4]
4 ]# q8 N+ M5 r$ |8 L) \, L    xchg    bx, es:[41h*4+2]! o  ?: l- m  N+ ~
    mov     ax,4fh! T; ?$ r1 x& A9 R
    int     41h
& e; d/ M" x+ z" V- d# _    xchg    dx, es:[41h*4]
6 c" a+ L" R  e! D$ s' {! {    xchg    bx, es:[41h*4+2]
8 R9 m7 E0 Q3 m! y9 v- o+ I    cmp     ax, 0f386h
6 _' Z8 F$ w" M: r( S- P' H7 k9 K    jz      SoftICE_detected& D2 k: i) x3 D& K5 P
; t7 ?: J/ i% V6 |% j
int41handler2 PROC
8 s- p1 r. G  C) d. k2 {    iret8 U& e, T- G' ~
int41handler2 ENDP
4 J% T3 F/ K, e7 U* b2 G# ^; m2 {* l4 [% @8 B
  f1 |, g! Z$ u
_________________________________________________________________________" R2 |" v/ n% O9 L, J" t$ `6 S* i- ^
* O6 a0 b2 [' x0 P. A' [

  r+ c: {* t: ]& H. ~Method 068 g  u  N4 }; ]. }. h9 H
=========3 I; o) \+ t" Z* W! l" L4 q
8 U5 ]7 ?$ J0 }. p
$ }8 R& N% p# ^& r/ T
2nd method similar to the preceding one but more difficult to detect:& Q# x6 E. O; @/ b

# S% G4 j, j% f8 T0 u" T# ~9 u2 i' `1 F: b+ h1 {7 i
int41handler PROC
" g6 P: T1 {. a; d" e& S    mov     cl,al
; K8 a: k% w) l, d% w* Y' ~. {    iret" j# Q7 v' `' J
int41handler ENDP
* a9 r% {" f  t, H! _$ P3 @+ C$ ~. K; C( d$ J- b
! K/ U) E3 ^; k- g6 P) F/ e- s# @! Z
    xor     ax,ax
- J! E3 c, Y% c, g    mov     es,ax, B# Q" R8 E, G$ S* S% ]
    mov     bx, cs
4 c! m9 l0 |4 {" |    lea     dx, int41handler' S2 R. y7 g2 L
    xchg    dx, es:[41h*4]* c& b6 H5 z& o) ~9 f/ K+ B
    xchg    bx, es:[41h*4+2]
$ G. v! Y' ]6 _    in      al, 40h* L# O- h/ ^& N0 y
    xor     cx,cx
1 }1 [# d" h5 F4 N    int     41h1 t9 \, g) O0 y' ?( z
    xchg    dx, es:[41h*4]4 }+ A# }/ }- K+ P& e
    xchg    bx, es:[41h*4+2], y9 k" f6 ]) K2 I2 n
    cmp     cl,al5 Z; M' `3 ~+ i9 e! r
    jnz     SoftICE_detected
/ Q. E& x# w2 a9 ]/ {+ c# I2 _. p: y! x) @) L' B
_________________________________________________________________________
) Y* ~# K+ \6 ~5 U- I! `9 E4 D2 u9 y$ @& l( r& i" q6 S2 E
Method 07
8 B' |& ^- m! M! Z  L: ]( u=========
4 i3 M! |; H$ l" d* N" m+ ~- c6 S: w6 K  ^
Method of detection of the WinICE handler in the int68h (V86)
3 R5 i% n( D  m) G$ G2 V6 w4 R3 {+ J' v, x
    mov     ah,43h: s* t. ]3 J; R
    int     68h
6 s0 E4 N( d6 }! d" A: h+ r1 t2 t4 K- X    cmp     ax,0F386h0 W$ D6 R/ P1 }2 T" [% J
    jz      SoftICE_Detected
. _: f$ F6 ?  E5 t. u4 W( d9 z' t# Y* n# e
) x6 F/ ^: Y4 U3 m8 N
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit3 m3 X8 t3 D# T. @
   app like this:1 S4 p6 H5 u/ N) z
( [/ K6 K% C1 f; q7 z' z8 X& f
   BPX exec_int if ax==68) p% o: d0 _& A; A* t- e3 X
   (function called is located at byte ptr [ebp+1Dh] and client eip is
. f$ r" P6 f' h0 l  m5 N# Y" K   located at [ebp+48h] for 32Bit apps)4 [& [5 v, s0 R
__________________________________________________________________________- A- ]" a( v+ x4 s6 Y
& k/ N9 z& ^3 G0 n2 o% C9 W3 q

$ R: x$ y8 T$ kMethod 08
, T7 Q+ o+ N- J; u9 p=========; X1 x3 P( w, x

+ F3 y- p  C3 x. v0 h, xIt is not a method of detection of SoftICE but a possibility to crash the
) @$ j! o9 l# t! {6 c5 zsystem by intercepting int 01h and int 03h and redirecting them to another
/ C4 ^; m$ ?5 c4 z. @/ ~# kroutine.
( ]. ^0 y1 J/ `. Q1 ]It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points6 Z2 [& q; K4 o: {& [% R
to the new routine to execute (hangs computer...): ]7 Z+ ]( L9 @0 w
' ?, i- B' x  `
    mov     ah, 25h
( {* K4 J2 l& z$ S    mov     al, Int_Number (01h or 03h)/ K* r+ u; j9 ?7 g
    mov     dx, offset New_Int_Routine, g5 p; Q$ N& `6 N% ~
    int     21h
* `9 Q9 X! |+ e" S: I' k, y/ B& W& P* g3 I+ c
__________________________________________________________________________7 S( R5 ?: H% D" f1 R

" s" p$ g1 p6 cMethod 09
. e8 w- X' _' ^=========; H/ w" b( U0 Q% q8 d$ j5 [6 k

" a. k% D3 B2 ^! h& W5 ZThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
. T$ D+ r' t3 B9 f8 A1 D' A+ T5 G4 ?performed in ring0 (VxD or a ring3 app using the VxdCall).0 o' t1 q% z% @. D" G$ E
The Get_DDB service is used to determine whether or not a VxD is installed
' i& L' l# C3 sfor the specified device and returns a Device Description Block (in ecx) for
4 ^4 Q, ]* g( d4 U+ n" lthat device if it is installed.
5 Y3 a1 W" ~4 C. h6 k- U7 m# ]; N1 E$ ]1 f  K" Z8 ?1 O# C
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID! ?7 T6 k3 w* p
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
' T9 d( g& G% N; `+ P: C6 _4 K   VMMCall Get_DDB" z. w* W( ~6 e9 E3 {% ~' d8 ]5 [# ]
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed% Z! e0 E& K  a
+ |0 Q: B; s, x
Note as well that you can easily detect this method with SoftICE:; L! G# J! w! k; r- _+ F- c
   bpx Get_DDB if ax==0202 || ax==7a5fh
/ }9 L6 S* @9 N# r+ x  x
; Q+ V6 t. }8 I! A9 |8 h1 f__________________________________________________________________________2 a, ~! e" g4 q9 R2 U0 W# p7 `( }

% s$ W% |) S/ D, PMethod 10
2 L0 @4 ^, W& @" `$ P' |* x- s=========
% C8 x1 C1 i- d* P0 i+ r
* `- I! n* S, g=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with+ M8 z. ?+ o+ U( l# w
  SoftICE while the option is enable!!
! R* I( c) W& G. i) \% n
  E* J2 V0 Q( ^$ P) W0 r! @. vThis trick is very efficient:
1 i( c: G9 i9 E3 T: kby checking the Debug Registers, you can detect if SoftICE is loaded
8 q) g' ]7 {$ {5 O( \* U3 k(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if4 V6 x3 V6 o! h, t1 U) G
there are some memory breakpoints set (dr0 to dr3) simply by reading their! s! V# G# J. I4 r% h+ i
value (in ring0 only). Values can be manipulated and or changed as well
2 ?$ F# n( g+ e+ y2 r" _& P(clearing BPMs for instance)
) `8 e/ j/ T2 G! m+ c, Y+ o
' b9 M' N* G; ?2 m! {__________________________________________________________________________
4 K: I8 ~1 n, o
/ V1 E7 c7 V; Z+ ^Method 11
' M2 {7 ^* H9 L2 Z/ b=========) m( P9 ^1 c' O2 h

, X8 o+ U8 G! K1 ]9 }/ c) h9 c) BThis method is most known as 'MeltICE' because it has been freely distributed
; D# c2 U4 c  L. I/ b, K. ?via www.winfiles.com. However it was first used by NuMega people to allow8 v& L- K; k% ^* r2 ?5 W) b
Symbol Loader to check if SoftICE was active or not (the code is located' ?. C% |, [2 @3 N
inside nmtrans.dll).
8 w; W  Z7 F: ]( l/ D) g6 b9 Q3 b' b) ]7 h% w
The way it works is very simple:
- f! B( b' D' u+ V4 u2 j# s- \It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for7 w) y  n* {2 {0 r) x/ T5 }- ], r5 C
WinNT) with the CreateFileA API./ ?( h. O1 F; J/ {5 y
- I2 m' M6 L- h
Here is a sample (checking for 'SICE'):
* \! t" n. f; B0 t! y$ }$ Z& I* o' w8 h; z- ?* `! e3 ~
BOOL IsSoftIce95Loaded()
! p; ~0 B) O0 V& c0 B{0 |% [& c& R5 {
   HANDLE hFile;    \( w1 v% k4 e4 r5 B" A
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
( O  P1 Q2 n0 f( k                      FILE_SHARE_READ | FILE_SHARE_WRITE,/ f0 i) i2 u2 l. d# i
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);% G9 g% k' y& X7 y/ P7 p
   if( hFile != INVALID_HANDLE_VALUE )$ Z" ]; J/ x: J; ~1 _  m+ f
   {$ g6 S* F% M9 U9 i3 P
      CloseHandle(hFile);
/ e) ~7 ^+ Z* X0 j; }4 D6 q/ h. X5 z      return TRUE;
# _+ g/ T% l; b" d   }% ]; m: O4 {$ K
   return FALSE;& U6 ^& O: A. j$ t/ k% Z3 q6 r
}
( E- A* b2 O- [2 y6 I8 D6 H" L+ h% F* W# l4 D+ B& M
Although this trick calls the CreateFileA function, don't even expect to be$ H0 M( g, ^8 |% }8 J5 ~
able to intercept it by installing a IFS hook: it will not work, no way!' y2 ]8 ?1 G1 c. Z% j) h* d
In fact, after the call to CreateFileA it will get through VWIN32 0x001F; Y) [. l( F9 Z3 N5 Y' f
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
( Y0 q7 d' `7 |2 p' a& Dand then browse the DDB list until it find the VxD and its DDB_Control_Proc
" H. z( g% I7 x% Ufield.
7 \: h- u2 d; CIn fact, its purpose is not to load/unload VxDs but only to send a 7 t! M1 k4 S! U) P
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
" {& p0 j" j- {1 p8 i, ~7 rto the VxD Control_Dispatch proc (how the hell a shareware soft could try
1 f7 C8 W: h+ K2 w1 f% a$ }to load/unload a non-dynamically loadable driver such as SoftICE ;-).
! B- z' T( ~$ C- r2 I5 a# |If the VxD is loaded, it will always clear eax and the Carry flag to allow
8 ~* u' m2 R+ a2 @its handle to be opened and then, will be detected.7 S' S* h! q7 I5 t- J" |
You can check that simply by hooking Winice.exe control proc entry point
2 v4 Y$ L; D. n# L: r! }0 Kwhile running MeltICE.: {8 Z, Q4 B( G6 E6 d
; N: o( A5 T. V/ e* }% f
2 h8 i8 j% p3 S, l
  00401067:  push      00402025    ; \\.\SICE
0 R* H2 L! y+ i+ G  ]8 ?  0040106C:  call      CreateFileA+ y( F0 v1 [) N( [2 m8 p
  00401071:  cmp       eax,-0018 Z- b; V6 B% {" g
  00401074:  je        00401091' }+ n* X  Q- s6 d* Q3 T
8 d& H& p3 A! V
! C( C$ `8 ^$ h/ A/ N9 _1 e% @
There could be hundreds of BPX you could use to detect this trick.
" W3 l+ W" B+ {; ?8 }-The most classical one is:; }, _* \0 I: T' }0 [! ~; T$ k' z0 ^
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||& S! O: Q" u- \
    *(esp-&gt;4+4)=='NTIC'/ I7 g1 r1 _- K; z/ R* q: G( {
" _4 c" o& {  d5 N
-The most exotic ones (could be very slooooow :-(* z8 V4 |. j! ~+ j1 y; v4 {2 o
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
6 s- v' K1 c" P1 z+ U     ;will break 3 times :-(, L, r+ o2 ]$ i+ h, U% [
" g: R1 f, [0 ^+ j: t
-or (a bit) faster:
/ n- @3 i1 }2 X& A3 N   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
# T% l1 \( b+ y& q1 u8 }5 N) D' _- C( P! i( i) ]) h
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
, ]: W6 T* k- C, U     ;will break 3 times :-(8 o' L, n+ T1 H' u2 a$ C

+ _; n7 F9 D( v7 @) O-Much faster:
2 h' @2 p0 p+ d' [9 i   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
/ @7 c2 x! L* {9 q/ i7 ~$ T$ K5 v" A
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen7 y$ c+ H8 V! i
function to do the same job:  e5 F+ V, i# D% ?1 X9 |

& m8 a' y- h, J  c6 Y' \   push    00                        ; OF_READ1 \2 K, @" t* @7 ^0 s2 Y( M
   mov     eax,[00656634]            ; '\\.\SICE',0* d/ T- K3 g6 D& i1 T2 e
   push    eax) M& K$ V" C2 T6 \- M" T& U) ]6 c
   call    KERNEL32!_lopen
# P& y* t: A- N   inc     eax. }2 d1 n+ q& E' ]
   jnz     00650589                  ; detected. M) _" w2 e6 B7 X+ P( ?
   push    00                        ; OF_READ
+ _' s1 r# A/ e2 R: v( b% ], Y   mov     eax,[00656638]            ; '\\.\SICE'
0 L; G6 A8 U4 x2 j6 x   push    eax7 x+ n( c8 Y0 c* X% z5 z
   call    KERNEL32!_lopen
$ V2 `8 L$ b3 {6 s" R/ Z& {   inc     eax
6 Y1 f4 ]( [$ Z: }+ M- }# |   jz      006505ae                  ; not detected
* Q  D  ~+ }7 @0 s/ D: N; }: v
5 o% c7 O" u, v; i8 Z- Z& W: L* P' Y& K( Y; E" I7 S
__________________________________________________________________________: u% S4 {. g9 W
4 g: q$ _  E% i  R8 Z( T
Method 12
: @$ Y0 R/ f& x* B  L3 A; v+ I7 ?3 `=========
6 ~( Y0 c7 c' S
! u) h+ {$ o& Z7 K! R7 cThis trick is similar to int41h/4fh Debugger installation check (code 05
( h3 a+ H: H0 q$ l2 R  p&amp; 06) but very limited because it's only available for Win95/98 (not NT)
: R. D0 s0 {% e4 Y4 e% n  x; X4 O7 [2 }as it uses the VxDCall backdoor. This detection was found in Bleem Demo." @7 I; s& B$ o
" B# z( G* u4 [- B( G( J: F5 u
   push  0000004fh         ; function 4fh
" g) T# _% P6 o9 ]! Q$ q: l   push  002a002ah         ; high word specifies which VxD (VWIN32)$ @* q/ D) n4 f" d7 h/ M3 t* I
                           ; low word specifies which service2 y( a& F# }$ Q' l
                             (VWIN32_Int41Dispatch)
! Y! u7 v, E6 Y8 Q   call  Kernel32!ORD_001  ; VxdCall# x  H$ ^3 [4 }* u
   cmp   ax, 0f386h        ; magic number returned by system debuggers" R/ _6 T" N$ g  _% j. `
   jz    SoftICE_detected$ i+ W& f/ w$ g; x

  {9 s( P' {& G+ n# b$ V$ wHere again, several ways to detect it:
* ?4 H& ?6 n6 \: Z  P* z' F. p  f5 Q/ i5 }
    BPINT 41 if ax==4f
* r6 }2 j2 l7 W: H$ o1 [# f
& t; D0 S' H  C; b, {    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
, T' d' ?/ ?$ D5 V# I( }% E( U2 Y8 C! @# c
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A  i% c& k6 ]  [3 D

; L4 t; B" F1 ?    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!9 K" ?! A3 y/ ?0 a

" d, c; ~3 Q- @6 x__________________________________________________________________________* U4 Y& T- v' O8 @& W/ D: i

$ p; A  B% z2 m; |( P) dMethod 13: m5 X9 ?# F% g& A* N6 [
=========7 F9 a- A, `- g& M8 B% s5 Y+ L
4 u7 Z3 x8 V5 s, ^# h
Not a real method of detection, but a good way to know if SoftICE is
9 r! z3 |3 [$ J5 k0 b' R1 U, e# Linstalled on a computer and to locate its installation directory.
6 p$ z* h. d# GIt is used by few softs which access the following registry keys (usually #2) :
6 F9 h# G% d0 A7 ?. ~( f- o5 e) k; j. O/ ]2 _+ l3 D4 S6 f( E' d
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion' n7 z& w- E2 Y, C+ ~5 i' \
\Uninstall\SoftICE; {1 ]5 @7 u2 u4 C/ \
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
- \4 i. \7 n3 y; P-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
. B: ?! T0 X8 i1 R7 J\App Paths\Loader32.Exe
% Z3 P3 c& a) k* k3 P9 B7 K7 n
7 c/ p4 ~. [( T2 i1 {/ U& \8 P/ f' P9 u6 a0 \( W% D% s4 r( F; t. e( v3 \' X
Note that some nasty apps could then erase all files from SoftICE directory
! z! P7 i6 w9 b7 Z& t& }7 ]+ _(I faced that once :-(, a& W( j4 c8 }' C5 h

. g8 j5 a/ A% Y' k5 rUseful breakpoint to detect it:
4 }) t3 _! q' m/ `$ X: X. y% N$ i8 @
) w/ |, U9 _( w! E; q     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
" X- f& M3 W& r! [1 m% B6 Q' m* w3 {( u( n( {
__________________________________________________________________________
. A# U1 z; l; B2 V3 X
0 F! @* K7 l1 }$ r7 C4 Z6 v7 ?
& W5 K. S8 b+ f$ K; Y: MMethod 14
5 h- _+ J% q" W. T3 @2 v$ h=========
0 D, k0 |& U( G: J3 B0 o$ |( H6 t: ^  \7 I  p' e) X/ P
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
( b6 Y: N3 d1 v3 b6 H; nis to determines whether a debugger is running on your system (ring0 only).
6 C) i8 ^6 A. [
  j- X, J( R0 v  u' k8 Q   VMMCall Test_Debug_Installed
) z, _" a  @/ \% V, b   je      not_installed( A' n# T) T9 n" v6 ?1 c
5 O% O% I  x2 G' I( a
This service just checks a flag.
) ]: L5 w# I  ~" E+ }</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

相关侵权、举报、投诉及建议等,请发 E-mail:admin@discuz.vip

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.|鲁ICP备19052200号-1

在本版发帖
关注公众号
QQ客服返回顶部