About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>" T: n: @! U& D# X. @5 ^* B& I  X: H1 |
<TBODY>) `% D2 X& y' U/ q) s' h
<TR>
* ]7 `+ n, }/ \- C5 l<TD><PRE>Method 01 5 ?' r+ z, x, h/ H- h" E0 a/ F; Z
=========
$ W' s# D9 ^9 ?& k! P' p; s7 t0 `
6 W. k6 ]. `  E( CThis method of detection of SoftICE (as well as the following one) is, ~& f& s% X' u( U
used by the majority of packers/encryptors found on Internet.
/ c+ Q: N, }2 {1 K/ {8 qIt seeks the signature of BoundsChecker in SoftICE6 X; m0 B2 P* m9 k+ P
# K9 Y, i' F3 k( E. J- y/ e. C# D
    mov     ebp, 04243484Bh        ; 'BCHK'! r. m5 z5 w4 r' }% J
    mov     ax, 04h
1 X, Q- e! V* M7 K9 t- Y, Y    int     3         t  n9 A2 H* f4 h$ P0 U
    cmp     al,4& n! a# u1 Q& p0 [3 d, U1 O
    jnz     SoftICE_Detected8 @3 Q& k5 p3 E
& u8 l1 m6 ^2 i( S8 T2 V: q! P3 ^
___________________________________________________________________________
+ h! ^  s  f% i7 d/ {5 s$ l8 D+ [* X  p( o; i+ l, O+ o1 @
Method 02! N+ b+ A6 K& ?( ^8 l: T9 a! Q
=========
, y2 z( p8 ^+ {5 h
! n  q& `& J5 |- |# D) yStill a method very much used (perhaps the most frequent one).  It is used
% |9 Y: k: O6 f. D- H" o( z0 Ato get SoftICE 'Back Door commands' which gives infos on Breakpoints,
4 j" ]4 e! n5 F$ U3 ~* Bor execute SoftICE commands..., T$ t8 J. `+ q
It is also used to crash SoftICE and to force it to execute any commands
) @8 N  M, B, E$ h7 E8 F- D(HBOOT...) :-((  
+ X* h+ g$ ~% a7 Y5 [. p- [
0 l! ?  g: r, C) ^4 S, b# R  P/ e8 KHere is a quick description:
5 {/ P- M0 C4 f1 l& c; {" A-AX = 0910h   (Display string in SIce windows)3 [  @& C: g. G$ a; S' c, D
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)7 @) n5 s1 V6 h" o  K1 I) u, x
-AX = 0912h   (Get breakpoint infos)* J) l$ F% K& Q1 A; b+ D: w# Z
-AX = 0913h   (Set Sice breakpoints)
1 U9 ?4 v) n& E8 g* L) W-AX = 0914h   (Remove SIce breakoints)
  }7 K' u' S9 K1 u; U9 a% _
% k- ^( F8 S5 }! M1 N9 vEach time you'll meet this trick, you'll see:2 Z& s$ H  g' Z3 ]8 D% Y' k9 R8 I
-SI = 4647h4 [/ @5 Z: L6 l! J5 S9 y9 |% S- I8 ?$ ~
-DI = 4A4Dh
, D6 ?, K/ [7 YWhich are the 'magic values' used by SoftIce.
% V$ w0 l$ Y0 T! ?For more informations, see "Ralf Brown Interrupt list" chapter int 03h.; p2 t& R  a, E$ r6 `7 }* N
$ Y! m' ]+ I7 R# D- e8 I( j, {3 S
Here is one example from the file "Haspinst.exe" which is the dongle HASP% V- E, d& Z" y. t
Envelope utility use to protect DOS applications:
6 v, x$ b3 \2 ]9 X2 A5 S
' s9 |4 `; W, H% e( x9 X3 }' O
2 ^5 B8 w) Z# S8 B4C19:0095   MOV    AX,0911  ; execute command.
& ]+ a5 \1 R- D: \+ C9 F3 ]4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).( r1 e4 f  [! W; @2 F
4C19:009A   MOV    SI,4647  ; 1st magic value.
* D" D6 T; x/ W1 I' }5 s/ n  k# p4C19:009D   MOV    DI,4A4D  ; 2nd magic value.1 n9 V# D/ V1 n5 l" p
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*), [2 W- X5 L/ k3 P, D
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
7 r7 J% s( N" O/ B4C19:00A4   INC    CX2 M2 D. R) ~! a, B3 f. k2 [2 X
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute" `+ }3 S6 K% e3 K; o. A4 n7 n" G+ ^9 U
4C19:00A8   JB     0095     ; 6 different commands.% a+ W3 A; c( J6 c- c! O
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.9 ?6 J" o( w7 g. ?5 i: s  U
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)2 i" o) J5 j8 y& c. M
- L1 M, j& \3 `8 z+ a
The program will execute 6 different SIce commands located at ds:dx, which
, d: \8 P8 [2 K4 J, jare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.; O7 b* X" v! B
9 _& g$ j$ N2 a  P# p8 S$ C
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
% {4 h9 i, L& I___________________________________________________________________________
7 b2 O2 d. M- I7 x1 }1 K7 |9 M( b; u+ A# ]6 F" s' l$ ~5 K1 R

* T9 A( o/ k2 A0 w" X/ }* q9 MMethod 03; V# G. [$ O7 ?# j& l9 k
=========
0 r7 _$ M- e, `4 D# z9 v' c% R1 H6 S8 N9 H
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h% m% y% G' P+ s5 s  x8 D7 ?
(API Get entry point)
5 Q; ]  C4 @: ?" W- M/ s6 r6 l        
  U; e$ u( X9 c+ ?& a3 I3 U! w, d( V- V  e* b* {
    xor     di,di( f1 ?( A1 b1 A1 c3 v" {: H2 u7 o
    mov     es,di
3 X* ?, Y# ]- U4 F  O    mov     ax, 1684h      
$ t5 @4 F4 p% y! I0 H    mov     bx, 0202h       ; VxD ID of winice& z! B( I9 L/ {& G  ?8 |
    int     2Fh. s& i9 N' k9 i& f; @& G  h7 K
    mov     ax, es          ; ES:DI -&gt; VxD API entry point" w1 r9 q: q% R+ L+ I! Y
    add     ax, di* ?4 e& n' N8 I* L
    test    ax,ax
  |0 d9 ~+ s3 f9 S. @    jnz     SoftICE_Detected
/ C/ Y0 K) a8 |5 f6 P  G
$ i. O- D+ [' P/ t2 m  P0 q2 O8 p___________________________________________________________________________
1 R) `/ g! R2 w  Y. w* F$ o, b, P& n0 g1 G8 N$ E
Method 04% r# I3 s5 |( ]( [' x1 G
=========$ h+ s) p( `$ i+ O
, Y' l; t1 F* |* i! E/ V$ x, J
Method identical to the preceding one except that it seeks the ID of SoftICE3 `3 B& @. E5 n, M3 c' j7 z: B
GFX VxD.
% \+ K+ }" n8 `1 p& y
; Y. |: ^' {3 u" _; ?1 ]    xor     di,di
/ C4 t1 c& }; z7 }+ p$ \    mov     es,di- O5 b% b( c" z2 V* c! }
    mov     ax, 1684h      
4 G' N& j/ h' P; o/ G5 L* @* c) Q* d    mov     bx, 7a5Fh       ; VxD ID of SIWVID1 s% N6 p5 ~* G' p  i& k1 ?
    int     2fh
% ^" i8 c6 Y, q9 X% F    mov     ax, es          ; ES:DI -&gt; VxD API entry point
; P8 o& n5 @7 w/ W* N' e    add     ax, di% f. q5 J, @( ~) {: i: f+ i
    test    ax,ax
" h) g) f, M% e+ V+ S3 v/ ^( g% V    jnz     SoftICE_Detected1 E3 y' u* W' b
- Q0 W! k! {# |) y5 t3 R
__________________________________________________________________________& P# V) P& G9 N! z2 Y. H) C5 ]' @# w

- d2 a9 T5 K( W
" j  Y9 k% h1 i: zMethod 054 n  g0 a0 l7 k2 |6 y
=========6 ~! s; p& r* Q" P2 w
; ~% W/ U, g! x0 i
Method seeking the 'magic number' 0F386h returned (in ax) by all system
5 h/ _% s, H7 h5 }* D2 c6 ldebugger. It calls the int 41h, function 4Fh.$ q5 M1 k( t# f+ B& F# s; {
There are several alternatives.  
4 s. |2 i9 n: Z' K$ m. ]  O0 w# @
The following one is the simplest:$ g' ]7 K/ }7 Q6 y; ^, X/ Q

# o, ?7 [) ~4 Z. q' t    mov     ax,4fh
* Q. v6 A3 h; I0 c    int     41h
6 V- }% O2 k- |, x# g    cmp     ax, 0F386
0 [! K9 K9 @' ]    jz      SoftICE_detected
# h. F) `) O( n' ?- y- f
* J: ]- m2 P& w& j6 E% {: n# g: W; ]
Next method as well as the following one are 2 examples from Stone's 6 \. |( r+ g5 \
"stn-wid.zip" (www.cracking.net):
+ x  o! b# _1 b0 u3 z6 f# _0 c
  }8 X) b" Y# ^5 q    mov     bx, cs
- v' y! [6 Z) e; v, a    lea     dx, int41handler2
) a, \. r) P7 ]8 C2 h    xchg    dx, es:[41h*4]
  Y* B5 A5 T! T! |5 d    xchg    bx, es:[41h*4+2]
" n; @9 ?, o* `    mov     ax,4fh
" O7 O+ |. m4 p    int     41h0 m. Q/ p) K3 L% H/ z$ f8 ]8 [
    xchg    dx, es:[41h*4]: m5 ^% q$ q, A% k( E1 z4 W
    xchg    bx, es:[41h*4+2]
0 `  |2 a, [0 @! n    cmp     ax, 0f386h" R3 U+ N6 `9 F! g
    jz      SoftICE_detected3 e' K5 j) F$ b" W0 z8 U/ y

; W: e- ?: ]1 ?int41handler2 PROC
& b3 f* k. y' Q+ R; ?    iret
/ m# |) K  y0 M5 U) R1 Lint41handler2 ENDP
, p- D# c4 M/ d5 F! F# f
  H( m/ x+ F% B  z( L1 @2 R
6 C6 N" E2 G) S8 V9 ^/ l7 Y_________________________________________________________________________" e9 A5 N+ O3 r& W5 G: s

& a, @5 ]6 o& h6 r& A4 j; T6 k- f
5 J/ P" Y, N' b& w% E6 SMethod 06
! ^% a& _. x2 u, R=========
- V2 ~, s8 t1 H9 y; C$ H2 ^* V" @- z$ l5 z2 ^

( Q/ J$ D. O4 p3 j2nd method similar to the preceding one but more difficult to detect:
8 ~) }$ Y& E0 b6 m  a: _0 l6 P- s0 {8 p; C- j5 a

  c7 x7 J2 n1 \/ T7 |int41handler PROC# z& a" e8 R( n9 C2 O( O
    mov     cl,al4 x3 ?6 s5 I% K6 v  c. a
    iret
1 R% [* {: q! v4 eint41handler ENDP6 M$ T6 j- J; w' ]; G
7 n8 V; T( t3 @; u4 @' `. g+ d
  {+ V  @% C$ s4 W) N+ e1 @$ {. }
    xor     ax,ax( N/ ?: M; l. h0 A5 D" V& Z
    mov     es,ax
  q  R# n% y- p    mov     bx, cs
5 [, x3 D  h/ T) K& l+ `: j    lea     dx, int41handler7 i) P$ P9 p3 x6 O
    xchg    dx, es:[41h*4]! M: F$ A. L# V+ h$ p; _& B
    xchg    bx, es:[41h*4+2]/ r. J$ G* J# ^' {
    in      al, 40h
/ ~. P( k4 }  I+ {2 M7 Q0 i+ H    xor     cx,cx( W5 J' R2 j5 Y7 _9 X( [
    int     41h. k0 N$ {; ?+ X# E5 x) \) V% q, s
    xchg    dx, es:[41h*4]' ], F) s5 n/ q, ~2 f( x
    xchg    bx, es:[41h*4+2]5 I! _3 r; o/ H
    cmp     cl,al4 Q7 H: J9 d8 }% c8 V- r
    jnz     SoftICE_detected
+ t- b. O) r! K; B% x& X  l- h/ C' W* f+ b7 q& o( p
_________________________________________________________________________
  P9 {4 O. I% d3 R+ v. {- h$ M$ J" \; R) |
Method 07
$ Q0 }" Q! a* e4 T) Z=========
$ n& i  E0 P% m7 z/ i$ S' Q$ L
% [. s  ~8 J: C: M# m7 O5 |- @! n& H5 j6 XMethod of detection of the WinICE handler in the int68h (V86)
  v. I" i) K- |$ B# c! L; c/ v7 o9 l
    mov     ah,43h$ s+ \* E2 V1 B0 ^" M
    int     68h
1 c. v4 R2 `8 v$ l- A5 O1 M    cmp     ax,0F386h5 c, x# u! a& Q9 X, {: ^& B- M3 r
    jz      SoftICE_Detected1 b/ l# z  ~; W2 @" F/ w" M

- ~+ y7 n. O7 j+ W$ G% A
" b/ `$ w, s* m# X( n; V/ K; Q=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
6 D, T2 X$ T) n0 y   app like this:) G4 S% I5 Q, I, a) O& p% _) o

, o# W7 }9 G: J/ D2 b6 v0 v2 d' m   BPX exec_int if ax==68
5 a) }+ s  Z  ~# F8 H% @6 n6 P1 }   (function called is located at byte ptr [ebp+1Dh] and client eip is
) {; u+ y2 t! k( O2 w! H" I   located at [ebp+48h] for 32Bit apps)7 F7 g  }$ P% f9 ]: ~0 d2 l; i& c
__________________________________________________________________________+ |9 I# U6 E, a' P& A$ |
1 t- m4 H# A  h( ^

# T4 z2 Z( s9 F' w0 tMethod 081 I. f8 ~# [( C3 x
=========9 p  ~" [; ?& R7 W% `
8 V7 l2 ]+ P5 D. M: o
It is not a method of detection of SoftICE but a possibility to crash the
+ ~' g+ N+ M: [system by intercepting int 01h and int 03h and redirecting them to another
* p/ B1 A& ~. h  l! m1 Q+ aroutine.
# A0 Z4 w0 i3 W, }3 iIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
/ w; L# e. w( F, ]8 M, i6 kto the new routine to execute (hangs computer...)
. H. Q2 t7 k. n) l% g7 V* |5 U3 y, B. F3 H
    mov     ah, 25h' b% }9 o: X% h" t, U  m" r, ^& D
    mov     al, Int_Number (01h or 03h), s: I$ ?9 P' \! u# E& s1 Y. a
    mov     dx, offset New_Int_Routine
5 a# ]! y. s& B    int     21h; ?5 @; @" \  H/ s% S- m
' g1 r9 d6 B8 s" l4 p3 O' _+ H8 S
__________________________________________________________________________
7 V9 o7 |/ T/ A$ A& W3 N
) g: h2 U* J3 c, }( K3 F# jMethod 09
, r* W! q- l& q8 F% n=========
2 l) Y" ^: ~2 D; C; Q2 w' q5 [
  k& f' ?% H8 b0 i5 z) NThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
- d  F/ V4 d; @: ?performed in ring0 (VxD or a ring3 app using the VxdCall).) B: o3 _# ^. H
The Get_DDB service is used to determine whether or not a VxD is installed
: H* j! f/ y8 {. R$ F3 q3 [for the specified device and returns a Device Description Block (in ecx) for9 m, P, u% I1 _2 c) B$ f4 E% `
that device if it is installed.! I' g! h8 a/ t2 o0 b  _  V3 |
3 I' G$ ~3 ^0 `, `. P  |4 k, E
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID/ B, h. i' Q* L: B6 k: J$ B
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
4 Q2 l8 s1 @, L% G" I8 v. x* s   VMMCall Get_DDB. e" Z- c% J: w
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed: q0 _" L" }2 |
8 p$ F& I) B. P  F
Note as well that you can easily detect this method with SoftICE:
& F" W4 |& K9 k) c   bpx Get_DDB if ax==0202 || ax==7a5fh
/ |5 }* P- \; Z2 v, F+ [3 c( K  ^# v9 K) }  b. V3 f5 W! E! s" k/ i
__________________________________________________________________________; ^9 V, V/ \+ B" X' v

) i/ O! p, [4 O' iMethod 10
- C6 v" I$ ^4 P=========5 Q: o: }0 V9 b8 o4 _' o% l: n
2 @' g7 u& i! Q+ e9 [, V
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
" C7 T; G# U' F$ y+ i$ _  SoftICE while the option is enable!!
, i* u& B5 I5 R
& H; U  S. Z  w0 v% nThis trick is very efficient:* f, P8 v) Z+ P# l7 E
by checking the Debug Registers, you can detect if SoftICE is loaded
. [/ B+ o* ]+ z( U0 b9 G(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if" K7 Y; j7 L+ Y3 S7 m  N! p
there are some memory breakpoints set (dr0 to dr3) simply by reading their6 D9 |  M6 j0 k+ s
value (in ring0 only). Values can be manipulated and or changed as well
% V0 [( j; d3 o9 w  ^(clearing BPMs for instance)7 Q0 y% Y* k! f; \8 M2 v  E6 |# P
  R( J1 X5 {5 o- G# I* i
__________________________________________________________________________
- d/ A* [3 ^& S3 m" s& q6 C2 E: {1 f
Method 110 ^0 N7 Y) `- n
=========" ]5 w/ ]1 @, ?. `3 W
  h# K$ `. D, `! s
This method is most known as 'MeltICE' because it has been freely distributed
% O; D1 L8 w6 e. s8 Lvia www.winfiles.com. However it was first used by NuMega people to allow
( _; A0 Z% Q% TSymbol Loader to check if SoftICE was active or not (the code is located
% {% Q) ^8 e# Z8 ]inside nmtrans.dll).
4 `( \. \7 C$ J$ a7 g+ A9 a, V, A9 o7 D+ g
The way it works is very simple:" {& V% M+ j4 P
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for2 I$ O" K) G7 U. n! F  X% u
WinNT) with the CreateFileA API.8 S. q6 l" e# e* E' m, K8 f! }( K

/ r" r: C  [4 R9 r7 X" [* DHere is a sample (checking for 'SICE'):
; `+ Q" U" G3 y! g8 B1 ], U- P0 J* D$ P: e
BOOL IsSoftIce95Loaded(), R! Q  D3 O7 B9 _5 n, s8 D2 d
{
$ p. f. M$ I4 A# S" S% Q2 v$ W   HANDLE hFile;  
6 u+ ?9 p/ W! s, t' p   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
' n# f* T! Y  l( |                      FILE_SHARE_READ | FILE_SHARE_WRITE,9 G8 n) p# p8 D$ k1 K; M, C+ i* u1 c
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);* @; {; D$ ^' P+ v/ h
   if( hFile != INVALID_HANDLE_VALUE ); U, |; P- x8 ?! O* N! f* Y
   {/ d, m+ m' a- ^5 \3 ]6 F
      CloseHandle(hFile);
' _  ]' i% v6 R  E* M      return TRUE;
( {2 J- R! A# z+ \+ f8 J   }
2 N! n# ?& N. k: T7 H   return FALSE;
- J9 {6 {* q" G: Y6 E0 E" L}" w+ n8 P: t3 l: [9 L

. J+ D2 P% l8 n) S4 T+ d' j! V% x# ?Although this trick calls the CreateFileA function, don't even expect to be
% z; I. y) [# ]able to intercept it by installing a IFS hook: it will not work, no way!0 [4 l; I9 A8 u: F2 m: Q  D( O2 t
In fact, after the call to CreateFileA it will get through VWIN32 0x001F: Y, S6 M, v& ]" w' c' G, b5 F6 U$ a
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)8 A- C5 v9 P; C8 Y& p
and then browse the DDB list until it find the VxD and its DDB_Control_Proc+ l9 O" M: V: [9 B
field.$ n1 i* {& ~1 U3 V/ b4 o( b
In fact, its purpose is not to load/unload VxDs but only to send a 0 f, s' C2 O# g) k  D% s! E$ b
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)% r1 [, N2 ~5 D7 w- Y5 w9 p* f: ^
to the VxD Control_Dispatch proc (how the hell a shareware soft could try
$ `* p: A  o2 ~to load/unload a non-dynamically loadable driver such as SoftICE ;-).
4 q! b; c8 D+ S6 f+ m% y/ ZIf the VxD is loaded, it will always clear eax and the Carry flag to allow
" d! f2 O/ y2 L2 V, _- Yits handle to be opened and then, will be detected.' x6 c  s3 C% W" d4 O
You can check that simply by hooking Winice.exe control proc entry point
9 p, E# e' Z- j1 u7 H2 m: pwhile running MeltICE.7 X$ p5 ?5 a2 R3 f# _- p! N" O

+ A5 c  w0 T7 b. B9 A+ E: y, }$ X" T0 Q$ @2 a, [
  00401067:  push      00402025    ; \\.\SICE' Q# B2 u- R4 c  b0 a
  0040106C:  call      CreateFileA' X- y) a5 `; b' ^
  00401071:  cmp       eax,-001
& f+ K, n+ T; r  00401074:  je        00401091$ B! t) C: H3 f9 z
8 G' l4 j8 j) m  _

/ q0 T3 I8 h7 F3 k& v! RThere could be hundreds of BPX you could use to detect this trick.
/ L7 ^0 q  [2 l-The most classical one is:: m0 E9 j3 D' A6 q  k1 q8 B7 ], j
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
' _* B/ U/ C" M* p" K    *(esp-&gt;4+4)=='NTIC'
9 i5 L! m4 _8 |/ M- A" N! c0 ~4 v0 ?, x' h9 ~
-The most exotic ones (could be very slooooow :-(
' V$ Z. s/ W: n! K* e/ I" e& u   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  ' y! M6 F( [. W8 S* e& I
     ;will break 3 times :-(1 e5 u! b, |, d% [$ V0 @& G
3 j; ]* W1 x% B) U
-or (a bit) faster: 2 o8 h9 z" k6 [
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
7 a3 {& M' }8 p2 S8 X/ a' e
* o2 c$ x& l- W; N$ q1 ?1 ?/ X. w   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
- x4 v' W2 ~/ ?     ;will break 3 times :-(2 R% N* Q) h, `* H/ x6 j
+ }) S0 k; r, E; W% _; {0 Z
-Much faster:
0 u; b% N7 H) [% i9 c; s- ~, T, H+ b   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
9 @+ S9 O" y7 J- b$ v/ N1 z1 W( k  H7 r3 u+ b* Q
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen
/ X. i0 O9 l5 Afunction to do the same job:& M% E, E2 h" W

5 e6 R$ ~; O0 w! i1 a# c9 t: Z8 s! I   push    00                        ; OF_READ9 d- M7 o3 z! Q
   mov     eax,[00656634]            ; '\\.\SICE',0
) ]/ z9 \( Q: O7 H% k9 u   push    eax
6 Z$ o9 J* J: w& D4 ?* Y) Y$ a   call    KERNEL32!_lopen* a! A& G# h8 w# n' ^' r
   inc     eax
/ T( b! [7 C  S2 |4 o   jnz     00650589                  ; detected
  l, b2 y/ {8 H. r   push    00                        ; OF_READ' j6 x/ S# ?* n  K# _9 R% T. \- y
   mov     eax,[00656638]            ; '\\.\SICE'0 T7 h3 [; P* e- J2 I
   push    eax
# h$ P) p* ]. `6 v7 M% k  r   call    KERNEL32!_lopen
9 ]' I# _" p3 ?" v  p: H. L( E* M   inc     eax
+ L) s- l: z9 q   jz      006505ae                  ; not detected
5 W5 N" Q! j7 Q' a* q; j% Y8 M, c& t

8 W/ z: t. b% t- q( C$ s! p1 W__________________________________________________________________________5 ~1 l- v: V0 q/ J( Q
2 ?: f1 n& i# g) x3 u0 I; Q
Method 122 ^' z" D3 Q7 F" g4 L
=========% ?% G* ?2 v* L0 g" t' n3 P2 m' O/ P- D

+ \' |, r7 M) I% T) ^- m# u" xThis trick is similar to int41h/4fh Debugger installation check (code 05
) U8 E9 E( c6 @* u, N&amp; 06) but very limited because it's only available for Win95/98 (not NT)
- ]& |- m8 N0 c6 l. x' Fas it uses the VxDCall backdoor. This detection was found in Bleem Demo.
  E/ J* r2 c1 A2 D7 Q1 T: s5 a4 W+ g* X" b
   push  0000004fh         ; function 4fh1 Z  A2 c0 @. j5 ~
   push  002a002ah         ; high word specifies which VxD (VWIN32)
2 \$ @) h8 F0 Y$ v" ~! w5 q                           ; low word specifies which service
! g/ _! X4 C+ N, [- K                             (VWIN32_Int41Dispatch)
- o6 P. A$ z4 p5 j! i   call  Kernel32!ORD_001  ; VxdCall
% p$ g7 {- V' E0 `% {   cmp   ax, 0f386h        ; magic number returned by system debuggers
) x: ?# t& C5 R' h   jz    SoftICE_detected
/ D: v1 a8 A* S* b" D: {
. g* g" ^( q1 m3 }) T- M# l, ]0 qHere again, several ways to detect it:
; c7 ]" `6 @7 c
" E) `) `! ]# W/ I    BPINT 41 if ax==4f: J5 }+ n( K0 O0 C& X7 A# k3 n! h
$ }+ n  O2 c5 E' [8 ^
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one. x! f! h4 h5 O2 k

( D3 l& l0 u' N$ ^6 X    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
2 I8 ~' a9 |, }& p; ^, V. n4 _
7 V: {6 v8 p, m4 b- @" Z" T/ S    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
. z4 Q% i. t  E3 O3 c0 E& _" R/ `, \; j! q# o' o6 \
__________________________________________________________________________8 Q, `( y9 `, \/ b* ^0 n4 }
, t+ s( p! G/ N4 O4 z* b/ d
Method 13
! Z( ]- z4 O/ C: N! c=========6 M6 Y! z- e1 K
' _) Q' [  X- L* d& L% D! m
Not a real method of detection, but a good way to know if SoftICE is% |, m7 M- T5 r/ I" Z6 ?
installed on a computer and to locate its installation directory.
' N2 D0 i  x) A/ ~% c9 D' \7 t! S& tIt is used by few softs which access the following registry keys (usually #2) :
% v7 b3 T2 w' T1 v+ P
; Z1 m) i9 U. b& Z  `' J-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
% F* U" p; r8 V7 G6 v$ j( G\Uninstall\SoftICE& `9 R* J( l- J8 y
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
. W1 ]! d& S0 z1 Y" d-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion0 S7 i+ U2 y2 R# y
\App Paths\Loader32.Exe6 ?0 w/ y; b6 c1 c
/ c( ^1 u/ s: f( G8 J, w6 i

# S. ~; H" h% y0 H' u" s( RNote that some nasty apps could then erase all files from SoftICE directory
% b2 t5 |: L! y4 }(I faced that once :-(3 l# i9 j( O: i. A! W
6 [/ d( R" l/ [+ m8 W
Useful breakpoint to detect it:) P' Y3 Y# p- l" V1 u( z( c

9 P3 m% I1 N$ r" R# f     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'* m; n2 Y0 ?4 @
; ~2 v0 h$ Z7 Y: G! ~7 a, z# {
__________________________________________________________________________
8 j* {) K! J# k5 q$ ~0 [3 E) d' I
0 O+ H6 i5 I2 m5 u% ~, K
* y4 ]- i( S5 ]3 c1 I$ R% WMethod 14
9 S6 P9 w+ x  Z=========) s) ]' l" ?. h, X3 ~# I

# H+ q2 }. D* P* tA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose3 n, }, c' V% A
is to determines whether a debugger is running on your system (ring0 only).5 _5 K( ~9 B$ S* E
8 q& {. W# T. x4 @( X2 C
   VMMCall Test_Debug_Installed
: u) a5 Q. I+ y; ^  v   je      not_installed
. Q4 q4 [0 D7 l; p, F' C$ R6 y1 _3 p
This service just checks a flag.
8 x( K/ `4 r! R2 f* m( }</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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