About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
* K- N8 W; Q5 b1 j% d' U<TBODY>, V$ o! e1 F- a! [# c
<TR>( |# A  u: _+ \5 r
<TD><PRE>Method 01
2 J" E* ~: ~* W6 e9 L- m! x=========, y7 F9 d; _: }; n6 }2 M+ z

" v# u( |" S- R! \' x6 X  WThis method of detection of SoftICE (as well as the following one) is5 e5 N" [2 e* I$ Q# O
used by the majority of packers/encryptors found on Internet.: G9 D' _2 q/ U7 `( o- ^
It seeks the signature of BoundsChecker in SoftICE0 V- \3 Z9 Z4 w5 J

- b2 u8 F7 K! @5 b, _  g, x! j    mov     ebp, 04243484Bh        ; 'BCHK'
. `* R8 |# P+ v4 N# k1 h    mov     ax, 04h8 c6 d& T4 ]4 R& T  V9 G
    int     3      
& ?& c. I7 j' O" b4 }4 H) V6 ~    cmp     al,4; K' X5 ]; ?0 c
    jnz     SoftICE_Detected
# S' e. a& ^1 m( x! U
9 Y4 z. N+ Y( x& [* }& m; V___________________________________________________________________________" s1 f1 c5 D' o6 Y
  g7 s$ Y1 n9 j: c9 Z* j& l( ?7 _  m" l. N
Method 027 J, R$ D3 ~2 x2 k# [# e$ T
=========: d, [  a$ T  A0 U7 {2 m

( A" E7 p' @1 D& r! sStill a method very much used (perhaps the most frequent one).  It is used. J3 ?5 W$ N; B- S  Q6 s
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,
/ y1 e/ ^: n# n0 g% Por execute SoftICE commands...
" t+ |0 J/ t6 W- w/ tIt is also used to crash SoftICE and to force it to execute any commands" d7 D7 A2 p- w
(HBOOT...) :-((  5 b9 F* y7 y4 b  W& Z& \
# f' h: M- @6 }- ], o
Here is a quick description:9 r9 N% O2 I" \
-AX = 0910h   (Display string in SIce windows)
+ B9 U" v* O( p-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)8 H3 I9 \$ f/ g1 U" O* d
-AX = 0912h   (Get breakpoint infos)
, e# O: R, d1 k7 @-AX = 0913h   (Set Sice breakpoints)% o& h' k: U' o- ]' e" B7 ?
-AX = 0914h   (Remove SIce breakoints)
# Z2 b* s9 M- K- L, q% |& ]- U5 D& d+ E/ ^" x  s" b- I" l
Each time you'll meet this trick, you'll see:$ {# |6 X6 k& u) w- w9 Q
-SI = 4647h$ P  f3 J8 E# c0 M4 h! P
-DI = 4A4Dh
) V' A9 ], p! o0 }- _& o, OWhich are the 'magic values' used by SoftIce.. P9 m9 K3 l3 i- A0 j
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.
2 A3 }" {' {- P* ^1 s$ ]6 U) y5 ]5 Z: |! V$ {
Here is one example from the file "Haspinst.exe" which is the dongle HASP
2 x( O* M' R/ BEnvelope utility use to protect DOS applications:
, z: K9 l1 |7 |0 S, T8 ?
4 d. I  ^4 v% G! f9 f0 L: N) ]8 ^* Z1 ]5 Z& q/ o" O" e
4C19:0095   MOV    AX,0911  ; execute command.
; l$ G& l; k1 n2 }2 x4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
7 R; [2 Q3 ]& L7 h9 _3 m4C19:009A   MOV    SI,4647  ; 1st magic value.
9 |' N* l! [1 i4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
. ~& G8 y3 ]% o7 X3 n! c4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)  T+ m4 q/ Q. Y* }
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute4 c& G4 h+ n% i, Z4 ]- R
4C19:00A4   INC    CX
, ~5 c4 ^: r- r( M: U4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
& b* X$ L1 P1 x$ V/ Y! Y9 g5 g: @) V4C19:00A8   JB     0095     ; 6 different commands.
0 w2 b+ m: k( x2 f  ^  Y4C19:00AA   JMP    0002     ; Bad_Guy jmp back.% C+ L& ^( L7 z1 t
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
% a5 E( b, ?9 f
* t! g# V3 j1 F7 qThe program will execute 6 different SIce commands located at ds:dx, which
- r# j: \! I7 V: o+ c: hare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.. T& T' U% ]1 U3 ]/ h

' k7 r/ |4 O. [0 a2 X: K# h* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
$ |1 F" ]( Y% `& }' X3 Q5 H___________________________________________________________________________
& [9 l- b" `, r
3 E8 F" k7 o* R2 q* S$ h  t7 S( G9 p* J$ c# z
Method 03& F5 f6 i( y8 }" _; v2 }8 F' V( O2 D2 R
=========) m& ~1 ~# x* h1 a2 R+ G: B8 s

) t6 A5 i; S+ {: d4 d% VLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h5 M" L4 |$ m# l$ Z* _' z. b
(API Get entry point)
  ^8 I! \. \2 R# h' m$ Y$ A0 ?  x        
, L  _2 n" |+ M( U( O, c/ P1 M2 E" \2 `! h9 ?! [5 X/ \
    xor     di,di. S7 k. C3 \+ p7 s2 r! G
    mov     es,di* P) C/ u+ o! S: ]
    mov     ax, 1684h      
8 Z7 _7 r$ h3 P( Y2 D  I: ~" }    mov     bx, 0202h       ; VxD ID of winice5 S, |8 C1 I2 S! t8 B$ B8 R
    int     2Fh
- U% ~/ _! k) P) V    mov     ax, es          ; ES:DI -&gt; VxD API entry point- S: b8 X% B/ x' z: t" V
    add     ax, di$ _4 s% I6 s, t
    test    ax,ax6 c# E, V7 q8 m+ h0 x
    jnz     SoftICE_Detected
- b: J) F- |, [8 a% D, b* T) V* N+ v8 O0 Y+ @
___________________________________________________________________________
( b2 H% E& Y3 I2 {  o
; w! G3 }6 {; i5 H7 NMethod 04; e# S2 ~) ]$ @, K" Q) l
=========  y2 a) @0 X- T3 o5 P/ h
) H. V% K2 K% Y/ l1 U0 s5 B
Method identical to the preceding one except that it seeks the ID of SoftICE
" E. K( b! g. ^% yGFX VxD.9 }2 b& \: r3 I* H" d( Q, n: I- k
* Q, A" P/ h/ \. ?& b! x7 Q
    xor     di,di
2 z* s  e- Z" ^    mov     es,di, F, w  _7 }. s( H% D# `! ^; ^" [" B
    mov     ax, 1684h       8 x2 u0 M0 `- r* X1 i; {( V
    mov     bx, 7a5Fh       ; VxD ID of SIWVID7 K" G0 a+ E% `
    int     2fh+ K# `' `5 b7 W- z4 _% w
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
% R6 D$ x  m6 {) e    add     ax, di; A6 O2 L  m7 z5 ~' q$ b: q9 n- @
    test    ax,ax2 O; u0 X7 E6 z" D+ G
    jnz     SoftICE_Detected
5 _# Z0 |" x; c- z
% S* u1 g6 K7 M3 y  k__________________________________________________________________________4 y7 h9 i; T" N1 `" l7 V' S9 J( L4 u( v
+ Q, d! i/ y  a& H. G- N
% A: h; O1 E) g, v5 s; J; o
Method 05
* @# K" {1 C. S0 f+ W=========
$ i& k9 u2 \( h$ h; x  }3 Y2 j5 l+ F0 _; ]/ d
Method seeking the 'magic number' 0F386h returned (in ax) by all system: A6 w  @0 B1 _7 V, k. o
debugger. It calls the int 41h, function 4Fh.
9 M0 N  m  I& T$ h1 A+ fThere are several alternatives.  - e0 r! S  j/ p! @& j( l# b
: k/ e3 }. s* c3 p
The following one is the simplest:: a8 _1 ~7 [7 {3 F
) N" P- h2 W' W1 B" H% N1 m
    mov     ax,4fh
9 y2 T: v/ ], _1 _& ]6 o: M    int     41h- b3 L, ~4 y2 j4 x, x0 m
    cmp     ax, 0F386" n& L$ M$ j0 m! ]$ ?- o; f& x0 t
    jz      SoftICE_detected
  I* j* p3 C7 W" i/ x9 ^
