About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
/ o; U0 {' u. Y9 d) m: L- ?<TBODY>
3 q2 P& h1 u: U8 u' B% L& f* ]<TR>3 d. \# z2 }( W" w' x4 O/ t  ^
<TD><PRE>Method 01 # E9 s6 I( {2 m
=========
& H- M# C, P# l! E( ]( \9 [! K- }. I0 Z) D  w5 s/ p+ F
This method of detection of SoftICE (as well as the following one) is& q- v' g  K% @$ k2 K! }' [
used by the majority of packers/encryptors found on Internet.' h- V7 d( w# s) [
It seeks the signature of BoundsChecker in SoftICE9 o, q6 L# ^' w5 Y* E! _( y3 z8 m

2 y: R  V4 `7 Z: ~1 z" m    mov     ebp, 04243484Bh        ; 'BCHK'
2 ]1 A4 @: O+ H* u7 |5 g+ {: }* o    mov     ax, 04h% y( l! e6 r$ R
    int     3       : F, U. p% F! V; y, h
    cmp     al,4) b$ l" p  e/ Y. W6 y
    jnz     SoftICE_Detected
8 M' ]& b# V8 v4 Z) w- Q, }* i- q6 L3 ~$ v; Q
___________________________________________________________________________
9 `# B" q4 ], Z5 ^- W( E9 e" p" R& E1 S9 t) g, c
Method 02
! [+ L; {5 P' g' y=========
; Q+ t* @& g& q; i( x! n# p) |9 z3 F  b; A" i
Still a method very much used (perhaps the most frequent one).  It is used
! c5 Q, ?; `+ Bto get SoftICE 'Back Door commands' which gives infos on Breakpoints,
; i9 B. C( y+ l7 l$ {7 o) I7 Tor execute SoftICE commands...
# _2 f4 p# p9 H9 UIt is also used to crash SoftICE and to force it to execute any commands' q" Y+ V' [5 g0 s, u) Y* J# t
(HBOOT...) :-((  
6 m/ n0 [; ~$ Z! f1 G
) C; X" |! b7 ^) ]3 ]  |Here is a quick description:3 s1 \2 D/ }9 }! \1 R
-AX = 0910h   (Display string in SIce windows)
9 Y! M7 |* ^6 J-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)* N8 Z1 N9 R. Q$ m6 U# {9 H8 k
-AX = 0912h   (Get breakpoint infos)
4 [4 ?' b& g- g$ e  J-AX = 0913h   (Set Sice breakpoints)
% |: ]- C! t) ?* E% x-AX = 0914h   (Remove SIce breakoints)+ G! @1 |% X. [1 H) p

, x5 ~2 k; h% _& |6 }4 VEach time you'll meet this trick, you'll see:5 ], U, B9 X3 E) t  j# c
-SI = 4647h" q$ m6 x" h: k& I( p1 X' h5 ]
-DI = 4A4Dh
# I! b& r8 y- k$ e: lWhich are the 'magic values' used by SoftIce.
$ m9 e9 R8 v" D- [2 |& mFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.7 p" }' o! n# ^. |$ t7 ~
2 h" S& G! w2 \6 ~( B  Q
Here is one example from the file "Haspinst.exe" which is the dongle HASP5 P' k2 R8 k# D5 Z: _; P) D* g
Envelope utility use to protect DOS applications:
; q  ]9 Q3 M3 t. ]8 U+ x+ Z5 G
4 Z" `7 u) Q) s4 A  k5 E8 V- F+ u4 \7 }1 W/ P' l% e" B
4C19:0095   MOV    AX,0911  ; execute command.  h' V3 `- ?. T0 h; O
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
, D+ ^9 E0 u. L0 i4C19:009A   MOV    SI,4647  ; 1st magic value.
3 h6 j. N9 E" |/ s1 b3 H4C19:009D   MOV    DI,4A4D  ; 2nd magic value.5 H7 h9 R3 c  z2 Q
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
6 f9 Y1 F5 c& P- a7 {% t4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute& C. S2 D: W& p; h+ y& }5 {
4C19:00A4   INC    CX
% `# J- E" A# }  P4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute0 n8 {* @2 U1 h: p$ l
4C19:00A8   JB     0095     ; 6 different commands.; ?& z* V2 Y# Y
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
0 a" b: ~$ e  B  n4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)/ D/ d3 O3 ~7 d  l% n

$ P  A1 z* S* e( [1 b9 rThe program will execute 6 different SIce commands located at ds:dx, which
  x2 Z3 y  j* {6 T/ mare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
# V/ v/ s/ @& n$ V0 m# \! H
+ ^) E, O, ~8 f# R4 P1 q* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
; x8 A" Y  p$ h2 ]3 X9 o& ____________________________________________________________________________
8 d! t; i' y0 o" l( V8 L0 W9 Y8 H0 \+ o- G* J* [8 ?
% _3 J/ ]( o* P2 b
Method 03+ U4 E" _% h# J7 S) `1 f* ^  ?
=========
; `4 M2 [4 x! o  }# Q! R1 e) T; [" |# o9 Q; ]
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h5 F9 m5 u8 @6 S; J
(API Get entry point)+ p: p2 Q' d* u- l9 X# t% f- ?
        7 t7 l; @& g3 E) w3 d' E' O% q

7 y* o2 t6 E- J4 h. i4 |    xor     di,di* a. P2 \) o: u, g
    mov     es,di4 E  {2 e/ `% F0 v' ~4 Q
    mov     ax, 1684h       ; ~* D9 @8 ?7 z( ?- R/ Y/ {
    mov     bx, 0202h       ; VxD ID of winice
% r1 R8 d( n* ]7 N& j    int     2Fh
) z3 R, u, L3 P4 e2 }7 c    mov     ax, es          ; ES:DI -&gt; VxD API entry point0 o  F4 V  N/ C4 p5 z. [, S
    add     ax, di
# w1 Y) t6 c8 i' e1 b" ?    test    ax,ax
9 s+ y) A& A* F& d0 N0 X    jnz     SoftICE_Detected* M0 M: r1 _4 |  k) l8 ~! J/ n7 l
9 r1 H2 d6 g% o( V- b0 S
___________________________________________________________________________$ f7 W. v1 ~; F: K/ ~
! \2 P) T8 o' l5 }
Method 043 ?4 R4 e4 s; K- R! o0 d9 x
=========
! A% u" H+ G" k! O4 f4 v
0 g, A9 ?; H& C" b& gMethod identical to the preceding one except that it seeks the ID of SoftICE
( R) V- O0 l# J' ]! o. C& |$ b0 bGFX VxD.0 @% H! k3 B# ?0 }) j
2 y' h) r8 l; d
    xor     di,di
" P2 f8 z% I# b2 G: \# D    mov     es,di( c  L, w: @$ V& @" W
    mov     ax, 1684h       8 t; O" w0 N. x
    mov     bx, 7a5Fh       ; VxD ID of SIWVID
) y& ]/ A9 j0 }* w% H: k4 j! ?5 m6 f- _6 }    int     2fh
* |* j4 }+ P% Y' Q    mov     ax, es          ; ES:DI -&gt; VxD API entry point
' |6 R* c' Q7 K5 u    add     ax, di
% k- n7 a; ^6 m7 H: i- Q    test    ax,ax
' g! w  N8 T+ l/ ?2 i& P    jnz     SoftICE_Detected: E& B/ }7 U" V8 b5 I1 L4 b1 z; K- h; L

) h( ~3 v! o/ U7 n__________________________________________________________________________
  A+ u+ V; x& ~2 G% ?# Y' s" [0 @  n% v* X+ z: Y

* }8 P. |: C. S6 R+ X, w% n% JMethod 05, Y# g! j2 C( f5 M/ ]) C% j
=========
4 O( E( l% w  p' H9 m3 u3 z, q6 X9 H1 P% {. w
Method seeking the 'magic number' 0F386h returned (in ax) by all system; u- R3 R% x9 F9 J4 x2 R
debugger. It calls the int 41h, function 4Fh.. H- H, g/ v7 X3 }2 ]0 B" H
There are several alternatives.  
# C- ]! k9 k! |& D8 b: K9 W1 x$ ]) }
The following one is the simplest:% x, C' Q; e: [
) e+ y9 K: g. s# C
    mov     ax,4fh
