About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
: E3 Q# i$ L  t0 l: i( t( R<TBODY>
0 Z8 @9 M" Z+ f6 P' _0 m<TR>' C. l: }2 o/ s( t: r+ Q
<TD><PRE>Method 01 - x7 x% `; `  g6 a
=========  o9 W! d4 l9 O" v' G9 C8 N7 H

7 S4 D. j- F0 G2 NThis method of detection of SoftICE (as well as the following one) is
+ S4 r% N7 l; Wused by the majority of packers/encryptors found on Internet.5 D& P8 y, S" j* y% U: I0 o6 ~" ]
It seeks the signature of BoundsChecker in SoftICE
9 f) `8 q& E* W9 T/ R# t, E) R1 o) j
# J- U" H! B# O8 n3 N3 y    mov     ebp, 04243484Bh        ; 'BCHK'' |: |# j% t" k& W
    mov     ax, 04h# m9 J0 ^* }9 o2 O! G" m
    int     3       . i- ^% d* U" J# Q5 b  u, ^
    cmp     al,4
* W4 c9 H: ?4 r* p. N    jnz     SoftICE_Detected: L, G2 b+ [- Q- p/ N
- d' V- Z3 z5 \1 k4 w
___________________________________________________________________________7 w3 l: N) G/ w* r7 s$ q
: y' u9 c" B# g
Method 02
( P$ s2 A0 y. _! D3 c( O=========
) P4 s7 z- m8 U8 K. [& A' D8 S- a0 ?& }5 s0 ]& |0 p
Still a method very much used (perhaps the most frequent one).  It is used' C* p( \1 E3 z% o! ?/ ~
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,
8 Z5 p! [4 U6 m7 Por execute SoftICE commands...+ p* r1 J2 r. H
It is also used to crash SoftICE and to force it to execute any commands! G6 }8 X0 X) u! K! D8 R. k1 l
(HBOOT...) :-((  
3 t5 d) \7 |# A1 J+ [: A3 j1 g" f8 d, O1 u) _
Here is a quick description:% L( A- n; b4 p+ @. v; W
-AX = 0910h   (Display string in SIce windows)
( Z$ J+ a: T9 o# p, r/ @1 z-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
/ E0 Y' e1 m8 z+ {$ C$ M0 Q! E-AX = 0912h   (Get breakpoint infos)9 a' C' L$ d8 y, a; y4 L
-AX = 0913h   (Set Sice breakpoints)
5 d7 A+ U! s- d; r$ ~-AX = 0914h   (Remove SIce breakoints)
- p# }5 o+ j8 e1 i' J, K" O  |
* {7 b! p% e3 U7 TEach time you'll meet this trick, you'll see:. X) Z% a0 W6 r+ M
-SI = 4647h4 r. ^( ~/ r5 f) }6 `* l
-DI = 4A4Dh
" i5 ?1 [! X0 eWhich are the 'magic values' used by SoftIce.
9 `- L2 r" a1 }/ hFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.
0 G# K4 E8 [+ c6 }/ ^$ g; m. ^
- g4 Y# c# E. ~' Z# e) B; r% o3 xHere is one example from the file "Haspinst.exe" which is the dongle HASP
: E6 W2 R. `1 C! ^Envelope utility use to protect DOS applications:
- q8 P% a& C, v7 j8 ^9 B% a! r: S' A% |) E+ M7 c

