About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
9 q) n* P  q' r6 j8 q1 \* @, y<TBODY>/ Z1 y7 S/ p* @
<TR>
, z: ^! v' O0 P: m! b/ A+ B<TD><PRE>Method 01 0 K/ R: q, T+ Y
=========6 y/ `! R) F8 E5 M' R% E8 h4 {  k- [
2 L9 y$ f% O1 S
This method of detection of SoftICE (as well as the following one) is: z; \0 H7 b4 \) y. C* f8 O, [6 ]1 q
used by the majority of packers/encryptors found on Internet.( r  u+ z/ n( N. c3 a& k. w8 P
It seeks the signature of BoundsChecker in SoftICE
+ t- W2 k7 L5 G5 p0 s0 n2 D+ c" V$ F! h) p; i
    mov     ebp, 04243484Bh        ; 'BCHK'; u8 T9 i! g/ A& _% m
    mov     ax, 04h1 G8 \! v9 D( {) H
    int     3       $ V0 Y, q5 q1 T/ o* O: ?
    cmp     al,4
. B6 i- w% f. [1 L! q: D6 d    jnz     SoftICE_Detected
* m$ d, q3 G8 l- {
  Y/ z* \8 L' d$ A2 J% K# z___________________________________________________________________________7 Y, ?+ i" B6 }. B$ f! ^# r/ A- ~

8 R& h$ c8 d& u9 r" tMethod 023 d) ?2 X( ~1 x
=========5 H6 q6 b6 _$ C- q, |  g
+ |$ b5 \0 T" F, ~, G
Still a method very much used (perhaps the most frequent one).  It is used
5 r- l! V4 Y& V& Gto get SoftICE 'Back Door commands' which gives infos on Breakpoints,
6 D" s2 R- o6 Tor execute SoftICE commands...
9 ]: z+ J0 W% X1 W3 l6 w3 I/ U, }It is also used to crash SoftICE and to force it to execute any commands4 t: a7 a1 u. _, v! }7 R& `
(HBOOT...) :-((  + z9 k* r2 P/ }" k+ H
" O+ j1 N! X+ C% k3 Y
Here is a quick description:
& r$ K, a9 L, j" g& o0 H' B. H-AX = 0910h   (Display string in SIce windows)0 _8 h8 ^( }- `  t6 E8 H2 ^
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
4 f- Q" f- N1 G9 M-AX = 0912h   (Get breakpoint infos)  F& E7 ?  }0 ]; K& R0 U: O+ S
-AX = 0913h   (Set Sice breakpoints)" s( I5 J* r+ v
-AX = 0914h   (Remove SIce breakoints)
/ {; X& x' f+ ?6 q  x
% i- I1 W2 t" C9 IEach time you'll meet this trick, you'll see:
; {% _  l0 c0 W7 t% @4 Q& h-SI = 4647h4 @% ~* @5 S. t) o
-DI = 4A4Dh
! F4 `# B! B9 g5 F$ {* i  @' LWhich are the 'magic values' used by SoftIce.
$ X. a0 u  P, F5 `For more informations, see "Ralf Brown Interrupt list" chapter int 03h.
/ A- g$ l+ F9 G! e' p) O0 ?
( X+ O0 V3 ^" p% KHere is one example from the file "Haspinst.exe" which is the dongle HASP  t9 S6 X" a# z; z+ k6 T
Envelope utility use to protect DOS applications:
4 N  ?8 e! Z" A5 S8 u* `7 Q: D9 {- [  p2 ?( i8 r$ a
/ X( x# q" E. H' [
4C19:0095   MOV    AX,0911  ; execute command.
6 a( u4 @* L/ C0 w0 F- J0 ^! N$ i4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
5 J' ~2 Q0 F9 _6 r/ U8 C0 q4C19:009A   MOV    SI,4647  ; 1st magic value.
8 r& t* G7 b0 q/ t4 X$ z4C19:009D   MOV    DI,4A4D  ; 2nd magic value.. c1 Q0 V/ Y. g- g: Z6 ]
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
% f- L$ Z3 I7 O$ H+ S7 M6 J- E4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
0 H1 x8 K! ]. l( k$ `! N- p4C19:00A4   INC    CX2 I/ j. o: n6 c. v& P; i4 j
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute/ b( B" K, M) f
4C19:00A8   JB     0095     ; 6 different commands.) ]. m# _( W- G7 v' C
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.1 y5 l4 ?3 t' u+ B" i) P3 [
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
: O1 T' M# f4 M! l5 K1 v6 Q8 Z( X# q" F- ^1 d+ D) v
The program will execute 6 different SIce commands located at ds:dx, which1 C$ Y/ X* m8 ~0 ^$ x# }5 P1 ]
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.: Z; P& |" ]4 w  d+ g

- x8 S% o0 Q, T9 H8 l9 Z3 d* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.8 s1 F* A6 s. |/ L6 B! f2 A, D
___________________________________________________________________________
& }9 z6 ]6 T( Y8 \9 ~
# C% a# f% S" Y8 l0 \0 `6 ]& r* G# J: w+ `* J5 V; h% @2 v5 q+ k/ N
Method 03
( y* T9 N, ^9 C: I- g# D3 s& V9 k2 ]+ h=========
9 k. l) U. t7 q  D* O/ f' A* k/ A+ s% ]  O4 f8 d. w
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
' r. U4 x6 Q7 U5 ?1 T5 }(API Get entry point)
. ]* R2 q" w3 l6 z) t. a        / r1 ^: `/ v* N: ^% ^
4 m# B; V6 X/ S5 N& n1 L7 t: L
    xor     di,di0 r9 k5 S5 s6 R' S9 R
    mov     es,di; q3 m4 F/ w% v% ^
    mov     ax, 1684h       : }* Q% v& }; D8 ^3 l
    mov     bx, 0202h       ; VxD ID of winice- J, f$ b. n) J, e& S
    int     2Fh