" t- A; a# k& o& S6 `& y/ s% r& ], I9 b: e& k3 q7 g( `6 Z
Next method as well as the following one are 2 examples from Stone's 6 n8 g. O# |& b& C( u  G# T# V4 i, ^
"stn-wid.zip" (www.cracking.net):2 R$ M' x' A. D  d3 c+ A

0 g+ I, u0 j! ]    mov     bx, cs* r; ~( p1 k# r0 R9 u( [  W
    lea     dx, int41handler2
, I  b9 f/ x+ ]  k/ o& I) j    xchg    dx, es:[41h*4]
* e/ O0 P% @- @# [7 t3 Y. j# T1 h; j* A1 ~    xchg    bx, es:[41h*4+2]
8 _/ p5 D/ ?* B% ]) ^    mov     ax,4fh
; U9 L8 L" I( F    int     41h: R3 O9 ?9 E8 B; a& j( }5 H
    xchg    dx, es:[41h*4]
" D' i4 g+ v! m$ E+ Y    xchg    bx, es:[41h*4+2]' h( Q. O& K. w2 C% B; M5 b
    cmp     ax, 0f386h6 a' S* A' g* [9 o& q5 K
    jz      SoftICE_detected
# b7 z0 P9 ^9 G4 `5 S6 S* y2 Y) e' A' x2 t' m- W6 p
int41handler2 PROC
  `( M4 A: x! g  ~8 o4 a    iret
& i- @! n6 Q4 }0 b: D1 zint41handler2 ENDP
1 u$ P+ v9 Y7 E* @
. p; S" @( ~4 t" s
+ U6 H, [0 ]9 Y- W. __________________________________________________________________________: W" }& I" v/ [/ I' \

6 D& h0 Y- b& M, N* B" B/ {% u5 O# _6 P3 Z; n" [/ x  p# h
Method 06. t0 c" A( H, h3 d
=========( s  U, {" A* [5 \) i& t+ }
1 p. V5 d! C5 a- F9 k
' ?( Z* E0 M$ G( U. C" e' h
2nd method similar to the preceding one but more difficult to detect:
( j  W& O. K  u' ~. K$ D" h& W2 F! \- C; c

* `7 D5 H8 Z" @' w( q$ Y; C. Qint41handler PROC* g( O2 m6 m$ ~$ O) m! N5 X7 Q3 H$ l
    mov     cl,al
6 {- E* y( {7 W+ E" ^* Q  ^4 _) L    iret
' A* l& r3 t# a7 W& p; ^int41handler ENDP3 t. V; [, \' I

  V- Z* T% P$ _4 R: Z" a" X/ h0 {3 Q- k% l/ D
    xor     ax,ax
( v" z. o- A0 v4 i6 N0 S" A8 L+ w    mov     es,ax
$ F' j. b5 B) q8 L    mov     bx, cs# j! _0 G2 _! b% n. g- [
    lea     dx, int41handler: d# I5 B! }' I, z# c) ~* Z( Y
    xchg    dx, es:[41h*4]
7 q$ ]: L- E* V; y5 C    xchg    bx, es:[41h*4+2]
& z  h6 j' B/ B, s( @; n+ L! O& U    in      al, 40h
0 f. k8 j# e' j    xor     cx,cx& `% F( q: q5 M0 J
    int     41h
; q9 n8 x+ @) _    xchg    dx, es:[41h*4]! b1 I) _& M, l6 _
    xchg    bx, es:[41h*4+2]
5 M& c# Z4 K1 e- ^' S6 W. d, U    cmp     cl,al! J- G/ [" p# A1 T* K! v9 y
    jnz     SoftICE_detected
0 Q' \4 l* V' q) D- w$ i3 N( o
' Y3 b+ x! Z" p/ e3 M/ G3 k5 F_________________________________________________________________________* G3 l3 M/ I" q9 ^+ x4 p
. ^7 H6 u% w0 s
Method 07
" z  r& Y8 G0 ^; @/ n=========
- @% o! j: [  Z: g' A- q4 ^
# c# I6 y6 C8 w8 V! ?Method of detection of the WinICE handler in the int68h (V86)
$ C; a. U7 q& {6 m7 K# ~! m% I( I" D6 e  j2 u  U
    mov     ah,43h
1 q& p8 V" W2 ^  M3 h- b    int     68h. g% y, D0 K( x
    cmp     ax,0F386h
* i" s9 ~8 c7 [% c0 R    jz      SoftICE_Detected8 `1 ]$ k" [4 e* o* R+ H
/ j, T8 k4 Y8 }2 v
  a/ d% r3 v& ^$ `7 `7 D
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
: L  B# S0 O9 u$ p) F1 U   app like this:
) ]9 j7 k2 M$ s! y3 |3 R/ n* J# M  B6 P9 s
   BPX exec_int if ax==687 f# |' ]  k$ {9 U; f$ U# j' z
   (function called is located at byte ptr [ebp+1Dh] and client eip is" [1 n( k0 H: {7 r3 T7 z0 ^
   located at [ebp+48h] for 32Bit apps)/ k- A' p6 w  z4 W% N4 x2 E
__________________________________________________________________________
$ p9 c* y: E- l8 t5 D4 }  i8 n1 U# ~+ C; }3 {/ |' Q" q. n

8 m4 u: I8 w' q4 @7 V! LMethod 08
" ?0 I( Y! g: K=========
, z: z1 v2 c# K2 s
' U  u0 C: O; s; ^It is not a method of detection of SoftICE but a possibility to crash the
  s2 J: `/ M" m- ?+ |system by intercepting int 01h and int 03h and redirecting them to another4 [5 {( J* k7 v  Q, \  r1 T9 T
routine.
/ n2 X# L. y3 |! [; _It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points5 e' g3 H+ V- B  q
to the new routine to execute (hangs computer...)
6 U. W* n, j6 H; P8 w( c
( d3 ~: I+ c; f+ H- f1 S& h    mov     ah, 25h
0 b0 {: E7 \$ ^! m, P    mov     al, Int_Number (01h or 03h)% b* j" Q4 }5 `* W7 E
    mov     dx, offset New_Int_Routine
; n* O& R4 v! {: I# W4 n- K    int     21h
0 D0 C# a, J) G, Q  ~# M' [
6 H: O9 ?7 E8 N6 \! [__________________________________________________________________________
5 ^9 p  v8 i3 E/ g# ]* J- G
4 Z2 D2 e" Q: P: `Method 09
7 a* O- f$ _9 z7 q: C" C- K/ V=========: q8 \; D4 M' t. p2 F9 `9 `- M; c2 s0 o
5 F% X4 {: c$ X) o. i( Z: Z# }( J
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only- d: [7 b6 Y" t( Y5 P$ p: b
performed in ring0 (VxD or a ring3 app using the VxdCall).
1 M' x* j, s" W/ u9 z# l+ [9 W( ~The Get_DDB service is used to determine whether or not a VxD is installed
, i9 Z0 H% ]: ]5 M: rfor the specified device and returns a Device Description Block (in ecx) for& u' m- X. A* ~3 ?1 V# C( ~. Q
that device if it is installed.
2 Y2 T$ e; W5 g+ p9 |1 E
' K! m. Z& O- K   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID+ y- E" C8 g, Q4 _
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
; M, Q2 j/ [. `6 M   VMMCall Get_DDB' V6 _! G$ i, [, a- @- s. K9 g9 X
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
, Q" D' I# v! e& w. C/ t* p- Y! V8 J6 F7 I  l6 b; l
Note as well that you can easily detect this method with SoftICE:8 D/ M6 {7 I& Z6 h- l3 i
   bpx Get_DDB if ax==0202 || ax==7a5fh, V/ }: V) Z( f3 @' ^: y5 l9 h+ W; V1 O9 _7 R
( b2 q' S' d4 @9 W6 |6 z" [
__________________________________________________________________________9 f$ J0 o! L9 O5 q5 {1 f4 G

6 T9 F- G" \9 Y/ F2 X6 ^! YMethod 10
" z6 s9 m7 r3 g=========9 h3 ]  N, x. ?" I, }
) A- Y$ Y" e0 y9 W4 w$ Z7 O3 M
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
, I; b6 f7 q, Q3 r  SoftICE while the option is enable!!
( s% s7 f/ `# t: R' n; `, H' P! w
, E; y( K( D: GThis trick is very efficient:- T8 w5 D3 P, \1 R' z
by checking the Debug Registers, you can detect if SoftICE is loaded, F, a. \2 e* r8 V3 _
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
* ^! ~, @) h( ^# R& W, rthere are some memory breakpoints set (dr0 to dr3) simply by reading their
" c/ L( o: ~5 i; M/ \; I; k/ f: Ivalue (in ring0 only). Values can be manipulated and or changed as well
% B9 O6 ], ^9 y$ q1 E' _9 ^(clearing BPMs for instance)& `8 P: W2 c4 `8 E; m) t: K7 J: S

* W; {/ X5 [1 d2 Y- p% q__________________________________________________________________________0 q1 h: u8 `0 \2 u: }* d

( }( ~6 g$ }2 u; U* L0 VMethod 11
# e. ]. X" k9 W- E4 G! h* Y) L) X=========% y6 M, l) @# D/ O- |. s1 _

$ r8 I, r: m9 m0 I5 }; w6 xThis method is most known as 'MeltICE' because it has been freely distributed* [$ [+ n$ [) P* g: O
via www.winfiles.com. However it was first used by NuMega people to allow
; w: n& Y) _9 mSymbol Loader to check if SoftICE was active or not (the code is located' K1 Q8 q2 y' u, q; i
inside nmtrans.dll).
% T% u4 l3 V' D  w& B; M
7 c/ c+ V/ c. Q9 N6 D1 fThe way it works is very simple:
1 _5 U* G, B6 G; RIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for  F. I+ v  g/ Z4 A9 ]
WinNT) with the CreateFileA API.9 i9 |& ~" E/ d. b: `* h; a

- G2 V  H! B3 |5 z$ jHere is a sample (checking for 'SICE'):0 ^2 @) l& V- |3 ~: B
- A3 M" z$ f: U/ n6 m; |
BOOL IsSoftIce95Loaded()
! M/ p0 S( z! Z4 e. O' k{
8 p9 q8 c) _2 h: @   HANDLE hFile;  
8 x1 o% h. U2 k. |9 B. m+ `   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,% N' v% A0 T0 b9 b: f1 _: Q; L! @& `
                      FILE_SHARE_READ | FILE_SHARE_WRITE,' Q* ]8 a2 v+ a$ n
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);* R. p! V3 V) P2 u4 v
   if( hFile != INVALID_HANDLE_VALUE )
* m. |0 m$ I2 H8 A! |   {! E3 q1 H9 F- m: H) }- \
      CloseHandle(hFile);9 X* |# B3 X; ]$ [2 }7 ~  \3 T3 i
      return TRUE;
- U8 A* g& B& \; |! _( T   }7 D( N. D3 Y9 u' N
   return FALSE;
5 {4 q, \. D! W5 Y8 r' o1 Q}9 `; v+ ]/ A$ m6 ^/ o) f  t

# M3 F  d& _- a. CAlthough this trick calls the CreateFileA function, don't even expect to be% C: ~( k! i5 H+ T/ f1 }7 g
able to intercept it by installing a IFS hook: it will not work, no way!
5 p" e4 V0 u6 x9 ]3 D# cIn fact, after the call to CreateFileA it will get through VWIN32 0x001F
) Q! Q0 q! v- e2 @+ Uservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function); y6 l* u" f2 k' t3 X
and then browse the DDB list until it find the VxD and its DDB_Control_Proc
( c/ h5 P' @/ hfield.9 E& r  ~: o8 X" i
In fact, its purpose is not to load/unload VxDs but only to send a ! }; Z6 I8 e( j. _% q+ d
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)% \/ z- |( q+ Q; ~
to the VxD Control_Dispatch proc (how the hell a shareware soft could try
7 m# Q. E3 n3 E9 Sto load/unload a non-dynamically loadable driver such as SoftICE ;-)., V+ M$ M. `6 m; v
If the VxD is loaded, it will always clear eax and the Carry flag to allow- A# Z. V4 X+ s$ I6 B2 u
its handle to be opened and then, will be detected.
: b: s5 E: T% l& K# r' bYou can check that simply by hooking Winice.exe control proc entry point( \+ t; f1 C4 O5 J0 O2 C0 Y) g
while running MeltICE.! {- Q0 z8 m3 Q3 _
4 V+ [) n" y" z6 d0 Q. O
" ~' E+ t: \+ U- [* j, J
  00401067:  push      00402025    ; \\.\SICE
+ ~; g8 a- b3 x6 x" O& X& \  0040106C:  call      CreateFileA% R& t) U+ H4 e0 t, b/ w' U
  00401071:  cmp       eax,-0010 r7 c  z6 `& N8 ?: }5 P
  00401074:  je        00401091; D: s# N' z" H7 M( a

4 D7 u5 S: I2 m1 |2 O* g4 c
6 f# ^/ t; D; E! w1 X9 o7 z4 EThere could be hundreds of BPX you could use to detect this trick.6 J$ l, U9 t* ?4 K) a) Z6 J# L$ ?
-The most classical one is:
7 e8 r+ n% ]* r' b) ^  A  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||1 F5 J1 j$ L* m9 e
    *(esp-&gt;4+4)=='NTIC'
# I& Y1 X$ |6 ^5 o3 R9 e$ u1 |' ^, x+ C7 t" J2 X6 y
-The most exotic ones (could be very slooooow :-(
) B% D# v. N/ ]. x8 p/ `   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
9 }. F# L( m5 |6 s     ;will break 3 times :-(
/ @  t( A1 D2 ?% g9 B# W4 b% w; x- O
-or (a bit) faster: 7 y! t9 g) K' c9 K$ K+ j* U
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')& m5 ~7 R- W# |1 K9 i
) g# x6 v1 E7 x- ^7 Z, t6 {- S/ R) T. w
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
9 W4 l4 E" R4 g4 K     ;will break 3 times :-(
/ ?  f2 `( F  t* @# [2 `$ u
" K5 _: k4 q) Z* X$ [8 r-Much faster:/ X, [3 f$ p) i. I0 L; x/ c
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'/ a1 M. ]* D3 e0 g
6 ?4 E, K6 r7 c7 {! P& W
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen
( E; d5 n6 F5 H9 y  i* l5 D/ }function to do the same job:7 F* ~, F0 W: K& X5 s0 k# r+ m6 e
3 V% X9 [0 Q1 k8 p; w6 q8 B
   push    00                        ; OF_READ
- V, c4 `: [7 b; n# o& `) Y3 g! S   mov     eax,[00656634]            ; '\\.\SICE',0  [) U- v. Y# l4 M3 r; h
   push    eax) n) t. m9 J0 C1 B
   call    KERNEL32!_lopen
; x' h4 X7 z5 A" \+ _   inc     eax
* }+ }+ V- k. _: D& |1 s# P# U6 X   jnz     00650589                  ; detected, D" B% s6 b; n( l# q
   push    00                        ; OF_READ! h& A+ @3 ]  M) c1 B
   mov     eax,[00656638]            ; '\\.\SICE'" ]! v% ^4 x$ F3 Q
   push    eax