2 T: ]1 ~8 w- g    int     41h/ H% @0 F5 a1 w) I( D! S; k* [+ n
    cmp     ax, 0F386! _9 R  b5 N: }' z; m$ \
    jz      SoftICE_detected1 x+ h  U) o# _& M! M; U

; _; Q3 p  Y5 }
6 J7 w+ V. D1 e, i# @* [& [) f- uNext method as well as the following one are 2 examples from Stone's 3 v. y% n' J5 Z. a4 ~" {( Z
"stn-wid.zip" (www.cracking.net):$ _7 V/ c# x( R; d& }# J

7 a  }5 K. e" ^0 s) K& s0 A    mov     bx, cs$ g6 v4 a) p3 G! T
    lea     dx, int41handler2
; j* F( U* S5 Z# u: V    xchg    dx, es:[41h*4]
6 J7 x( C3 T% S4 m$ v    xchg    bx, es:[41h*4+2]
9 k3 C  N& P% |: N/ ^    mov     ax,4fh1 a6 j' l# P  Y4 U
    int     41h# c2 c! F* T& v( f3 P
    xchg    dx, es:[41h*4]  R  v$ A, e; W7 Q7 `/ G% e
    xchg    bx, es:[41h*4+2]+ O5 Y4 `/ K9 F
    cmp     ax, 0f386h7 }, e6 t& L3 \, {5 @, D% z
    jz      SoftICE_detected
% H6 o( d1 t. j4 R3 u+ W& t
5 e8 h" {8 e' Lint41handler2 PROC% P6 _1 N, N" b% g2 z
    iret
# b( y  j$ q, [$ x0 s& ^& p' S4 qint41handler2 ENDP
6 M" G* G, n% M' O0 g; B! }: l5 n# U# w0 S7 `3 V9 q* u
' x" c6 M% k! P: _; Z# p
_________________________________________________________________________/ o& G: F  V( e: C) H

9 }$ {, D" e5 X( \% N# z, K$ l: U0 t+ {0 w$ o6 L
Method 06
1 L2 u" K. ]4 g6 R0 I6 _=========$ H4 D" C6 G6 |" ^
& o5 Y' e5 j2 I
( h) K* d1 y. `3 G. z" l# z
2nd method similar to the preceding one but more difficult to detect:5 t  E  r& Q5 U8 [

/ }3 O8 T2 p3 M0 x$ k, o4 ^2 @. S: X% m  K/ w) T* N
int41handler PROC
# C, v& O6 B+ M0 J) }6 {5 z    mov     cl,al
9 }2 w: k4 l6 Y8 L    iret5 X" d. i/ e# a" _7 p" _
int41handler ENDP8 w- P4 I3 D5 b8 f4 M2 P3 t# l: |; R$ T

, b& A% O; M% I: ?6 Z9 d+ B; J1 b9 c2 \' W  ?# _6 \0 p; b2 x" f
    xor     ax,ax
/ Z- @: H0 P* y. }/ k* u    mov     es,ax# B/ G! a9 ~& F, C& d( W$ j
    mov     bx, cs6 S% ^! N& p* N3 B
    lea     dx, int41handler% A% c4 `- m( ^5 q6 v' {
    xchg    dx, es:[41h*4]+ Y) w; V* r, s. ^8 q9 l6 L6 K
    xchg    bx, es:[41h*4+2]  j' R3 P# R/ o& G7 S$ P2 \+ P, q
    in      al, 40h! ?' G# X( w0 ^& A6 X/ [
    xor     cx,cx3 l9 r; N) C, E4 Z
    int     41h
( W5 p! X( C( X$ a1 L6 J    xchg    dx, es:[41h*4]
. X7 g- S) d: o! c+ i( s6 x, K% v* ^    xchg    bx, es:[41h*4+2]
! t1 ~/ m; s/ \. o    cmp     cl,al
0 M: L6 s: W2 V2 k* D* v; i    jnz     SoftICE_detected/ D; k' M0 H; |/ U
9 G7 n8 Q) ~! G+ U1 b. |
_________________________________________________________________________
7 x7 }3 o# Q3 W" W( h; @! g0 J, ^3 x9 T' r) K
Method 070 Y9 D  i, Z8 x# T0 Q  G, V
=========
& j8 q. M8 {! ]/ o
( Y0 Q- |. p! Y; a# Y7 D0 _, QMethod of detection of the WinICE handler in the int68h (V86)$ m/ w: x# I- q) k
# r8 Y' U, Y9 x# G4 {( y; {
    mov     ah,43h
4 f. {+ z% g1 L9 V4 v    int     68h
: T8 d& {1 H) K1 t$ E: _& u    cmp     ax,0F386h
8 u5 [6 ?# d, c. A' O0 D( y    jz      SoftICE_Detected
2 Z* L$ Y' \& V# S9 e$ B: i. N+ ^! K8 m6 f# L
* b: S: B4 ^& K, I( p7 ?
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit; y" A; q( T* i) e
   app like this:
% \* ~* ]3 m" I# _+ {% ]% r7 m
+ [# _3 Y5 c) m6 W" X6 R3 @3 ^   BPX exec_int if ax==689 K0 p* z. ]8 A
   (function called is located at byte ptr [ebp+1Dh] and client eip is" w; o. j, R( y) L7 {1 l
   located at [ebp+48h] for 32Bit apps)7 G# m, A. V: P
__________________________________________________________________________
! M2 V5 g$ A% v  h" x  A5 i2 Q
& z8 d" t4 K: v$ ]( ^. Q4 T1 ?' @7 @  E% |; Y6 m
Method 083 Q+ _6 G4 c' s# I" F: [5 h
=========
( R* @& W0 ^7 i7 Q; P- g4 E# P5 a9 R1 R. m' w4 l+ j; l4 M- j/ t
It is not a method of detection of SoftICE but a possibility to crash the6 a5 E( z; q4 s3 _# v0 v6 d7 t1 j# m
system by intercepting int 01h and int 03h and redirecting them to another
( W& Y: J. s/ m7 c: n$ |' {3 s% Eroutine.8 d+ }+ X: _) M6 a( m
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points9 W& V( b- M7 {" ]( L  e; U. L
to the new routine to execute (hangs computer...)/ i9 z' t/ {2 i

1 ?9 Y. p- Z+ ]# w* Y5 Q& v    mov     ah, 25h
; W7 L  r: @- T0 X6 Y    mov     al, Int_Number (01h or 03h)( ?$ y1 q- k* ~2 @
    mov     dx, offset New_Int_Routine
2 j) n6 ^4 E- ~& V0 s  P/ e    int     21h
1 s5 Z# Z0 x6 D* r7 y- u$ t+ H8 _% R. C/ B! V
__________________________________________________________________________0 T6 e) ~8 g( C# s7 g. D9 u
2 S1 L1 e8 S* [  h2 @; f
Method 09
  E$ M* ]0 U+ A" |  y=========
4 `' `+ e; F( D+ Z* Z6 c9 ~& U+ o( u# g
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only( T4 c3 ?" F9 {% u5 L2 ^
performed in ring0 (VxD or a ring3 app using the VxdCall).* S8 y5 g2 s: \, q0 c+ J
The Get_DDB service is used to determine whether or not a VxD is installed: \8 b' N5 l( f- _0 C. T
for the specified device and returns a Device Description Block (in ecx) for
* l$ j) ]% H4 _that device if it is installed.
+ n0 u& k2 C  E, @! p
' n% b. }4 v/ T& N( b9 I! }6 A   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
+ [4 s6 C/ o, W3 F5 S+ Q# a   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)* W. Y! u: i! i- X9 x5 a
   VMMCall Get_DDB0 o: N+ ^3 T5 m, p$ K
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed6 m* l5 B0 M8 B3 h5 z  j
9 R$ M! P2 D. |- o9 H# k9 Y/ k( j
Note as well that you can easily detect this method with SoftICE:6 ]; z: w' J! o  \8 ]( m
   bpx Get_DDB if ax==0202 || ax==7a5fh
2 n' \% C; S7 p3 ^: C$ \
7 D3 N. Q! L7 }) i( I) V__________________________________________________________________________
# ^1 M) N1 I% I, n2 |$ E$ M& R3 ]) w& i/ E3 g% M; c7 f8 l
Method 10
& v& S- {$ }, i! j2 C1 S% ?. N=========
6 e" {. G. Y2 K% @
. B7 [) u$ s* X" J* P/ q" I( H0 L; N+ g=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with1 r9 g5 o, e9 H+ m# y4 A
  SoftICE while the option is enable!!9 E' P( ~$ l* I2 h; @. K: Y, F" K8 ]) q

3 D. T6 l: o2 s; ^; {* UThis trick is very efficient:
/ X/ v, [# b7 j! ?5 l3 ^& uby checking the Debug Registers, you can detect if SoftICE is loaded2 w6 P- Y* N0 y! ~1 m. g3 g
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if3 m" J0 I/ I- @7 c
there are some memory breakpoints set (dr0 to dr3) simply by reading their
: |& O4 s! w* w* z1 m& uvalue (in ring0 only). Values can be manipulated and or changed as well
; \3 E9 k  }/ M4 I: H(clearing BPMs for instance)
5 s; n7 M1 E- U# \
! A5 g0 _" Q, ^( j# F# M__________________________________________________________________________8 b# }+ F/ a. U. D, s
, }0 u" R) T) R1 ]
Method 11% W0 i/ e+ [' j1 }% \7 l) Y, f1 C
=========# z; V; L3 q0 b; E, z! y. h
* M5 z9 Z, H; Q; B, O8 ]
This method is most known as 'MeltICE' because it has been freely distributed
6 k2 c5 z7 q4 f; P9 Ivia www.winfiles.com. However it was first used by NuMega people to allow$ X: @2 [& t/ k' h' H
Symbol Loader to check if SoftICE was active or not (the code is located
" }9 F4 v$ c. }inside nmtrans.dll).
+ t9 g! F# y: i; I
7 x9 o0 u6 J, X- X' B1 A0 YThe way it works is very simple:$ E! f* j! _, n- Z* ]
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for# r6 H3 S- I6 v! _$ K
WinNT) with the CreateFileA API.3 D0 D# H1 p$ B

* }' W5 a! F3 K6 I+ i" BHere is a sample (checking for 'SICE'):
. B6 u6 Z) F' p, V+ z) m' e, r. C$ V& X5 G
BOOL IsSoftIce95Loaded()
* t. y9 v2 `0 \( @$ a$ G! M5 v{
- d  \- `/ S/ g7 @6 j, @   HANDLE hFile;  2 B% M- S$ d8 X3 k4 w
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,; O1 J. X8 e3 D- Z
                      FILE_SHARE_READ | FILE_SHARE_WRITE,6 h, i. d. K& k( E7 T. Q6 v
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);1 `. ?5 K- E2 W& }% @
   if( hFile != INVALID_HANDLE_VALUE )# C/ ?8 O* [- R  L$ Y
   {2 `  z( l! r0 q5 b  ^. ^% E+ I
      CloseHandle(hFile);: D% X/ v, N9 h+ X
      return TRUE;
% W& l; U0 V/ o/ k; A8 m3 v8 o   }! U7 N$ V5 B& n$ z
   return FALSE;5 G5 q+ k# |( N$ I
}1 P1 |7 P) O- r9 \. c5 ~

0 F3 E- g& i2 q4 LAlthough this trick calls the CreateFileA function, don't even expect to be
; H) ~# i( \# k  N4 y8 \) Q! I2 kable to intercept it by installing a IFS hook: it will not work, no way!( o! d5 l2 I  ^
In fact, after the call to CreateFileA it will get through VWIN32 0x001F
9 ^- G1 q5 o% pservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
! l" p$ {: |( r4 d6 Pand then browse the DDB list until it find the VxD and its DDB_Control_Proc
. M6 T9 `& r1 w4 s5 P6 }field.7 D2 b( K  z; C" i
In fact, its purpose is not to load/unload VxDs but only to send a 7 r( X' e( }1 C) v" T* S3 t, i
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
+ r& D+ K. v, v( Cto the VxD Control_Dispatch proc (how the hell a shareware soft could try+ a9 M! W3 ~+ q
to load/unload a non-dynamically loadable driver such as SoftICE ;-).8 B' Q7 ?$ j0 ~) F4 {
If the VxD is loaded, it will always clear eax and the Carry flag to allow
2 t+ s, D) I# M+ }( W. t6 O. e# Lits handle to be opened and then, will be detected.2 B4 _& x$ p$ J6 \- L" u4 x, L
You can check that simply by hooking Winice.exe control proc entry point) y3 \* p& d- K% F% I3 X* M; F# B" T
while running MeltICE.! T& @# e- b2 V9 M% V6 K

- x- I! h$ ?' i; G
/ a8 T! k" m+ J' A7 y+ R  00401067:  push      00402025    ; \\.\SICE
$ h1 r1 g& i" Y" B  O7 \' R2 M  0040106C:  call      CreateFileA) n5 }8 o- s5 Z; ]4 W- }1 q
  00401071:  cmp       eax,-0019 T% |* T) Z- Y3 l. _9 n, ]
  00401074:  je        00401091
  K+ P+ ]' F4 ^/ c, b# X. `8 K' W) d- ~/ d0 X* c

0 k7 Z4 }; d$ C* o# zThere could be hundreds of BPX you could use to detect this trick., r! V5 J3 ~. y* J8 Z8 ?
-The most classical one is:
$ [4 S: y  ~3 ~# i) k/ s3 g  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||- |3 s# J6 Q0 z
    *(esp-&gt;4+4)=='NTIC'4 C; j3 S; A* v0 W; F3 F$ i: ?
* T& }# D; O% i0 ]' D9 b6 T
-The most exotic ones (could be very slooooow :-(4 F/ T9 r  W/ q8 h. W
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  . Z2 ~) t7 t3 M1 z
     ;will break 3 times :-(1 J6 Q: A9 m0 z: Z! E

, F$ X/ F  H$ f5 K) m% W5 k-or (a bit) faster: 0 Q- M7 p5 x) L% Z! X& s  L
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')2 B" A& n+ W4 T7 q* ?, e

. b  S6 G! \2 v) i   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  9 C9 i7 @  s  m% c2 S  g
     ;will break 3 times :-(8 l9 l4 X1 b: ~
: O' g; {% g. u( {
-Much faster:
2 ~6 h4 U% m1 G  L   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
7 N, W& d: Y: L- i  I
1 l7 s- w4 b& y. tNote also that some programs (like AZPR3.00) use de old 16-bit _lopen; E* z2 C% S" p$ ^
function to do the same job:
& E: p$ }/ C7 S4 F* o5 W) v! t) B7 l& V1 M, X
   push    00                        ; OF_READ( s. o4 y  U& j
   mov     eax,[00656634]            ; '\\.\SICE',0
. u( H8 w7 m  g9 L4 n3 i   push    eax
6 K9 Y! E5 B2 `5 g# c- B   call    KERNEL32!_lopen
6 Z* M) i3 d! x8 l1 O   inc     eax- k4 G' _5 V+ T: ^) p2 i" k# M
   jnz     00650589                  ; detected
+ `7 b) h; k. }% e* }6 T3 E9 Y   push    00                        ; OF_READ2 |; L, a7 r+ g' K& p3 ~0 \- e
   mov     eax,[00656638]            ; '\\.\SICE'
2 G; ?; n" `" \* W# g; l. Z& V3 V   push    eax! G. W: x$ E& ^8 g" X; F
   call    KERNEL32!_lopen  D2 g9 u+ |1 N- q& J
   inc     eax' I5 L$ U' I! I0 \- u) l) f
   jz      006505ae                  ; not detected
  G$ N2 k# Q, B2 N  |% |& h) b9 c5 d
: D) `& H" b8 ~
__________________________________________________________________________* \- e& ~0 K5 K' r" ^3 L

) h5 h# V: b8 }$ n0 v, T8 o/ V; ^Method 12. N( ^" R  [, ~/ L( ?& {2 p
=========* K. K8 x% F  v8 T
  @: K7 f, a' F2 w( m9 h, ~
This trick is similar to int41h/4fh Debugger installation check (code 05  t" b+ U( I* Y. Q9 M2 p
&amp; 06) but very limited because it's only available for Win95/98 (not NT)8 z9 b$ X0 P. |
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.& a% V# g* e9 ~( G
% c5 X- h( K/ C& G4 f# ]/ j; H  C
   push  0000004fh         ; function 4fh
3 ~1 U0 g- ~& M4 u% ~: c6 g" m   push  002a002ah         ; high word specifies which VxD (VWIN32)
6 l/ c0 H$ b3 g* Q5 y" ?: Y                           ; low word specifies which service6 Z- e1 ^. |" S
                             (VWIN32_Int41Dispatch)
' M; d' m* x3 p: [   call  Kernel32!ORD_001  ; VxdCall
3 a2 n* b; e7 u4 N   cmp   ax, 0f386h        ; magic number returned by system debuggers& U5 f( a0 @) J* K, W% Q9 _
   jz    SoftICE_detected
- I; {7 \5 V* z; |8 Y& X! R& u
5 G3 V1 O' \: m0 V0 fHere again, several ways to detect it:
- M* @1 ]6 ~' S, s# y. ^
& L" c2 Y; [1 P% q    BPINT 41 if ax==4f: Q" \* Z( O; O) s0 R! Q

1 Z/ C8 W+ Z, G    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one7 k+ I# o$ w/ T4 d2 X5 x

1 s' f* p* O- a( m6 n    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
! r4 I8 P+ A' P8 o0 Y6 U* ~, w' [8 V: X
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!2 `) D4 V" `7 d, I2 u5 N0 ^
0 m! [6 N! r, f  H, K; U7 }" j' q
__________________________________________________________________________5 v# |5 g0 c6 m9 l, _
. T) }8 S$ m; D  z9 G' H& p
Method 13
: F7 {; n* W+ V- B3 t6 C=========
8 [& H( L. O8 b  ~& _8 K% @9 ?$ k0 H, ^+ H3 K, x, Q
Not a real method of detection, but a good way to know if SoftICE is. U  t; M9 \7 y0 z0 S
installed on a computer and to locate its installation directory.
9 a/ ]) d! T! s" z) C! ~0 P- _It is used by few softs which access the following registry keys (usually #2) :7 f1 O0 d7 z5 ]

# M  f9 O  V" Q% G-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion) F; n7 `/ B4 l2 C2 f, [, \
\Uninstall\SoftICE' g5 G/ k+ h0 s+ f% W! \& J. H! ^8 E
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE; ]* ?) v, M, x% ~' F1 ?0 p& `- v& G! s
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
4 S4 t9 E2 a1 j" r$ V: u\App Paths\Loader32.Exe5 t" R& S3 L; ^' C' v# g4 C* h2 d- i$ B