8 B! Q; x: ^$ `+ x    mov     ax, es          ; ES:DI -&gt; VxD API entry point
( L0 U1 m* n) }; t2 ]8 K    add     ax, di( f- k- A/ l; h4 w' S" {% V
    test    ax,ax7 q7 a" O: j2 v% |4 W9 |. R; F
    jnz     SoftICE_Detected4 b4 P! T" n( x0 K' g& N' b$ Y

' P1 W9 K7 p+ w/ I/ R___________________________________________________________________________. x% x& z, ?1 m
7 ~) u4 F, g; n$ p5 i
Method 04
$ G  v, b" m! ^=========
0 ^5 L& [) e# W/ z" ^$ l9 P& Y) P0 T1 a
Method identical to the preceding one except that it seeks the ID of SoftICE1 l. V/ _6 a; z5 g9 o  z& F0 Z  O
GFX VxD.
3 k$ M7 c7 |6 A) E
; u( @3 l* I2 p) g    xor     di,di
0 p' Z( V: O( N# P    mov     es,di" j! t$ h1 J4 O: K
    mov     ax, 1684h      
4 }( ~: o+ P- y. G! B( i5 e9 Q% }    mov     bx, 7a5Fh       ; VxD ID of SIWVID/ I- F& K2 ^& |! D9 P$ L4 o
    int     2fh7 Y: |9 q7 N7 h
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
. `5 F4 z  [3 a$ _7 P0 N" k6 ^    add     ax, di
  ^' |4 ]7 I5 d! s; l    test    ax,ax
1 a& K' x4 S" ?7 v/ J    jnz     SoftICE_Detected
) l( g9 A! |  h4 G3 R. z% t" ]" y6 |
__________________________________________________________________________
$ F9 C4 n% G& _6 {& e) @
0 w- v% P- D* w
" {4 d8 l2 t+ G( _) u! U8 A; RMethod 05" q+ U* p' A: c0 P% S1 U
=========
9 D% _3 @$ V! b, J0 w! p* I: z4 y3 b, J3 K& L; Z$ Z
Method seeking the 'magic number' 0F386h returned (in ax) by all system6 t  D6 @) l# |- Z* o+ |
debugger. It calls the int 41h, function 4Fh.
# H8 {- v0 y+ `$ KThere are several alternatives.  
! z1 M' g( O( {# w" O5 Y$ L
% N: m+ X0 f  ^; PThe following one is the simplest:
+ o. M# n' |% I6 f4 p$ `# z9 w/ T/ f  Q3 B. r4 c+ c( M
    mov     ax,4fh
