About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
, G" }, \0 `2 Q7 V1 O5 U5 |( f' i1 {' h<TBODY>
" z( i1 ]9 X$ a" U, t+ N<TR>
0 Z1 ]+ ^4 f2 b<TD><PRE>Method 01 + M4 f. P$ k% v* q+ y
=========
8 W' x  e8 x. d( A, J0 G. ]
. {, k- J" O8 p7 f- x  g2 }0 @This method of detection of SoftICE (as well as the following one) is
' O/ U' Y8 O$ Nused by the majority of packers/encryptors found on Internet.' M1 F- v! h, o2 ]- M2 I
It seeks the signature of BoundsChecker in SoftICE6 f; ^+ K) s# k4 L! P2 l

8 q5 R5 I: i! t, Y- x! P4 l& S% k    mov     ebp, 04243484Bh        ; 'BCHK'
' j, I0 x1 N1 m. e    mov     ax, 04h) v* n2 _2 o; p/ q7 z. c' t
    int     3       % k' s: B7 y8 g9 W& t
    cmp     al,48 m1 o/ T! q6 q& f  G4 p2 G" n% _3 n
    jnz     SoftICE_Detected& D- K# O% N9 \7 q

- K/ G7 Y  F) z6 ~6 Y. t___________________________________________________________________________, g. d) ~9 |; h7 @  X6 {
9 q, o- [4 w' ~% q* s& X! {
Method 029 w7 d2 K3 C! k1 E6 p, ^
=========" g3 C& N2 F% N  e- G; K# }
* ^) ~# @4 r3 M0 M, y  {: B& }8 ~
Still a method very much used (perhaps the most frequent one).  It is used
$ t5 `5 C" O, _, ]+ c; [# Cto get SoftICE 'Back Door commands' which gives infos on Breakpoints,
+ T9 V) Z- i1 Q9 o& \or execute SoftICE commands...
" ]- t! q4 {  u. r6 O- P7 x9 hIt is also used to crash SoftICE and to force it to execute any commands6 E2 b. i1 e# p: i2 X- p
(HBOOT...) :-((  $ A* T+ I8 |! P7 E! r

$ W4 v) R, j. R; j$ d9 YHere is a quick description:
9 m  B: a# o0 |% p-AX = 0910h   (Display string in SIce windows)
8 M, T+ k! j& A9 S3 X-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
5 ^! R: w' L1 N/ S7 @2 F- W-AX = 0912h   (Get breakpoint infos)+ I8 {$ Y/ e' a, g
-AX = 0913h   (Set Sice breakpoints)( Z# {  H2 N# I" b! Q2 X* {
-AX = 0914h   (Remove SIce breakoints)4 }! Z5 F' ?6 b$ o
6 J3 f9 l+ Q$ [7 R/ _, J& `
Each time you'll meet this trick, you'll see:
* D! w4 Q$ f% L' E-SI = 4647h
5 j# V3 d3 G9 N  `: [3 V-DI = 4A4Dh
8 v' n4 k) n) @- jWhich are the 'magic values' used by SoftIce.
( O+ y( k$ }5 Q6 nFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.
9 s4 T- o2 j+ Y& A% {( f; d
7 V) m3 n" l1 D  cHere is one example from the file "Haspinst.exe" which is the dongle HASP
# N7 q% ^1 x0 @& J  i4 R, J; U2 J, ZEnvelope utility use to protect DOS applications:
5 ^2 F  j# F0 C0 w6 }4 A  s$ N( N6 D5 N
: `" l( j* @& E, }, ^
4C19:0095   MOV    AX,0911  ; execute command.9 |1 b1 y: v+ ^; Q' I4 B
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).6 X( k, e  q8 ?
4C19:009A   MOV    SI,4647  ; 1st magic value.
+ [0 V+ X( Z* y" U- x% b  O- B4C19:009D   MOV    DI,4A4D  ; 2nd magic value., s/ v% Q$ s+ G$ t# l/ {
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)- `3 i" w8 j1 L7 V4 @: S
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
. l$ E6 E. s% z8 V" [% D# W4C19:00A4   INC    CX2 ~2 D3 e. b2 r/ ]6 V
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
1 p9 [; s8 `- ^7 z7 y. j- }4C19:00A8   JB     0095     ; 6 different commands.
  W5 ~2 v" w- T, Z0 v3 y5 V. e4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
1 D2 G" e# I9 {4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
# q& @5 M( a7 i) R9 p# _7 h( _. _, Q, ?- f7 R
The program will execute 6 different SIce commands located at ds:dx, which& S6 q3 d/ a  I7 U
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
1 _. i: l; b8 v; J9 k2 I. B# e8 T  v. ]/ F/ V- M% d
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.: x; H3 ]8 O- Z
___________________________________________________________________________9 g! }  }# }( {: u

7 b3 Z3 a( l% K" B. z) M# g# {1 Y; L6 p9 Q9 Z7 M2 t
Method 039 H" N7 h% e1 J  @: q+ T2 D
=========; \6 |  h' b0 t+ a

2 ^6 W/ A" {7 T$ v" W% LLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h% Y7 G' H9 t" L. o( w, Y
(API Get entry point)
0 Z* h, K8 `& O0 I3 r        
5 w. U! t! C+ T& z" H9 H$ v3 f, a* e1 N6 V4 c; v8 j% A: e0 _4 ]
    xor     di,di+ Q' ]/ l" J& H6 x0 ]' L5 q
    mov     es,di
, D: l+ H( S1 Y4 M$ h$ m6 l1 ]* A    mov     ax, 1684h      
- E$ n6 _+ s% B$ u8 P    mov     bx, 0202h       ; VxD ID of winice
) q! e% {' Y9 e( a2 e; M- `    int     2Fh0 G4 w, Y/ {5 t; y! r5 j7 i( F; N
    mov     ax, es          ; ES:DI -&gt; VxD API entry point! f5 V9 y/ E- ]3 n& Q/ p
    add     ax, di
  u5 e" o: B6 \* `4 j    test    ax,ax
+ ~  a& d7 E* ?" C* p, ?# Z4 n* Z    jnz     SoftICE_Detected
$ J, G: q; [# ~  P( k
7 ~+ @, A5 M. k9 V9 t9 M% h___________________________________________________________________________; Q$ z& |) k, I; S* t( s
( w2 }: y  M6 [5 L# p7 B) }/ N
Method 041 J; Q: J+ o: |0 F/ g! g, ?0 H
=========7 b. ^2 b7 {3 M
' n4 j3 z* l# z9 s
Method identical to the preceding one except that it seeks the ID of SoftICE
) o5 i6 f! P9 Q( P# ~GFX VxD.3 u( d: z! ~( n# a" I7 ?/ ?

: v% ?) ~3 C: C8 b8 }    xor     di,di
( E# C: F; l* r& d  G: p+ ]3 y    mov     es,di2 ~: D( b2 G; _5 |) j
    mov     ax, 1684h      
. K, y, P3 J) @8 c    mov     bx, 7a5Fh       ; VxD ID of SIWVID
( E# y1 f% V& t7 L" Q    int     2fh
/ P3 [( ~0 i  e* Z    mov     ax, es          ; ES:DI -&gt; VxD API entry point
8 m8 F$ ?& C6 }6 `& O$ j    add     ax, di" q4 W7 j+ \3 A
    test    ax,ax
/ k, s# I% d( D- e7 T    jnz     SoftICE_Detected
& H7 H+ A) y2 X- X
& l$ f: T; e5 O$ h' D' w__________________________________________________________________________
# P' ]/ K7 j6 B' r. Q
9 b5 w& h* e8 s% H, [( k  F7 Y0 ~7 f1 B9 D1 G4 N! U
Method 052 I( [; o7 s( a
=========
2 g5 r% a, Q0 K3 y) H! U8 Q$ |, J6 a. O
Method seeking the 'magic number' 0F386h returned (in ax) by all system
) M8 R1 H: h$ Adebugger. It calls the int 41h, function 4Fh.: @& o* \* Z' q  n0 A/ i# T! z
There are several alternatives.  
$ q7 [! u5 }5 q4 q7 Y. b" d/ R- `& m1 |1 q
The following one is the simplest:% t4 x) g$ {4 f) n, o9 i4 I9 v

4 x+ ~3 Z/ z: _3 M  t: H    mov     ax,4fh$ ?4 }$ K- ~; `) C& J6 ?
    int     41h
1 @3 z( i1 p+ _4 q$ @3 y5 h    cmp     ax, 0F386* b6 e, v7 q* D% L1 p* r
    jz      SoftICE_detected! }6 L+ L( m/ r; `. h7 z

- ^* `! A4 H7 G' w/ q+ z% E! D0 w7 a) i2 J
Next method as well as the following one are 2 examples from Stone's
& ?; p: T0 H) U7 C"stn-wid.zip" (www.cracking.net):
1 j# @( _- n/ u* g; V# v7 e: |* A* G2 b
    mov     bx, cs
# {" m- {5 D! L3 a    lea     dx, int41handler2
2 R- [0 p/ N0 {0 D    xchg    dx, es:[41h*4]
$ R8 X9 k, C$ v    xchg    bx, es:[41h*4+2]
. u$ _. D1 A( m! x/ J    mov     ax,4fh
2 P) Q( z# q" q- y1 n& }$ h: W    int     41h8 D( ?7 }' K. ^. k8 m1 _- Y
    xchg    dx, es:[41h*4]. k" l/ U/ i) S" W# X+ X( w
    xchg    bx, es:[41h*4+2]
6 G, u+ O8 o# D* ?8 b' @% J0 Y- c    cmp     ax, 0f386h
6 {# ?0 P, `0 ~( e6 F    jz      SoftICE_detected
5 V1 ?3 k7 J- s) f$ a
. |1 Z: S, D5 p/ d4 L! u. z' J1 a+ H& Kint41handler2 PROC
% b2 m# ?4 N+ q+ D$ ~/ I    iret
) z3 b  l! w% v4 yint41handler2 ENDP
; B; Z8 ^0 |9 C% R' i& p6 h, H2 z" N

& `% L2 O# n# h; h_________________________________________________________________________
* R! Z9 e1 d. e2 Q0 O9 k& g/ b9 w" M3 ?" B8 U' k

7 {. L8 O* ]+ J- nMethod 06
! {3 i7 T' u) k=========
% b  z2 h9 N+ ]7 F4 }3 F7 }- S+ ^+ d6 k$ r  u5 k/ f4 V
+ ^- Y+ ?& B0 S0 m
2nd method similar to the preceding one but more difficult to detect:
- `* S% ~3 p2 p1 p: ~! u' }! X: T# g+ L8 m1 \

8 @6 x) J) z* B' x" `/ nint41handler PROC  {9 e! }1 f. A, N: m, [! O' Y+ V
    mov     cl,al
6 D: b- r' u# ^6 G, ]( `    iret! [5 [. t6 a- z6 M$ y' |/ d
int41handler ENDP* W# r+ W" ?! t1 r: a0 H

1 {( R6 ]7 k+ s1 Q' C; y8 X9 E8 ]) `( w# M) [/ J& S2 h
    xor     ax,ax
2 C: g9 \$ i8 k: S% ]    mov     es,ax% q! X9 p9 N8 E$ y% i8 V- W- ~) ]
    mov     bx, cs