9 [. Q" k+ r* V+ q' E; k& l) [, T1 r) f" ~5 n7 _0 o8 e5 ]8 ~
Note that some nasty apps could then erase all files from SoftICE directory
$ R9 x$ @- k* @7 C; ~(I faced that once :-(
, _0 P/ r% c9 O+ {0 G* d, k9 ?9 R4 f8 }% b
Useful breakpoint to detect it:
- ~7 O* @0 ^  t( K* z% k, q9 Y: B9 a4 {
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
4 d; g  A4 O9 @$ a* ~! c" G
0 S) V* o8 g6 c% x% K__________________________________________________________________________+ g) d2 h  M9 v3 l
7 b; k, |8 \5 F- g4 F! l, T
1 l( B# ^, M: K9 t
Method 14
! X  O( {$ `. g( r6 J. Z! P=========* n2 D4 V% p3 P6 T

# }! I+ P* S2 ~5 M0 [' @A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose, g% @1 @# ?/ p  [
is to determines whether a debugger is running on your system (ring0 only).# {4 X8 a+ v, h# m2 @7 a9 X

; k9 W" b" \2 o! g6 S. g: Q- p   VMMCall Test_Debug_Installed
! W& c" E) q0 E2 ^   je      not_installed
: @7 D5 K$ y* ?1 i
( s, m2 t6 p) {8 EThis service just checks a flag.
  Y8 F; ~# G" J, O% n0 F</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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