$ k1 r0 U+ B  g- t( W   call    KERNEL32!_lopen& b" S' t: B* b+ h5 f
   inc     eax
& M; |8 Q) |5 r, ?; r   jz      006505ae                  ; not detected: M% a9 B) }5 R
1 @" n$ r& S& ]/ K) S

" |- T9 g& \! `  C. K) K- I__________________________________________________________________________
4 Y7 G/ w  U* F0 R
( s: U3 T% ~/ z. P  D) X9 `" tMethod 12
, m) L5 b( r: I' X, [=========
  p' p! c' z4 ?8 F3 G# w; P% u+ _, y% O$ T5 Z
This trick is similar to int41h/4fh Debugger installation check (code 05
1 O* ]0 z& x9 M' w5 _8 B&amp; 06) but very limited because it's only available for Win95/98 (not NT)
# A4 s4 h- Y8 E8 V4 y  p! d4 Oas it uses the VxDCall backdoor. This detection was found in Bleem Demo.
- N* x# k6 P/ `, ]; s+ ^, _5 y4 u9 V, W9 j: A  A; O
   push  0000004fh         ; function 4fh" ^# Z) U  x. D8 e, V
   push  002a002ah         ; high word specifies which VxD (VWIN32)# ^) M1 z" O# Z; N. G4 i& u
                           ; low word specifies which service