9 D! U+ f( b/ ]; t    int     41h
+ p1 h3 l* d& U5 x! b0 \    cmp     ax, 0F386
, w1 b* `$ b0 ~) ^/ p" m, r. ^* K    jz      SoftICE_detected
2 b6 \- B: ?7 u, b$ f/ o( ~' D# f  ~/ \8 v3 G+ I

% O4 K3 D- k9 x- a8 gNext method as well as the following one are 2 examples from Stone's
+ M  I$ }9 a; R+ T  \"stn-wid.zip" (www.cracking.net):
" @; D, `0 F+ K  f& U9 ]1 ]* V; J' y3 P2 F" @8 R* Y* C- t" `4 f
    mov     bx, cs7 c1 {! X7 Z. z( I
    lea     dx, int41handler20 |3 `: }8 l* _
    xchg    dx, es:[41h*4]
' t' c4 c1 e1 |! u6 P0 |( T    xchg    bx, es:[41h*4+2]
! O' b' X. a% N3 _7 v+ h    mov     ax,4fh8 v: o) |! ~6 h2 y
    int     41h
2 p, L0 @1 O6 p$ G; n  u2 U! x    xchg    dx, es:[41h*4]
2 ^9 \4 F& i0 i3 u& l: N    xchg    bx, es:[41h*4+2]& S* d( }& ?; o  Y+ J* z
    cmp     ax, 0f386h/ k8 c0 s5 c  w9 ^: w6 `
    jz      SoftICE_detected, `6 L! ^# s) f( N* x1 {" q: I
0 }3 C1 l5 E5 u7 T
int41handler2 PROC
7 ?* Q  G$ @2 h+ j0 g    iret1 K; t" M) c# n6 b& }' O+ O$ A
int41handler2 ENDP5 E& c3 G6 N: j& w1 @' d  |3 I+ ^) f
" y8 x  Y1 A$ K1 i- K+ x5 t

' z" k8 g* D- l; z% i_________________________________________________________________________
7 y8 Y5 Y) f1 z* g6 K9 S& Z4 K/ R# ~) L/ g' h6 v# k; a$ a3 [
  P  Y+ `& D. R, x! j4 C
Method 06. A* d, k" S+ _
=========
* s* F- m! ~( z. T) x6 c
* x) S9 W' b! f1 A0 ~
7 b! Q- E+ G; k. w2nd method similar to the preceding one but more difficult to detect:
" j! a  Z5 @  X5 T# C6 X/ @
" ?) _* Y: w& W# G: ?: a9 W  b6 S
int41handler PROC5 F) V+ d1 e% A! U7 A7 `" b3 _
    mov     cl,al
1 U+ X: V6 |+ q* E  e, N    iret$ T( i5 z, {! Z8 Y* s* d
int41handler ENDP
8 i  a- z/ i$ f6 H3 a" O/ K5 n* k" g8 i* A, s% z8 x  W

8 m+ I' k" s5 x# }# a    xor     ax,ax- ^$ ~; L( D3 P0 }' [. l
    mov     es,ax
+ f* o! f) v* ?! t  w    mov     bx, cs
, O3 A) p: l5 j' `8 H4 c, C    lea     dx, int41handler
9 i5 D; Y4 l( p  j2 @- \# X    xchg    dx, es:[41h*4]; E  g! |$ o3 V+ B1 A' C. P% ]
    xchg    bx, es:[41h*4+2]
8 l7 u$ L: a& v1 K; w  q! b/ G    in      al, 40h
, d: J1 h, j9 I; {/ j% N- `# w    xor     cx,cx/ O2 P0 Y. ?  s( D& j
    int     41h" p; W' b! R9 Z; }/ s
    xchg    dx, es:[41h*4]
! v: ^+ Q1 K3 g" }) I% O    xchg    bx, es:[41h*4+2]5 |0 ]/ [/ C! T" s# U2 O7 K
    cmp     cl,al
. r% y) {+ F5 ]1 F) b  l: O# D& \    jnz     SoftICE_detected
4 U# H) ~0 F  }2 ^8 K: z' e& q3 S6 `6 Q% d
_________________________________________________________________________$ \) P( m6 p- L" n6 Y$ o

- }0 x* T; C& e! bMethod 07
+ D+ g" }0 W; Y- D=========& `7 o  G4 \. S4 ?" R+ t
6 A- j+ d% P2 @8 u
Method of detection of the WinICE handler in the int68h (V86)2 \+ h4 A, h5 ?5 A) T4 @