4 h6 m6 r8 s1 z6 ]9 k# o    lea     dx, int41handler: F9 ]2 ?% A# d9 @5 S
    xchg    dx, es:[41h*4]+ t6 i; z6 z/ |' W# V
    xchg    bx, es:[41h*4+2]
) H( `: Q9 l3 d* n9 }    in      al, 40h7 U6 k( B( }, P' y" _, h3 p4 k
    xor     cx,cx
0 }$ H! z" h/ K    int     41h
; f( _7 s9 w. j    xchg    dx, es:[41h*4]
: p5 e( A6 l. G; a1 \" A. s/ \    xchg    bx, es:[41h*4+2]
0 m- y0 [6 J+ w0 d; }. D2 M2 _    cmp     cl,al5 T" u6 X3 `3 c* u" O/ K7 _
    jnz     SoftICE_detected
4 ]( D1 b9 j/ t+ d
, [! ^$ x' n) r% C3 H) k; _5 |9 c_________________________________________________________________________
) ]7 i5 o0 h; A' G$ J+ S+ j+ P" }* [2 A7 D
Method 076 Y& ?* @1 y; g! n2 s" P
=========- L1 j+ U: o3 a, k* z7 m

5 ~2 F3 }1 _! ?& ?" sMethod of detection of the WinICE handler in the int68h (V86). `# v1 O+ J, g! X: v: f5 l4 I* U, z$ x