0 J/ }3 v0 P5 l7 M8 R1 W: G                             (VWIN32_Int41Dispatch)/ @( W6 N% \2 l4 {8 v
   call  Kernel32!ORD_001  ; VxdCall
, O0 s' a5 r  n6 r# j6 G   cmp   ax, 0f386h        ; magic number returned by system debuggers- R6 ]- c  S  h8 G
   jz    SoftICE_detected
) v; g: J  m! }  P6 R/ e5 U) x% s' W+ L2 [% J0 Z9 P4 q+ o( z* X* @
Here again, several ways to detect it:
. }$ N* Y- t% V1 x6 Y1 [
3 Q  D8 `/ i* {( }5 K    BPINT 41 if ax==4f: @) H/ I2 S" Q' x" U9 \  y3 P& E! x6 |

/ g: x2 A5 ^% j- Y    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
6 [# ^9 O3 w" B9 Z# O3 k! i" N5 F. h; x# n+ E! @" A8 b
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A3 P- L  d: Q5 G1 d0 \! ?7 j$ Z+ M

) J0 E( N, P% b& f3 x    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!  i* f" n! K2 u) {; m" i  m

" L/ J( ?2 Z$ P" E% o) y1 t__________________________________________________________________________0 l5 h# b, I$ X" U, z0 m3 e& |6 v

" l/ I  Y- G$ P" FMethod 139 u$ ~3 ]$ J8 {5 m1 s  r% A+ J
=========- u, H( b9 w) v* H% Q$ v

( L1 c* g9 r0 q, _2 Y) E6 A0 YNot a real method of detection, but a good way to know if SoftICE is, S$ ~+ g5 ~5 F; n
installed on a computer and to locate its installation directory.: T/ `, `; h/ W- m4 c3 p
It is used by few softs which access the following registry keys (usually #2) :, q3 @3 q& U& V  y7 C+ s" a

( z5 v5 B8 i4 }% M+ k/ @-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
; B# @! t, {' i# l0 b/ [& L1 s\Uninstall\SoftICE2 F$ @1 S  }' j+ K0 X
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE, u3 W1 t* n6 `; j  Z7 G
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion/ B# s+ C8 w2 w( i8 ~+ I
\App Paths\Loader32.Exe9 V# {) e' c: e& h. _* y% k. [) ]

) b/ ]  _( k' w& m- s
0 w% E- ]0 Y5 y7 |2 ANote that some nasty apps could then erase all files from SoftICE directory2 a! Y! j( e6 d
(I faced that once :-(
* W& Z$ |2 p! y
1 ~3 c: d, D! LUseful breakpoint to detect it:
( ]; r: q$ G( z, E  i1 q2 X" n7 D: F7 B- V( i$ z8 b4 h
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'  n: i4 P. G: Z0 n
  w8 H. j" }( e8 b5 \! l+ A
__________________________________________________________________________
! m5 c- j6 d* E7 ^$ v
6 ]+ v4 h* \- |. X7 k1 |; t  n9 p9 ?* Z( @
Method 14
2 m( M0 ^; E, W=========4 }  G# [/ c% G+ K' P$ r) O
  e+ {, S, a% m; J* C1 \+ i- k
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose0 `/ ]  I- _$ e" Z- e9 ^% Z
is to determines whether a debugger is running on your system (ring0 only).
) W$ `" F) N9 k* H/ R5 q: _- o" V
6 C" I" ^: |" m& s8 m0 P   VMMCall Test_Debug_Installed
- B* k9 t- U  ~   je      not_installed
% D% s- k! L0 i- ~% H
' j. D- n3 l/ h* P% UThis service just checks a flag.9 q$ z$ x9 V% [2 X7 e( N
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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