+ P( M" G/ w3 ^  |4C19:0095   MOV    AX,0911  ; execute command.$ C! ~# r' K& |6 y
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).9 K) a( G' k; y
4C19:009A   MOV    SI,4647  ; 1st magic value.
( W# x8 z! t8 o7 V' m9 [4C19:009D   MOV    DI,4A4D  ; 2nd magic value.9 P6 T* J1 L# |9 k2 K  O
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
5 E  O9 D5 q2 ^! n1 Y4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
( a8 f0 V+ k& E# ^- I* M, G, _- P4C19:00A4   INC    CX
' W$ u$ n7 V0 |, a9 Y, I6 s% }0 r4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
( k2 k+ U1 u5 e. k9 z4C19:00A8   JB     0095     ; 6 different commands.
+ t+ S) ~6 K6 c; N4 W4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
7 k5 h3 y  `% \$ U+ |5 X' M4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)3 K0 j$ G7 P# A* v, X- L

9 w  \/ b( P& w7 C7 [9 S( z1 v* nThe program will execute 6 different SIce commands located at ds:dx, which  g3 ?; h$ |* c* |. N( ~
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
$ j& {# k7 ]& E1 T  L5 O/ E+ s. b% B- p. D
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
2 g% C, j2 P  ~9 t& u% H$ H/ y___________________________________________________________________________5 {* r" R! [! S

2 ^' P+ V+ t, Y- g" r6 m4 |
, F/ U1 g4 W; h; X3 m5 w8 ?Method 03
7 |3 V5 K7 _) G! t=========
1 m- ^9 @# n) f& P8 j- a% j& ~3 X9 ~3 i
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h6 S6 q* J  }0 M" r8 T% b8 Q0 `/ F
(API Get entry point)
  o7 n" U7 k  }' r, p2 J        
3 x" j3 b) O( L* }" X- e: y$ r) q( v6 w9 q
    xor     di,di
) o# v& Q7 n3 x! j6 s    mov     es,di
# W( \) E5 I: ~9 h2 Y: a8 N    mov     ax, 1684h       0 i8 ~) ~0 @. B
    mov     bx, 0202h       ; VxD ID of winice# Y' M- T2 ~" l6 e- r
    int     2Fh+ L* d+ S% t- X
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
1 O& Q+ h5 j: b0 a: x) l4 C    add     ax, di' N* J" B+ P3 `1 W' e
    test    ax,ax" O8 c' t% W2 b" N! p
    jnz     SoftICE_Detected
) |) j2 `* ~& C2 ]" Q3 Z9 U$ ]+ \1 L- u' W: T
___________________________________________________________________________4 B6 J/ @) ?8 H. z4 y# q
9 N5 ?% ^& g* o& g* D* g: c% ~! \
Method 040 K3 t. O% s4 e& {* Q
=========
% e! G% ^  \2 K3 S& }" j" k, O
. r; ?7 C8 D2 B) n* e5 GMethod identical to the preceding one except that it seeks the ID of SoftICE0 Q! O: F+ L2 l* o4 p% a
GFX VxD.6 f' M  E5 H) `8 s* d
# V& J5 D; m4 N8 W  J
    xor     di,di
, W2 o" E  @1 ~+ s    mov     es,di
* e6 n$ {; v- q/ ]( Y7 V+ B) \    mov     ax, 1684h      
2 r& i  M- K9 s  Y. o    mov     bx, 7a5Fh       ; VxD ID of SIWVID
# p9 S% G7 \, j    int     2fh
3 k9 c, c0 j3 z- b% w    mov     ax, es          ; ES:DI -&gt; VxD API entry point" q8 ]4 ?5 S/ o3 ~. \
    add     ax, di