* t/ F7 x  W/ \0 ?" A# n0 C    mov     ah,43h4 o2 Q7 @( i1 v- X+ A7 n) v
    int     68h& ?' Q$ F2 b9 M( J9 }9 z/ h
    cmp     ax,0F386h3 B2 S3 T: ?. j; j) n8 \* q* l7 i
    jz      SoftICE_Detected
# L: e/ v9 g0 m, R9 u- h0 N6 q$ s9 r) m& ^

' B6 X7 L: Z) n+ X6 C=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit6 ?6 \' y8 D1 c
   app like this:; R9 z2 T( f+ {& q, H  C
1 Z/ v: h. ?: X# {
   BPX exec_int if ax==687 I! [7 ~) W: k2 d( t3 r
   (function called is located at byte ptr [ebp+1Dh] and client eip is+ [- N0 `2 b2 C: l2 v
   located at [ebp+48h] for 32Bit apps)4 o2 b7 F% O4 E$ \0 ?
__________________________________________________________________________
) a& U4 `/ P. @* N4 X0 d4 S% ^9 P* {2 R7 b& t+ N

3 M  M% q! ?* BMethod 08
  j9 D! O. u% \% t1 M% r=========. z" l6 C4 ]& I

; u7 P% D/ i6 O, P( P* qIt is not a method of detection of SoftICE but a possibility to crash the+ L! J# h3 @+ v8 T
system by intercepting int 01h and int 03h and redirecting them to another1 v; B& i  N' @& u% Y9 m1 u/ D* Q
routine.
  U+ Q- K  \3 R9 HIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
: t# k/ _& ]4 e# K& e7 Kto the new routine to execute (hangs computer...)& B, p/ y: N; E- @4 @
& `" K' h; [# f& `- p
    mov     ah, 25h
- h6 p# t* V6 J" U    mov     al, Int_Number (01h or 03h)
3 B2 @( W9 H/ }4 \1 C    mov     dx, offset New_Int_Routine
) a( G9 v3 W- p! m; B) z    int     21h
! [& C' h) [  e6 K0 m: C
1 ^8 r. N$ A3 o! i" \3 B__________________________________________________________________________3 r0 ~6 D" R% B3 M) A# Z, a- v

4 E' W$ C: \! Y! S7 Q! ZMethod 09
- j4 L1 J" f" ~2 u% R4 p=========
$ _, c- b# @& m5 [8 i
( `% w& O! }/ \; R( oThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only* w/ W* ?# p. G, J) m! `( \& b
performed in ring0 (VxD or a ring3 app using the VxdCall).
/ n' ^5 a7 `  m$ UThe Get_DDB service is used to determine whether or not a VxD is installed
4 H( k7 z/ R! \" kfor the specified device and returns a Device Description Block (in ecx) for: h2 F' H- M; `! l& T6 j
that device if it is installed.+ @. I, i) N- Z, S* M

: J( f4 ?$ o. T6 J" H   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID- F7 T  ]2 R( H* I; M
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
9 n# h" \1 ?0 T7 `2 P   VMMCall Get_DDB
$ K& Y7 g3 E; A; g1 v. H   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
/ B9 `) B5 {1 i6 x2 q
- U8 l4 t) s! _9 X" z% p3 gNote as well that you can easily detect this method with SoftICE:3 g' |( O. d2 [1 _9 D6 A1 a8 |
   bpx Get_DDB if ax==0202 || ax==7a5fh
: ], r5 p3 ?) k% M9 m+ K7 Q9 C* h9 y
__________________________________________________________________________3 b6 B0 N+ v, j( |3 }% l& B( T
3 S8 y( Z% C, G: I% V# z1 ?
Method 10
3 r* t4 v$ J/ ]4 {  C8 X  p=========- \2 Z6 w1 k$ ]

5 K! e3 z" ]! C=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
6 Q" J4 t- [' ?& V' P: e7 E4 V" o" L- A  SoftICE while the option is enable!!& x6 Q9 b: t/ m) T
6 B1 Z( ~. E) F; E0 @: ?& i
This trick is very efficient:! d( _% H1 \8 Q
by checking the Debug Registers, you can detect if SoftICE is loaded
8 H* z) {% f4 n( m+ Y. r: E" h% U: j(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
0 f% B2 h/ Z+ q0 o/ n" Y2 hthere are some memory breakpoints set (dr0 to dr3) simply by reading their9 S9 X. r. s: r
value (in ring0 only). Values can be manipulated and or changed as well
4 m" X4 w- i* N  n3 e(clearing BPMs for instance)7 Q& Z/ p" N- Z: o4 ?, Z
+ h& h8 k: ]: N( H
__________________________________________________________________________
. u: S: J; `* S2 X! @, E; A; T* B: o$ u  u. [# y3 I2 b+ }
Method 113 P$ I; L# J2 Y- u5 `
=========
( v, t6 m, F9 z6 C4 i! c  t$ H4 j; f- F8 W
This method is most known as 'MeltICE' because it has been freely distributed
/ Y7 x0 A& E$ M; F2 B5 o7 Qvia www.winfiles.com. However it was first used by NuMega people to allow
( Y; ~- k( J9 m; R6 CSymbol Loader to check if SoftICE was active or not (the code is located
0 k/ a( L+ i' f4 s6 M( c/ \inside nmtrans.dll).
: Z. K& ]4 Q) y* e  l) x
* ^6 T/ H2 K1 {  c9 TThe way it works is very simple:
: C; H$ @* V! }6 g4 J, D, PIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for! H3 b' v* c6 w* V3 t
WinNT) with the CreateFileA API.# F& E( |9 @, x7 C1 S
! S  U' Y  A5 t6 {  G" U8 D
Here is a sample (checking for 'SICE'):8 X! P* x' l- P  O0 J

  r$ E- Y5 X7 s0 ?+ `. uBOOL IsSoftIce95Loaded()
# B; e7 v; V8 J" A' }. S* u6 v{
9 i+ E2 W) n; |# x: e   HANDLE hFile;  ' B9 H- F1 i$ K
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
2 G0 l) R$ M/ L                      FILE_SHARE_READ | FILE_SHARE_WRITE,% a$ I$ F3 ]2 t3 h3 n
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
" H+ O5 h1 z0 m# [: N   if( hFile != INVALID_HANDLE_VALUE )
" l7 E( B6 p0 u. g2 V* M   {2 d0 Y$ O7 l$ n# k; V2 w
      CloseHandle(hFile);, Y7 D) F2 F1 H: z" i# U6 N3 ~$ i
      return TRUE;
" |* Y& G% ~* k3 S; [0 B   }
0 m# Q% t' Q0 E/ T+ j9 @: b$ D   return FALSE;3 O# T# @2 u# I6 X& j9 G6 g, T
}
# I1 g5 W6 v9 Q/ A" m6 L
3 t) o& ~5 O# A8 N: H* cAlthough this trick calls the CreateFileA function, don't even expect to be
/ h+ j( v7 k& S; j; gable to intercept it by installing a IFS hook: it will not work, no way!2 p( K$ H1 G$ v9 ]+ L, j( ^
In fact, after the call to CreateFileA it will get through VWIN32 0x001F
1 C4 g% c  ~8 ?3 Rservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
. G4 B# O% f0 o" M2 O1 A4 P' ~and then browse the DDB list until it find the VxD and its DDB_Control_Proc0 E& i: t3 ?) v9 @
field./ I5 C3 u+ D5 \
In fact, its purpose is not to load/unload VxDs but only to send a - j4 f1 o9 ?. {7 L! x7 x
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)* s* C1 c7 \# N) y, _5 J: A
to the VxD Control_Dispatch proc (how the hell a shareware soft could try
' C' E# z5 t2 G; Ito load/unload a non-dynamically loadable driver such as SoftICE ;-).5 ]$ J; K: {% S7 J! ~0 N
If the VxD is loaded, it will always clear eax and the Carry flag to allow1 @8 @2 A( V: P0 V; N
its handle to be opened and then, will be detected.: c. E! e, G4 n8 }) b
You can check that simply by hooking Winice.exe control proc entry point
3 _7 d# Z7 `1 _# B  X& S: E9 ^while running MeltICE.- X/ X+ H) e7 {9 p' ]. @# q

3 p' q2 v. j) P3 D( v$ q, K* s- i1 y( }$ ~+ y2 G( I* Q
  00401067:  push      00402025    ; \\.\SICE* r- s1 S8 K$ c1 l9 K. L
  0040106C:  call      CreateFileA
$ w- B. ]7 [# b( x2 @  00401071:  cmp       eax,-001
' n9 R! Y1 r4 Y  00401074:  je        00401091
* m# |8 ]. s  L* @' o* G* c
1 w/ _) x$ K4 V% {5 k/ F0 S) u$ `
There could be hundreds of BPX you could use to detect this trick.% }# G) _" i% P/ a1 e, p/ A
-The most classical one is:% E9 q0 D! m# F  C1 t0 z
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||9 z7 [: v. G" l
    *(esp-&gt;4+4)=='NTIC'
# |# m7 F0 y$ A7 s" j: ^/ C4 h8 V5 e: n9 z
-The most exotic ones (could be very slooooow :-(" e4 I7 K, Q$ o# N
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
6 [: g8 W( `% ~- c# }; q     ;will break 3 times :-() O2 j! r0 L) G+ m) C- |) @
& U7 J" w; q9 p" s  \
-or (a bit) faster: ) S. S- [) r6 f/ F3 i" [6 i1 u
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
! K5 a7 Y: T+ V
7 f; }+ c+ C$ \/ q( ]! }0 O2 j   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
9 P# R8 y) m' K$ Z5 n  i     ;will break 3 times :-(
$ h) C  k4 G" l% D3 W$ e7 ~# _' `# g, U% Q
-Much faster:5 V0 R; ]2 q# k, n
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
& ^- `# c6 o7 M
8 R+ f/ J' K8 B; ENote also that some programs (like AZPR3.00) use de old 16-bit _lopen
$ A* P8 U8 S9 P3 r9 v# rfunction to do the same job:  N  G* R, i" h, c

$ L/ F. |! b$ r+ W: _" ~1 m   push    00                        ; OF_READ- ^  g0 c; }+ J! E
   mov     eax,[00656634]            ; '\\.\SICE',0; a0 q6 L5 r" A* m8 |
   push    eax. Z# `2 M! ?( P5 i. [9 R: A' O
   call    KERNEL32!_lopen  C# ~: K6 s: F) |/ u
   inc     eax
  [. S" |. l6 ^% p. k. m/ h1 s% O8 p   jnz     00650589                  ; detected* A3 D/ r; ~6 t/ \, Q& ~4 {- L$ S2 E
   push    00                        ; OF_READ
7 D: G& d7 `9 M+ e: V( a   mov     eax,[00656638]            ; '\\.\SICE'
& x4 c# A& c2 \   push    eax) n# T7 s, T6 H, k3 K
   call    KERNEL32!_lopen; O$ @2 g& x, W! l
   inc     eax
- R$ n9 Z$ Z5 u   jz      006505ae                  ; not detected) O+ V$ _9 U( `  a: W
. {) f( w4 W+ s! M2 u; p; N
3 M* r  Q4 a, x* c- I4 x  G
__________________________________________________________________________* j# h) [3 F% N" }2 P7 [2 Q
( Y/ @3 b! |; e2 |. c6 W) d8 f
Method 12% i- R1 h) X6 f, z7 z4 O" u
=========& {/ Z$ a& `: N- D6 a

! s; W# \& f" K7 W4 F5 e* S3 aThis trick is similar to int41h/4fh Debugger installation check (code 05) [: A. ~% z9 x2 s' p! x- B
&amp; 06) but very limited because it's only available for Win95/98 (not NT)8 T6 o  P+ M! S$ P0 q8 k  V. c+ p
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.3 R9 T( v) z4 c" x# u0 y0 ^9 M
& a# C/ N( a) e2 W4 M9 c# Z
   push  0000004fh         ; function 4fh) S3 T  U- e& Q" }; X0 j7 o
   push  002a002ah         ; high word specifies which VxD (VWIN32)
8 E/ r. j: }$ i6 `, z                           ; low word specifies which service; W) A9 F% F0 Z" C& d
                             (VWIN32_Int41Dispatch), [& T- r' Y; k- W. _8 K# t  I; x
   call  Kernel32!ORD_001  ; VxdCall
/ U+ X+ C) T3 \/ ?0 P   cmp   ax, 0f386h        ; magic number returned by system debuggers
( i4 h1 X# a+ m1 e   jz    SoftICE_detected
1 e& e4 A' ~* s
/ M' A, N' N# @/ CHere again, several ways to detect it:
; b$ u+ [0 A9 O% p0 V9 H7 P% o7 ?0 y- h  y
    BPINT 41 if ax==4f
) A: V& f6 c/ J6 c% H3 G4 c* M- A' E3 p( q
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
" i( _' j- s: X- p4 [9 A: _; y4 `
4 ^  H, d1 Q! m9 A+ A( ^$ n    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
; ?+ ]  n+ f5 u9 g% |( I
, a9 I# r$ r8 x% y( M    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
( m, y" I7 c9 \. T( R' w# P6 Q" @. z
__________________________________________________________________________
* p, g6 j% ]/ G4 @5 I" L7 X6 p8 x; f7 q! E1 S0 z, x; V( w( _1 G
Method 136 L7 i. n2 [5 v& o0 ?$ t
=========1 K$ x' n$ F7 k

: K5 p' D# f7 O( |; [; zNot a real method of detection, but a good way to know if SoftICE is
  m! ]2 e0 v8 ^( x# Vinstalled on a computer and to locate its installation directory.1 ]. k% M3 v, q3 j2 D
It is used by few softs which access the following registry keys (usually #2) :
1 ]+ R, M# V$ h! n6 t- S2 Z9 o8 i
2 b7 f6 E* ~* Z  ~0 K; M2 k-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion5 X. v4 D* H& j  {* Y1 h$ V1 u
\Uninstall\SoftICE" n2 j* i# J9 q/ d5 ?
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE$ `( \0 @% C& l0 N- k0 x; b# W# }* Q& G
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
# ?0 j' t$ Q6 i2 g+ x. I: U" s\App Paths\Loader32.Exe! o" ?/ I; [* }8 A

' K9 i6 t5 o" V+ E: C, Z& k3 ~& b: Y
Note that some nasty apps could then erase all files from SoftICE directory
: h: y3 t- F4 ^8 K(I faced that once :-(
: w2 }6 X5 [% L! w" E# h1 `) j8 [  o6 n& w+ t& p- a3 m( @
Useful breakpoint to detect it:
2 t" _' V( W2 Z9 k: u$ w8 u  t2 L9 f/ ^" h& K1 @9 Q- x2 T
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
6 t" P" E$ w0 [* i# c) Y- i+ f7 x# N: X2 Q' \0 K1 A. j
__________________________________________________________________________
1 H1 H( U4 ]2 a5 Y4 U6 M+ O: H
: P, y+ h) ]9 h) l  z4 |3 E* {9 b6 Y4 T* y2 `
Method 14
. o; W9 ~9 z% [- w; ~; ]=========
: z, }1 P" x& D2 B/ Y  r" l1 I6 ~
( _5 e% D  d4 ^6 n9 ?9 o7 \3 WA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
8 A% d: d# n, }2 Y) ]( zis to determines whether a debugger is running on your system (ring0 only).
* B6 x0 T/ f) b8 W: ~5 H$ j' J4 D% p4 W6 w# m# d
   VMMCall Test_Debug_Installed+ l/ h& b6 ?  V# t0 ]0 Y' d/ _0 c
   je      not_installed
$ x; k& O$ u' h. W& j0 \5 D& n
& ?3 S; j% }, ~# y. ^This service just checks a flag.4 Z- K: B: H) J
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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