4 v1 }8 H- j- n' w    mov     ah,43h
& c, s- J% g/ S# J    int     68h+ w, ^& K: [7 ]  s3 V
    cmp     ax,0F386h
3 d% s$ A) l3 u% M. s    jz      SoftICE_Detected
* x! R" G7 H6 h. v* u! }% T( m: E- R2 D/ B, _+ ~

, I  f0 ?& v) O$ h$ Q6 j4 n- X  `=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
1 l( M3 B# y- I, y   app like this:
" ?# @1 D- D% ~
$ f  b; `8 ?9 a$ V# M   BPX exec_int if ax==685 d2 Z$ [# y( H$ U. ^: w
   (function called is located at byte ptr [ebp+1Dh] and client eip is
9 r  Q; t$ g/ C3 T/ ]2 F, |6 O9 d   located at [ebp+48h] for 32Bit apps)
: f. r6 n9 J; t" E! _8 K__________________________________________________________________________
+ H2 x4 ^5 ~: m' k0 b) h
5 J5 g3 r, G8 R9 F) r+ g
- C8 ?8 F8 _8 l' L$ V% nMethod 089 T# b0 U) k' }1 ]. s) K6 g2 J
=========4 i7 S. P4 ~: A

- k9 v7 w4 z# z  m. FIt is not a method of detection of SoftICE but a possibility to crash the
6 b3 |2 O4 k- ~: Wsystem by intercepting int 01h and int 03h and redirecting them to another
' R& k) e5 h  m- E% `: S0 J1 iroutine.
$ n3 y+ G! G- O, a/ i& CIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
4 m* q( U7 j( R% \" @, @to the new routine to execute (hangs computer...); B0 l1 V/ \1 P0 a3 V" L3 p

0 Z* K( o% c7 ?2 J  i    mov     ah, 25h5 V1 j# l+ O$ C& X
    mov     al, Int_Number (01h or 03h)! V& g: s' q/ @, p% O; V" S
    mov     dx, offset New_Int_Routine" H7 }( C9 M$ q0 e: N( ]  }
    int     21h: |' N3 ~5 q$ |, |  [: R1 X

# i) M+ [, m4 `+ u__________________________________________________________________________: _: M& J8 g2 V4 `2 n
- s+ V1 ]- R+ z* r9 S/ ^5 E5 s
Method 09( o$ X# W  ?0 ^2 |
=========
; e' }! i6 K- w. o
5 ]6 G- J+ p  E; @# {( |This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
9 P. V- H6 q4 {3 [performed in ring0 (VxD or a ring3 app using the VxdCall).! d% H3 g, G/ T% B: L8 W$ t
The Get_DDB service is used to determine whether or not a VxD is installed
* |+ {& l" I; \3 T' Q% T/ ^for the specified device and returns a Device Description Block (in ecx) for6 Y" v- h, g# v9 U4 E6 m5 J+ p! U
that device if it is installed.+ l8 x, G6 e) V9 S9 N6 m

5 L4 C, L& X( s1 I& n" p   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
  X+ \/ ]) h, I   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
+ ], I6 p9 X% {  @% s% b' d4 v   VMMCall Get_DDB
& X# V) H: s+ m3 _$ M1 t6 U) y/ `   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
( k0 g( m" t0 y4 a( l5 I* b8 z$ B
$ N3 Y! W* v: W, u6 ~+ ~7 k- h( UNote as well that you can easily detect this method with SoftICE:
3 `) B  l; [: E) k1 v7 Y   bpx Get_DDB if ax==0202 || ax==7a5fh
' ?+ }2 S0 ?3 d/ k6 a- f$ y7 @
% T& ^# R6 y: y  k__________________________________________________________________________# D& d5 l! @9 N$ J3 w
. A# s/ x, u* d$ z# I  E+ m
Method 10$ s: m) j. o1 W: h8 [
=========2 T! ^( a: j5 g" g& E
9 G9 O! P! j7 ^. B
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
0 g; W8 j" A4 c2 B5 W1 P+ P  SoftICE while the option is enable!!
/ D/ `: y3 |, F0 U
' A+ `1 V$ Y' EThis trick is very efficient:
$ W0 X# k4 [; o) c3 hby checking the Debug Registers, you can detect if SoftICE is loaded
% M. N% e% Q( G( U7 j8 Y3 g! j; C(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if0 X& I2 G: g+ x: ^
there are some memory breakpoints set (dr0 to dr3) simply by reading their
; S7 v  D* n/ B& J8 P! bvalue (in ring0 only). Values can be manipulated and or changed as well
4 P) c/ h. n4 i# e; B(clearing BPMs for instance)) ~! }' V1 u. h/ x, n+ a3 y

  n6 v4 e9 M( N" f2 c8 f: q__________________________________________________________________________
3 k( }3 z0 Z+ f' ?" L2 z! V2 h5 ^- o- e: d
Method 11
/ L8 e+ n( y6 H9 ~/ q=========. {0 g. m  X( Q4 K6 C% r, J  r% U# P& l

5 m  b( N9 s1 B4 T2 t; dThis method is most known as 'MeltICE' because it has been freely distributed5 d2 ~- ~/ [3 U3 Y
via www.winfiles.com. However it was first used by NuMega people to allow
6 j: S  r$ I) {" Y0 M+ e3 N0 nSymbol Loader to check if SoftICE was active or not (the code is located
$ m" m5 A6 R- Z! \8 Winside nmtrans.dll).
+ U! _/ O" |$ u% R! _: Q& R& T1 n0 m
The way it works is very simple:  V1 r# I% f& A6 c" k: ~
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for0 l1 r" [; t4 P  ~1 i
WinNT) with the CreateFileA API.
; X( Y: Q$ h) T3 K7 H$ d
5 e* f0 q- z2 N2 k8 D5 E' gHere is a sample (checking for 'SICE'):6 h8 V# D" X2 x3 q
9 d+ S4 T7 e3 a( F! e* s
BOOL IsSoftIce95Loaded()
2 a. p  b: w0 l( a# l+ b{
8 {) C( V3 n& ~- w- B. C- d   HANDLE hFile;  
6 S  C' e- Y" T0 U   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
+ J; P' b6 X9 x3 x) F; F, G% Y                      FILE_SHARE_READ | FILE_SHARE_WRITE,3 g) G, N" ]2 z5 A5 J
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);. i# N5 a; [1 U: X3 @0 C- X
   if( hFile != INVALID_HANDLE_VALUE )
. q# E5 F0 m8 ~7 U7 v3 c2 T$ t1 _/ b   {8 G2 m+ _3 }& {, N0 T- q- T
      CloseHandle(hFile);
- B$ K* G. `& G2 J* H8 U      return TRUE;3 c# W3 k+ {) B. z8 u5 A
   }& L" v" \/ E! I5 l
   return FALSE;
- S3 n: A; \; C& t) G4 d2 w: i}
' R% _2 i7 h3 \: L0 D$ W3 m" Q  R7 _+ J
Although this trick calls the CreateFileA function, don't even expect to be
( X: ^' I" g  X) W4 Qable to intercept it by installing a IFS hook: it will not work, no way!
" p9 p9 Z6 X% TIn fact, after the call to CreateFileA it will get through VWIN32 0x001F3 H: P6 D% j( ?1 @+ |
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
+ c# G4 m6 [& R. I7 T1 ?and then browse the DDB list until it find the VxD and its DDB_Control_Proc
$ r& a9 C- B$ o% h' J) c2 \# Ffield.
$ d* ^4 `, U, N' D% q; s, Y9 q+ JIn fact, its purpose is not to load/unload VxDs but only to send a ; d! A! \$ o1 I6 i! }4 H
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)" {. A) M& ]! b! @' L- f# x: d" k
to the VxD Control_Dispatch proc (how the hell a shareware soft could try
* V" `# ^' J) i  I) Dto load/unload a non-dynamically loadable driver such as SoftICE ;-).
' s% c& j& l5 E4 w# C0 |If the VxD is loaded, it will always clear eax and the Carry flag to allow7 e7 k8 u" i7 \! D6 D+ l
its handle to be opened and then, will be detected.
" q4 W8 W: M$ t1 zYou can check that simply by hooking Winice.exe control proc entry point9 u1 ?: I0 O" `- L
while running MeltICE.5 p+ d' B# A5 W) }
5 e) N7 w' C' ~  Z, C( Y5 _) @

! r" H* x! U: P4 ~; O7 t  00401067:  push      00402025    ; \\.\SICE2 H) k0 U, I3 u" E0 x
  0040106C:  call      CreateFileA
6 r5 B! o: j3 D  00401071:  cmp       eax,-001
( n2 d, [  `6 x) D0 D$ i, S( ?3 K0 q  00401074:  je        00401091
  [/ C( L9 {  H3 k' [# b1 I) @/ q/ v

. L$ F/ O" I1 F* WThere could be hundreds of BPX you could use to detect this trick.
9 W  J2 o5 ^. G* n# d8 U) Q- M7 @0 V-The most classical one is:  W7 [& \$ d# e
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
/ T* x+ z9 [7 J- t5 ~    *(esp-&gt;4+4)=='NTIC'1 ?5 R2 Y9 c1 {5 D- g( a

( l7 x9 }* a8 ]: Q7 G1 O1 Y, E1 r-The most exotic ones (could be very slooooow :-(
: r& w6 {* l/ q, |7 L" [. S   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
( ~2 r$ Y2 q; v" K6 u/ H" T" ?     ;will break 3 times :-(
1 {- h% N# C' H) D
* H' S3 ^; k- B( z: L-or (a bit) faster:
% Q$ |7 Q1 {  h+ H7 U8 s- t   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
5 A/ T0 p( h- ?$ x# h
5 g2 t, q3 T8 ]   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  - a; y. G* P" A% o) w9 C
     ;will break 3 times :-(& G4 [- C0 R9 e* |# Z# D  [. n

2 }9 |, @7 T$ v& d7 h  g: w-Much faster:7 G. v& {  z7 u7 C& B
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'( \( M. k) D! y2 }

" p- g5 i3 @3 m' S/ kNote also that some programs (like AZPR3.00) use de old 16-bit _lopen9 f) U3 O. Y6 f- d: o$ l3 l5 {$ c
function to do the same job:8 J* @: e8 _% o

' r0 j, r$ I. O0 E. e$ b+ |( G! ~* W   push    00                        ; OF_READ/ a" T! a& r7 M/ _6 e
   mov     eax,[00656634]            ; '\\.\SICE',0
/ b! k, v1 e( P+ }+ ]7 Y$ g   push    eax, E0 _. {' B9 Z0 H( ~2 m% V3 T
   call    KERNEL32!_lopen
+ f7 U4 P+ @. o& E5 F- c; Q   inc     eax
8 m% `! h% P0 t( `3 p   jnz     00650589                  ; detected
* k, b$ Y$ u8 Z# @# g+ U   push    00                        ; OF_READ$ w6 e! w" W1 c  b* o) H9 ]
   mov     eax,[00656638]            ; '\\.\SICE'" l  b' d2 U3 ]3 h" K, @* u
   push    eax3 G9 {7 e! P; y0 O5 E0 ^$ B
   call    KERNEL32!_lopen
4 r. {- @, o: D" I0 l% s   inc     eax$ l5 e( \. ^) w) ~
   jz      006505ae                  ; not detected4 X7 Q3 N- g2 ]2 J8 z$ X% f

0 l; Z# Q* s, n2 Y/ ~/ ?' h8 e
* N& s2 w  h7 i/ S; s) y" B__________________________________________________________________________. S* b8 i  D8 }( K
  M* e4 E! a* f3 Q/ j- w' P. V& t5 Q
Method 12" f$ c3 ]. d' K$ \
=========- I# {9 Z+ Z2 H9 e" X
5 R9 Y  f3 e3 \$ Q* c4 f
This trick is similar to int41h/4fh Debugger installation check (code 05( ^& k, c! V5 g1 {3 p( d
&amp; 06) but very limited because it's only available for Win95/98 (not NT). m4 v/ j) X0 p9 A8 x
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.
# S/ I: S7 V' d1 u. s! \& }
* n& |9 }" n) n6 o5 c   push  0000004fh         ; function 4fh
3 K7 r9 a; `$ S3 N$ x* M9 \) ~4 Q   push  002a002ah         ; high word specifies which VxD (VWIN32)( b$ }7 N% |2 y% b8 F( W
                           ; low word specifies which service
5 j' X7 o+ T3 X$ c                             (VWIN32_Int41Dispatch)
$ ~6 I; X" Z( U6 g8 I& r   call  Kernel32!ORD_001  ; VxdCall
$ c0 S' ~4 n/ k: s   cmp   ax, 0f386h        ; magic number returned by system debuggers: W$ z3 M% k# D# ~0 T# Y  f" p2 i
   jz    SoftICE_detected
+ Z" X7 j( Z6 {8 w" ~" t8 ?" |
+ M# A  G$ Z5 R) j7 Y( uHere again, several ways to detect it:
) W/ S, G/ j- `3 V' c) X4 G$ U
  C5 k' g( a( c$ p. m    BPINT 41 if ax==4f+ O( K4 e1 P' O9 m; D6 W
$ T5 d, {. i% B$ C) Q
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
: W9 R2 A+ \- K& _# t/ D* q5 Y" d) P: z& w7 L, U0 g
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
; `' {( |" ^1 Y1 L' v8 S: ]1 D7 t3 o# M) @# F9 d* h4 X" H' \
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
1 X( C2 b5 f: c' y9 e
& X9 s7 g1 S7 `* H; c' j__________________________________________________________________________
) C  `8 [! k) y- F2 _5 X) Y$ W2 g& _. n; J0 _3 a
Method 13
$ Z: e+ ^; u8 K0 y+ d=========
% M& p3 L$ i7 n5 Y4 P) L: [& y) I+ q$ v3 A8 ?4 u
Not a real method of detection, but a good way to know if SoftICE is/ }$ k1 D% W  G# H. ^
installed on a computer and to locate its installation directory.
  Y, T; W2 E2 Q, x3 R: S5 pIt is used by few softs which access the following registry keys (usually #2) :
- X6 r7 J8 w. s- A9 m% O
2 _- _, ^, B2 C% r% m) H! Q6 }1 @-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
4 h0 F' s4 n! V% f) ~' F\Uninstall\SoftICE
& @5 j: B1 B, a8 u( W. o3 A$ N-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE8 z. h+ w1 h2 d
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion. Y+ L  ?, f* h3 y7 a  K6 J2 `
\App Paths\Loader32.Exe! E  t- M% T8 p

6 J2 d' ]' d# R9 b6 O3 X
; k7 e4 t: t4 V7 s% o& ]Note that some nasty apps could then erase all files from SoftICE directory3 w. p8 M8 v# I- i4 }' u
(I faced that once :-(
$ O' r8 B2 V1 h# U( q) Z
1 H$ b. J0 q$ A" Q( X! T% z3 |Useful breakpoint to detect it:
5 p% a* E+ `# [# U8 j  u, E) e1 [( Q5 _5 ]
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'7 m/ A1 _! ?" Z. a

- y: I; n7 R) s% H( E" D/ c__________________________________________________________________________$ m* K: v8 g; g9 p/ }
7 M" h1 m' q* J( T5 ^
$ h8 b  G$ B: l1 _& N6 A
Method 14
" D' V: \3 v5 p: D5 V7 H=========
$ _7 X: j& x  n8 m1 X" A2 R) u
& m% P9 Q4 P) rA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
/ ~7 k" e2 x) Ais to determines whether a debugger is running on your system (ring0 only).
" [5 h2 ]8 m) }+ a. [# q1 d% B% C4 s1 w( K1 _
   VMMCall Test_Debug_Installed. H4 c! T0 V$ A# m  A& ^
   je      not_installed
: ]* ?! U6 a) @$ ~1 \
$ L  q3 q( C- N" l( h) dThis service just checks a flag.
9 H# G* V1 u% ]0 ^' j- I; i' O# V</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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