. h7 ~; s& r3 k3 s" d    test    ax,ax
4 m' b9 T# Z) Q8 |$ d% m    jnz     SoftICE_Detected
* |3 W0 H7 H# M1 y- [$ ?( a1 K* t7 ]" w' W6 h4 ^2 s
__________________________________________________________________________
0 L; ?/ d' |% w. {3 _8 I  \
* a  s3 v0 _0 |* Y
9 B  [( L7 P, Q7 M( q, `Method 05* P2 y7 ?6 G; l6 L% l; ?. ]
=========4 P9 b* t; F& d

+ c" v1 r) P2 b2 O8 z4 j: rMethod seeking the 'magic number' 0F386h returned (in ax) by all system# Z  \2 T" z2 c8 g
debugger. It calls the int 41h, function 4Fh.9 M6 t; C5 x9 M
There are several alternatives.    t# g  Y7 V9 O% p' U. j1 h  w; _

, |, {: M6 J. l# ^The following one is the simplest:+ Y: w# \. d% c' q

4 l- L; F9 }# [2 ~    mov     ax,4fh
: b! v: j8 e6 @" d$ i# d" }& A    int     41h
' `  W9 w9 x* J; E/ u: Q: F    cmp     ax, 0F386$ V& P' K: R3 W! V# y2 f3 |& b
    jz      SoftICE_detected* t- \8 d: }4 M6 n/ G3 B
8 U( `, P' U3 @+ K7 ]; k( a
8 E) T8 O) l9 B' m" T' n
Next method as well as the following one are 2 examples from Stone's . Q5 l; Q4 E5 U& J! _
"stn-wid.zip" (www.cracking.net):
9 t9 u$ y7 J* e
+ W, q6 F1 y$ d& a# B5 l" N    mov     bx, cs
( Y4 e9 a5 V' v" F4 c- F    lea     dx, int41handler2
% k9 o+ I% d& y7 e8 O1 f    xchg    dx, es:[41h*4]
1 Q) ?4 ]" Q, t* [0 G' g/ ^; `$ g$ b    xchg    bx, es:[41h*4+2]
4 X  W" B) c6 J/ I7 s    mov     ax,4fh: X* U& K9 E0 [# k1 |9 T' q9 C) j
    int     41h: L4 e* U+ x$ r  S# T
    xchg    dx, es:[41h*4]2 e1 _% F$ y/ @1 I, I" ]- j
    xchg    bx, es:[41h*4+2]1 M0 C9 y! ^4 n/ \
    cmp     ax, 0f386h
: ^0 U. k: }; ^& ]4 O7 ~    jz      SoftICE_detected8 |+ @( e# \" E) j! v

! P& d7 G$ Q  L6 ~9 e. Nint41handler2 PROC
0 X" v* _' P' f0 B& C6 G2 f    iret
  a" D) ~2 i: H( }int41handler2 ENDP& }$ V8 j& U, l$ w
$ b8 I# M$ y# G" P0 O

$ ]  @  l+ E; s0 I2 y, T_________________________________________________________________________3 ?. a, G# ?. T! L! v1 {

: W6 N" z8 V( _- D# e5 Y- X; [; |0 f; P% e0 T0 K* j$ t
Method 06" H, @! ]& @$ H$ D3 U$ l4 ~2 J9 k
=========3 c7 t: L2 f1 s2 |; ^; ~8 H
8 Z8 y1 j4 {. r5 v/ F3 H7 J
. l6 c1 H( D3 q. G7 Q
2nd method similar to the preceding one but more difficult to detect:
1 O8 N7 ~+ c7 a/ {0 U: Q5 l
& z  P# m6 L- O* E- {; i6 @# Q1 b" J9 \/ T" z
int41handler PROC' k1 H0 {0 P7 p
    mov     cl,al& G% d# M. |% ~" I4 [9 [2 _
    iret
' j, s: c/ a: @4 o  xint41handler ENDP
5 a! ~* P/ k; ~9 k+ H; G4 V/ w4 u# `! ~: _3 k

' q  ]( V/ S% z. a& y1 P/ A- w1 e* w3 B    xor     ax,ax
+ a# Z, k8 Y$ F' m; i2 k% O    mov     es,ax
+ K! U  ]* e1 i" ]' o3 B    mov     bx, cs& p+ \' d( c8 p% ^
    lea     dx, int41handler$ v7 y8 A: ?( U2 y$ Z& C2 b
    xchg    dx, es:[41h*4]& G. f1 v: z6 `1 e
    xchg    bx, es:[41h*4+2]  B/ p, d' J0 F1 _5 O" X8 b0 O. Y
    in      al, 40h! k3 W) Z# D# h' {" P
    xor     cx,cx
' o- m/ H2 S0 P) V# A0 a6 @    int     41h) G$ p2 u$ W1 Y7 C
    xchg    dx, es:[41h*4]" i4 R* U% ]) D4 \& u, E. F
    xchg    bx, es:[41h*4+2]
- j' @$ J0 n  j% @    cmp     cl,al
& i) l0 V) b+ b# K    jnz     SoftICE_detected
, K/ S+ R9 ?- M( r( S/ Z$ {" Y1 X6 z, C; b+ G8 \- O
_________________________________________________________________________
! E, W* Y0 Y% Q* f) ?6 ]/ F0 b
+ w" |/ o- f( d1 Z6 cMethod 07. T/ y- V+ L2 E" S8 M6 N* a1 o, ]2 s- g
=========* J# |4 N( A, ^
5 A3 z3 }8 B3 q; x
Method of detection of the WinICE handler in the int68h (V86)
3 n1 U3 R* n! o! P3 }0 E; e( ?7 N; D2 R, R  D  d. I
    mov     ah,43h
: K3 T9 {) l9 s0 W; s    int     68h
9 j! q, {* X5 ]# o1 ^' X! j% `    cmp     ax,0F386h7 X% ]# |1 [6 k
    jz      SoftICE_Detected8 X2 w( ^, @% c8 ?9 k7 L5 B6 T- c
2 _1 v2 e/ l  _- g

$ Q# }" e1 W, W, z: v=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
) {4 f3 r1 D) s2 x- r. `* W+ G! m# _( |   app like this:
# `6 l8 ]: [2 j
* i$ [: r( s+ H' @4 ~" z6 q$ g   BPX exec_int if ax==68
  x* Y" D* d  I# W- }3 l, y! g' w   (function called is located at byte ptr [ebp+1Dh] and client eip is
3 x1 I* q0 R* @2 {0 x( E   located at [ebp+48h] for 32Bit apps). E" P1 Q, A' i2 t) ]% o
__________________________________________________________________________+ y' d% O5 X5 A- ~# ?1 f. ]5 r
9 V. a" g5 C4 F' f0 S6 b
) o. H6 X' @$ \0 q* n/ X# u$ i1 R
Method 08
; W$ G8 @" T- ]6 a, D=========& O! V/ w8 u2 i

% k' B/ b( i! Y7 _8 FIt is not a method of detection of SoftICE but a possibility to crash the
1 P" Q$ k; N: bsystem by intercepting int 01h and int 03h and redirecting them to another
% B7 {0 `. C5 z% zroutine.; B/ e+ u6 d2 {: d
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
6 G6 z- W- Z5 S4 Xto the new routine to execute (hangs computer...)
/ @( L/ X- @# ~& a& ~/ S$ [7 `/ T5 \! ]/ H9 D" S6 S
    mov     ah, 25h
8 C# s: `: W  |& A4 Q* _, l4 ~    mov     al, Int_Number (01h or 03h)' Q2 ]- V% J+ N, s# Z
    mov     dx, offset New_Int_Routine2 {, }0 z- D1 N+ m" C. W+ K8 P
    int     21h
; i9 Y# }' L8 `5 J+ B8 W1 C5 D! m, M, j+ p2 Y  g% f% G8 p# l0 a/ j! T
__________________________________________________________________________! [9 i$ V  h7 {3 \- m# m
3 u+ H0 C; e) V* X1 |% [8 ?; S
Method 09
# `% {1 @& p* J+ o! Z8 @7 ~5 |=========+ w- d- b+ H2 @4 z. F8 p* B. Q

8 B4 V0 W" w5 p9 s) q7 [: G! F  GThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only) y- t1 o* c  _& L% u$ M
performed in ring0 (VxD or a ring3 app using the VxdCall).* C* p  m8 R* l+ u; \2 ?$ Z
The Get_DDB service is used to determine whether or not a VxD is installed: N( P" E* R& H" m, Z7 ]: Z
for the specified device and returns a Device Description Block (in ecx) for
" F6 h' }) Y9 J6 \" jthat device if it is installed.9 S, Z8 ^  B; c) J$ T

7 T: f& ~  P: _+ @   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
1 T& N, U4 ]" O9 v) k) d/ U; \   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
% E9 a3 E& m5 ?2 I: H8 x   VMMCall Get_DDB4 y* P: r$ m) H& z; `
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed6 ?. E: x# p4 [7 E
6 Q; j: Q: M; [/ Z6 j6 m
Note as well that you can easily detect this method with SoftICE:
4 S2 D3 h/ F9 j. G! R  T5 }, H   bpx Get_DDB if ax==0202 || ax==7a5fh
2 a& P; q' U, S
4 j1 K, F* ]) R9 e- S: J4 P( r__________________________________________________________________________
2 M% @$ V+ H# o# _$ J
* y( N. e4 o- V! }, G" DMethod 10$ @8 R) z! m# |4 O* Q+ C
=========9 A& B- q5 h' W. E- F

" Y& v: D3 C; b% L( G; b& G( D: S=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with% z* `- Y$ t! V, p6 m) V& C! a
  SoftICE while the option is enable!!
  N# U  A( T. ?; F/ U4 X
4 A, Q2 p( k- e" u  t" Y$ _5 dThis trick is very efficient:
0 k" W$ q4 U! ]$ U  V6 ?by checking the Debug Registers, you can detect if SoftICE is loaded
9 Y7 O) v$ r8 V0 }( k2 H- Q(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if3 M7 |$ Q& N; ~, J2 }( _6 E: K# N
there are some memory breakpoints set (dr0 to dr3) simply by reading their
, h' D0 B6 D* c6 o3 i+ o) Lvalue (in ring0 only). Values can be manipulated and or changed as well' u: Q, b- L2 m+ P6 ~$ M
(clearing BPMs for instance)
# K8 I0 ^: D4 Y8 e  D- @8 q; {1 L1 d  \8 ~
__________________________________________________________________________. S' T6 y# A5 L7 G3 m3 ]2 e
* K9 k. J  \! `# C* _6 |
Method 11
6 x' ]  |4 \+ z) j) E=========6 p3 d+ [3 C" `% b0 U% @
  U! E, b, |- n! ]& T
This method is most known as 'MeltICE' because it has been freely distributed
& Y% ^0 |& D8 {, v1 W; z0 c, C- Xvia www.winfiles.com. However it was first used by NuMega people to allow
2 r) w0 b+ D, E" s4 C" k! GSymbol Loader to check if SoftICE was active or not (the code is located
6 J+ d" @% f' P. einside nmtrans.dll).
6 E4 r. l* q+ D, ]6 m/ H
9 X1 f; [- {1 S# p; t6 `7 M& lThe way it works is very simple:
' Y) O/ ?3 s+ p9 eIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
2 ?1 G" x# S) N; d/ q8 JWinNT) with the CreateFileA API.1 ^$ m7 D! T6 i$ }# n% ~/ s
0 e  f1 M& L2 d" c6 C
Here is a sample (checking for 'SICE'):5 p9 Y6 X; m; y
  ?" P. s2 ~( x  M
BOOL IsSoftIce95Loaded()  _$ Y9 T, [) Q; |1 E
{8 S* a5 e. p' ~: h- E* G. L1 V
   HANDLE hFile;  
& @' U1 j. Y1 f  s( M   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
* E0 \8 [; j0 X& P( O$ A                      FILE_SHARE_READ | FILE_SHARE_WRITE,: ^, D1 ?, h% y2 a! A& w
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);$ j  w6 I4 J! H6 B( C) i
   if( hFile != INVALID_HANDLE_VALUE )
( L- X9 q+ I# I, _# k; H" ~   {1 _& M" C  E1 H& W* K% w& f! t
      CloseHandle(hFile);$ C4 C# J9 @  ?- F7 Y- v
      return TRUE;
, d+ @& v; W% Z) Z* n   }$ U: k& j2 M) m" N, l0 e  @
   return FALSE;
) K1 F6 x; M- T0 ~}( B! f& D; }( y" L7 e
# O5 B/ P2 \8 w" O) R
Although this trick calls the CreateFileA function, don't even expect to be# @4 a% j: Y# @. W/ j' [$ \, t
able to intercept it by installing a IFS hook: it will not work, no way!6 S, @4 Q3 }! k
In fact, after the call to CreateFileA it will get through VWIN32 0x001F1 C8 [9 _( ?# V: [
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
( f& r, M- I$ @and then browse the DDB list until it find the VxD and its DDB_Control_Proc
3 H2 U/ w, V5 C$ K( w) j+ rfield.2 [# c- N5 w# U0 B
In fact, its purpose is not to load/unload VxDs but only to send a
* t# J7 H$ c) k. z. M# W. {W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
+ P  }. g% R' j: }to the VxD Control_Dispatch proc (how the hell a shareware soft could try) y+ p4 z3 s) {2 |
to load/unload a non-dynamically loadable driver such as SoftICE ;-).( g+ i8 B6 j" I+ u# R, l+ `8 E
If the VxD is loaded, it will always clear eax and the Carry flag to allow9 M- J* s( }" g0 u( e  N2 o+ u
its handle to be opened and then, will be detected.
- s! \+ ]0 r6 r/ VYou can check that simply by hooking Winice.exe control proc entry point
6 @, C" I  Z8 ?: w' awhile running MeltICE.
/ p, W: E3 l5 c  C* I- h
% ?7 L' B* S; Q0 h$ L8 H3 t1 i- T- K/ t- U
  00401067:  push      00402025    ; \\.\SICE
8 m/ [& J1 {2 Y  0040106C:  call      CreateFileA8 M1 H6 i3 k+ h) v, L8 i6 Y/ |7 k
  00401071:  cmp       eax,-001' w3 E8 f: @3 M& o. O  k, F
  00401074:  je        00401091. G# g/ l; _/ w" k+ d8 Y; x
% Q* K1 F. Y6 D6 e
1 c' g8 Y$ _2 I# ?5 t2 `- b3 Q. F& A+ Y
There could be hundreds of BPX you could use to detect this trick.
3 B) G1 I) r$ Z-The most classical one is:
! z2 \+ N, D) y4 W1 d( Y  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||3 L2 J+ V8 h; @) G
    *(esp-&gt;4+4)=='NTIC'
+ J. a" l. Y' q
+ K! P6 U2 Y) Z-The most exotic ones (could be very slooooow :-(+ v1 E6 {/ W0 g; V
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
" [1 O( j  h5 J# \& D     ;will break 3 times :-(0 N' @8 ~& {9 r- r9 k" v' q
) O7 v6 n+ R! ]1 j, ~9 ]
-or (a bit) faster: $ x/ v1 q" o9 `% H1 D3 p
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')0 G( q8 [" m- A* o2 ?8 ^

" a9 n7 R8 J7 `   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  1 V) n2 v" I2 \$ G* v0 o0 X5 N9 L
     ;will break 3 times :-(6 ~( V7 g' y# R6 N: @8 ^: B
2 [9 C6 H8 N! B1 O1 R! a: F3 g+ Z, v
-Much faster:
: f% J. k: Y9 \4 i. _* q2 D! j   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'- j  {' o- M3 R: G

) l* o6 l3 v( ]' yNote also that some programs (like AZPR3.00) use de old 16-bit _lopen
/ Z  p) c8 h" W& ?& }! wfunction to do the same job:
. M) Q& ^& H! Q& e% h. S( ?% o3 ?3 P9 k' r  M6 I; {5 a
   push    00                        ; OF_READ# h& y2 C4 V9 J$ x3 V) x9 x. E' [' K
   mov     eax,[00656634]            ; '\\.\SICE',0) S0 d; K; n# B: M1 V, q
   push    eax  E) I( [/ S/ P1 t6 s
   call    KERNEL32!_lopen  d( B, |6 R+ C! Q. A# g7 D
   inc     eax
& `6 {, N$ b# O" B, o* R- e   jnz     00650589                  ; detected# J  ?6 p3 @: E0 m3 y/ [
   push    00                        ; OF_READ
. s* @0 k2 d1 o" i   mov     eax,[00656638]            ; '\\.\SICE', a3 G! m- `# W4 L% z4 j
   push    eax: x5 L4 S; I2 `9 m4 }+ P; ~6 ?
   call    KERNEL32!_lopen
' e* R! m' ^4 {( R* w8 [7 L( B   inc     eax
8 V& K7 ~5 V( y7 m* [7 Y( j& s   jz      006505ae                  ; not detected* b% A: Z+ `+ K# ^4 ?4 l% Q

& c! U+ Q. h" v& p. b0 f7 F& S+ E- g0 v
__________________________________________________________________________
- p( z2 i9 F$ z; o
% \9 d4 q( l% C( ~3 n1 nMethod 12
2 X: y  }7 b0 j0 y2 O+ d2 J=========
  D0 Z( R0 B( t' I8 S: o$ J- c4 G( b# o! |* r* u4 e9 _. a6 M
This trick is similar to int41h/4fh Debugger installation check (code 05; P) m7 ?' J1 w% J: ^8 l
&amp; 06) but very limited because it's only available for Win95/98 (not NT)* [  H9 R7 q4 ^! a! D* Z2 }
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.
# Z9 T' }9 Z2 G8 C
5 X0 U2 p4 H3 D1 c   push  0000004fh         ; function 4fh
4 |2 J/ b! F! g   push  002a002ah         ; high word specifies which VxD (VWIN32)
- {! w5 E& U" r% A4 h' X6 ~$ [: @% ^. N                           ; low word specifies which service; y, H6 X' C' h& H4 P
                             (VWIN32_Int41Dispatch)+ D" p' S- o& i9 j9 a# p
   call  Kernel32!ORD_001  ; VxdCall4 k4 l; |; f/ M* }# {4 j! I2 k
   cmp   ax, 0f386h        ; magic number returned by system debuggers5 ~4 H- c9 }4 G% c0 d
   jz    SoftICE_detected# g% m  Q' j5 H8 D# I' L* u/ X
) b6 d, ?3 n7 Q% _/ R
Here again, several ways to detect it:
0 `! |% [3 L2 f0 E) A
& z+ k! Q4 C, ^) R% H    BPINT 41 if ax==4f' V" c+ _2 ]( r- y* o. ?
0 a2 K: u. m$ C
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
& F. j  v8 h# H5 \9 N' {/ k2 |$ G) G3 s# h- i
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
- x+ Y$ H/ g' c; |8 `* ?+ G6 {' a1 V" J& ~, o
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
1 `4 @7 e. ~7 c- ?' S
7 R6 G5 K( w1 @. T0 C__________________________________________________________________________! q1 m: V/ _: f, j

/ O1 C4 |; ~; _% n) C3 n! fMethod 132 m2 ^% O) w: \3 D8 c: }
=========
3 T" s( j, c; i- y7 x. ^* T4 U8 K2 W  B6 ?, F
Not a real method of detection, but a good way to know if SoftICE is
8 m9 M" P8 Y9 G& ^installed on a computer and to locate its installation directory.
8 |7 ~. v% C; @; l1 h; fIt is used by few softs which access the following registry keys (usually #2) :1 n1 }& }% j* b/ R& f0 Z, r
; G) S# m; `& O; O, b- b
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion! g7 V. x, \. |0 [+ F! y
\Uninstall\SoftICE, q9 H# P  I( P; t3 p
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE- K; {3 B2 s3 \' @" {* ?
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion7 Z2 o# {4 Q% t- N
\App Paths\Loader32.Exe
$ F" U% h5 l. ~( L3 M0 C# W. D3 |# R/ e$ @

2 h" z; r, L# y' INote that some nasty apps could then erase all files from SoftICE directory
1 q" W- u$ J( |) s2 n2 G(I faced that once :-(+ q( w  A% Z$ p( L' v
( j  ~0 ^2 v) F8 i/ }
Useful breakpoint to detect it:
6 T6 _, H# \8 R) F) M1 J( f3 ^7 @" f" l9 [
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE') V  w9 D2 A6 F, m# t
6 Y3 ^( _- M8 D/ ]
__________________________________________________________________________
$ {, F9 L8 O: S/ F$ n& _3 G- w1 T  v% `
3 g. m4 m' s7 S
Method 14 ' h' J, q' u  x- m8 {/ N% r
=========1 Y0 [+ _& f" o0 k
0 h' s8 Q- v5 x! [5 z$ ~& \
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
: A) A8 V# y4 A& M1 _is to determines whether a debugger is running on your system (ring0 only).4 e8 W7 k. v( A

& H' k: s0 k, _7 t   VMMCall Test_Debug_Installed6 @$ g; {% e) e
   je      not_installed# @! Z" t8 z0 i) U+ M
1 }- K+ n( z0 {. M/ d
This service just checks a flag.
9 j7 O. O* ^; h+ j5 M</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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