About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>7 A" Q( x- }. |" B2 B) M* @9 B5 L
<TBODY>
# u7 K6 y4 P; `& D* [5 }<TR>( `! t  K; H8 A- j8 R
<TD><PRE>Method 01 3 r" O" M" l2 P! `0 y* m
=========
! W$ v9 B. I' S
) u9 j, ~) X( L0 v% {This method of detection of SoftICE (as well as the following one) is0 v0 k, Q7 e8 [' a$ b8 P& }' ^
used by the majority of packers/encryptors found on Internet.
3 J  Z" f# [  S( G$ ^It seeks the signature of BoundsChecker in SoftICE
2 Z8 t9 |  D% w
2 S3 x  u6 q" m; I, V2 a    mov     ebp, 04243484Bh        ; 'BCHK'
" Z( |) Q7 N; ^# Q    mov     ax, 04h1 ~7 l# s( T* c0 |4 W; r3 r5 U
    int     3       # ^+ ?0 p  Q" x
    cmp     al,4  a3 d$ s) K2 i3 }
    jnz     SoftICE_Detected
6 H- x* D( h, M3 P, `; x* j2 M+ H- j9 Z5 ^5 {; L
___________________________________________________________________________
7 r4 `9 e& T4 y. ?3 Y/ I, E& |% c: J3 |" o1 v( ]: t
Method 02& S; G9 u" Y6 i
=========
- j, [; ^7 j) [( w( r* }9 q2 {
0 q$ G) Q- _$ G5 aStill a method very much used (perhaps the most frequent one).  It is used
. O8 V/ j0 N8 B& D  l  `0 t8 u0 Wto get SoftICE 'Back Door commands' which gives infos on Breakpoints,3 _# t- j7 b# x) }3 B6 T
or execute SoftICE commands.../ X# A# C3 E8 n; ^+ u! [. l
It is also used to crash SoftICE and to force it to execute any commands
: {. B, B3 w! l# K" x( G( g! ](HBOOT...) :-((  # E; M  R* S- t( T
5 Z+ r; U! ^2 Y: a& q! p6 k3 M$ \
Here is a quick description:  i  i* ]+ K9 T
-AX = 0910h   (Display string in SIce windows)
% O0 \4 ~5 H9 G-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
! F, F( {8 C0 L5 l9 S. e( p, E-AX = 0912h   (Get breakpoint infos)
# P5 I+ X3 A1 @' V-AX = 0913h   (Set Sice breakpoints)
/ P5 n; Q2 e" c' v( ~-AX = 0914h   (Remove SIce breakoints)
+ G  }, _/ F* L9 S" A1 f3 H  b3 V: B" C; `4 i4 @
Each time you'll meet this trick, you'll see:  V8 \" m- t4 H+ d
-SI = 4647h% o0 {6 |% A. ?1 ~' ~2 r( ~# x
-DI = 4A4Dh% K6 N6 f  L" i  D) X
Which are the 'magic values' used by SoftIce.' {' j) @/ p* G7 B5 G8 _
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.6 U# Z3 I4 |0 C9 q) R* y2 K

# u# u5 B7 e0 a$ |3 ]Here is one example from the file "Haspinst.exe" which is the dongle HASP
& t3 R4 r: R# Z$ c4 IEnvelope utility use to protect DOS applications:# g" S. B7 m' ^, Q. r! S3 J# a
2 _. Y& M8 g9 {# K9 j
6 H  [; g, d8 _) U+ W$ K
4C19:0095   MOV    AX,0911  ; execute command.5 d. z  Z3 n) L4 _0 q
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
! ?' ?1 |$ @: B8 d6 P" N: f- q: l4C19:009A   MOV    SI,4647  ; 1st magic value.
3 Q( h' `4 i  f* ?1 w3 F4C19:009D   MOV    DI,4A4D  ; 2nd magic value.. ]# C% m" j! p' C8 s1 X1 n& _
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)2 T8 A# L. a  J' }0 Q% K' N! G
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
# @' _. e5 \& A7 l7 j- O4C19:00A4   INC    CX  ?2 q! U# \- D* W) h
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
' Z1 x3 }( }  S- F4C19:00A8   JB     0095     ; 6 different commands.
1 T5 v, l# R4 B8 r, S0 b, M7 G4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
  @! \. E3 A2 }4 B, z* \4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
: A8 J( g1 Q0 L& B4 i7 J) k5 g' I
The program will execute 6 different SIce commands located at ds:dx, which
2 m! W- E3 l% |8 h0 K$ ware: LDT, IDT, GDT, TSS, RS, and ...HBOOT.& y- J0 S$ C0 v

. j; O6 x- w# h- p% d* F/ n$ t( G* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
% Q, \8 [; T7 {/ p) n___________________________________________________________________________8 j& a1 l3 e* R. i: S" v" c. h

# J* h$ Z3 T3 o1 p8 V7 C+ r* {6 K& q$ `6 \
Method 03
6 \, W/ X& T- i8 {. L+ x=========
- t) w% F) n! n: C* X' a8 `- U0 \! @% A! R2 D
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h# v2 r' n% i9 h7 H! _+ [' {# f1 [
(API Get entry point): t: r+ X2 {- u2 i
        ( H6 s9 z$ D6 m' z' }; M6 ^
. m! g# V! f* ?+ X1 u5 s
    xor     di,di
0 P0 \- K' i9 b( J    mov     es,di
# C1 x$ e, O& ?+ z3 v7 C    mov     ax, 1684h      
+ T7 |# i. q) P/ B& I    mov     bx, 0202h       ; VxD ID of winice% s. p" z: ]5 O9 y; q+ S
    int     2Fh
* ~7 _* ]' X* K- e$ A" ^3 E7 w    mov     ax, es          ; ES:DI -&gt; VxD API entry point$ X9 [6 s6 X, G2 o
    add     ax, di% ~" A# B4 q1 U+ B% H
    test    ax,ax+ u( B1 o3 _! H. i
    jnz     SoftICE_Detected
% u; _% s) J4 c: ?( T- ]& a; x- J: Q$ E; H, R8 Q$ l# {
___________________________________________________________________________, H1 ^1 `0 a$ V  A

1 W) [# s; G2 {9 [- d0 K; pMethod 04* m4 d1 Q. s; g: b9 O* F
=========
0 d7 V; ^* y2 }( y" D9 e' m
' o+ ^; e2 {: f: ]1 [" k9 n7 mMethod identical to the preceding one except that it seeks the ID of SoftICE. V- f, j/ ^4 R! x  f
GFX VxD.- `& `8 H, _5 L+ E. U+ d% `1 ?
: N+ ^8 W0 t* f, o' H2 U; R
    xor     di,di
/ h& L6 }6 E, k- \5 T    mov     es,di
1 S( i0 A4 ^/ f# d7 h    mov     ax, 1684h       3 y- X7 @$ w* F$ z& k0 G2 M/ Z: w
    mov     bx, 7a5Fh       ; VxD ID of SIWVID8 c/ b; r, ~/ F" i/ W1 }& u
    int     2fh, E( O. I" @+ j3 k- w' U
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
- `/ N! G2 x2 ~! w& z. ?) }    add     ax, di
1 G6 K5 b/ F) m    test    ax,ax- o% A( [3 n' k5 |
    jnz     SoftICE_Detected8 J' h) Y( w) i0 `! H
  o. L( q  T- a  J, K, a1 r1 B
__________________________________________________________________________
+ A5 o# ?  @' y! ~  m$ s+ B
( g5 X  ?0 Y3 h& B7 n
7 R0 [& x' i: k6 UMethod 050 o5 C3 i( k9 O2 K; g6 p/ o4 Z
=========
" u, d$ J4 v* C0 \$ {  `: b
7 Z& {$ g  ?0 x& O! uMethod seeking the 'magic number' 0F386h returned (in ax) by all system( w6 _+ O( i9 y" G# a& F# s
debugger. It calls the int 41h, function 4Fh.
& {, K( ~3 `# o- U3 P$ \8 vThere are several alternatives.  
3 h- p- S$ J- l/ c% p$ m  r* r
* |2 }8 z+ g; u0 D0 h/ E6 J& G! pThe following one is the simplest:
% Y0 R. ]$ W  s  y+ f  r. p. h$ U( H0 U/ z/ ^- f: l* N" z
    mov     ax,4fh
* U7 m+ I4 V; C* j    int     41h
- [! i( V$ v' k& w3 d8 O    cmp     ax, 0F386
# A/ |& K0 l) T2 K/ E! T$ A# F    jz      SoftICE_detected
$ @4 _4 s& B" d+ ]3 |% r* O$ W* l. M: l$ B2 ^/ K: K
! y7 h0 u" a* ]0 b
Next method as well as the following one are 2 examples from Stone's 1 c& A! W; a) N: f5 Y2 I& p
"stn-wid.zip" (www.cracking.net):4 B$ |" [4 m: S. {) h8 e4 v. E

* s9 T0 h* H% _: T    mov     bx, cs+ m# r3 [0 d; |  N5 {* K
    lea     dx, int41handler2$ c2 t; G0 I, L/ g7 g
    xchg    dx, es:[41h*4]8 ]: z7 \; O( P0 ?/ t
    xchg    bx, es:[41h*4+2]+ X% U4 ]; }' i1 T: U
    mov     ax,4fh. Y% ?# H- l" S$ J" f
    int     41h4 Z, m7 K3 ^. H1 X+ G& V9 k
    xchg    dx, es:[41h*4]: I9 x$ ^  X* @- [. R7 `
    xchg    bx, es:[41h*4+2]
$ b6 t% x: B7 S    cmp     ax, 0f386h
% a# S4 x6 z/ ~3 `# q    jz      SoftICE_detected
; R* m$ B4 O. [) n' ~
2 Q! s/ Y6 {' e3 Iint41handler2 PROC3 a/ y5 @4 k8 h
    iret
7 _" j; J; F, t9 aint41handler2 ENDP
* q; ?4 i8 {3 }# w4 C  H  I5 U, k7 d- ^; f% b, r. [, s% O7 _

9 S3 v% k# i0 V* s; n0 i* |4 G7 Q( W_________________________________________________________________________
9 A- V$ W) T. ^" _9 x/ U/ E0 z/ P
' p! y& V( X& {& l7 e( `5 J/ n4 r
" q4 h7 b  }1 Z- BMethod 061 G$ \$ o" ?; _  b
=========
" Z  t- {- r0 D0 L
8 _! D7 R( J5 v2 ?: i2 E- Q$ I1 m3 P8 N: u/ k& l# [- G& P- G- E2 ^. V: _* `  d
2nd method similar to the preceding one but more difficult to detect:3 }) l2 q  Y# a0 s& V+ J0 k
+ e: D* B. X8 q! c

. j5 E- }! k% p- f( }( Wint41handler PROC: U- T# a' u/ n, ^: b" j: h4 n1 i
    mov     cl,al
0 f9 [' k/ @  l3 B; ?    iret, u# o# S) M& W& T
int41handler ENDP) Z8 l# D9 S& Z# m5 ^8 J

; K7 @! c% [$ F8 o  p1 V
% K: v4 S% [9 n% g& [  Z# m; c    xor     ax,ax3 U% j9 U  W2 q4 ~
    mov     es,ax/ u7 M6 }) k/ w& v1 h$ r$ g% w
    mov     bx, cs
; E# p9 m8 P& }2 w8 z: P    lea     dx, int41handler
% |' [4 e/ Z2 p: n    xchg    dx, es:[41h*4]1 d3 r8 ]! \" S6 |, F, l* Q3 x: @: ^
    xchg    bx, es:[41h*4+2]
* X6 j, B' S9 E+ \) e    in      al, 40h) V* m; N( S" N' B" P
    xor     cx,cx
4 a5 S' v3 F& D6 W    int     41h
! q) E4 }! R; |. B4 T( ?5 y    xchg    dx, es:[41h*4]
4 {/ H$ @$ ~- B6 @! o! [* `7 ]1 ]    xchg    bx, es:[41h*4+2]  u- {0 u3 J2 J: @
    cmp     cl,al4 _" ?7 C5 P$ A
    jnz     SoftICE_detected$ N  L. D6 B! P( \" m

) e' w6 X( x. A1 V_________________________________________________________________________
' u6 c9 S" \9 B) C5 S& u
8 R/ X/ v' ]( d# D. {! tMethod 07
# }, Q9 f0 R1 B- O4 A0 ]. a# n=========
1 K5 ]% F. y3 V3 B, A- H( Z. `" U- X5 D0 q  x
Method of detection of the WinICE handler in the int68h (V86)7 ~  w- h2 z: K6 H

9 i7 Y  A9 B. q2 u& j# X2 I    mov     ah,43h+ J, _6 o! G6 x9 y- }
    int     68h
/ b+ @$ f. c- V% Q2 t& i% y( d    cmp     ax,0F386h
- ~% [& ]& ^- S1 |+ K& a    jz      SoftICE_Detected' P& c" x( S# Z3 o2 {- q
6 D, d8 j! y0 X
, ]+ L! I3 U6 q/ k- m& Z
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
4 b" B& s6 V$ t/ p5 N, L4 C9 S   app like this:
* I( A' O0 p! _& p0 X: A2 M& ]
6 A0 B' I: r1 F# e- t3 B   BPX exec_int if ax==68* G) g1 N# D1 j* Z
   (function called is located at byte ptr [ebp+1Dh] and client eip is  m9 j5 d5 ~3 Y4 ~( P. {* l
   located at [ebp+48h] for 32Bit apps), E5 ~$ W0 @8 B' ^6 p' p
__________________________________________________________________________5 l* S1 d" u/ \% c( r! u
- U2 @9 E8 U( X- ^$ M: l) Z" J  y) N

8 R# i' r" \1 {, vMethod 087 C# L  {7 g6 q( \$ J+ K
=========( t- W7 K$ o0 J
; u) L" O( }* J; c( a# ~. A' v
It is not a method of detection of SoftICE but a possibility to crash the; |7 q7 o$ J" z$ @
system by intercepting int 01h and int 03h and redirecting them to another7 Z, y- n5 v" Z; W# E' {4 @- S
routine.
& D7 @, x2 l4 S2 Q4 CIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points; k" d6 e+ S0 K2 j# w. T- w
to the new routine to execute (hangs computer...)- V4 X" D  ^  s7 D  E

# q+ n0 c. g5 o2 z+ I    mov     ah, 25h
1 X9 g# a0 {( E    mov     al, Int_Number (01h or 03h)
+ g7 m6 p9 I( W% K2 P; J; h, n" S    mov     dx, offset New_Int_Routine) V9 C$ Y$ @5 S! X! ^
    int     21h
( R2 C8 L; l! `$ ~1 F/ B/ w5 ]  l$ I- _, K# y2 J# Q5 t
__________________________________________________________________________( U& t, k8 }$ G0 j/ p

! R2 E; C! ]% p% cMethod 09
  N& r7 v0 `4 K8 f=========
& x0 }/ V. y' Z% H8 V0 j$ {7 T' D. }3 ^& ^3 S3 v( Z, S
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only5 U$ ?% Q( A4 p' Q& k4 D
performed in ring0 (VxD or a ring3 app using the VxdCall).
$ [: j3 k7 e/ O9 I7 BThe Get_DDB service is used to determine whether or not a VxD is installed. K5 `3 T4 L  X, ~) u; P
for the specified device and returns a Device Description Block (in ecx) for6 u' ~5 c5 n- T" Q+ r8 x2 n& g# Q# A
that device if it is installed.
0 y2 O) p& A# Q( B7 Y( J
- q. q2 Z- I5 S/ s- K: F   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
8 r" P. ?; @: B& H5 h, X9 n   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
8 \# |, g+ Y  ?2 z# k/ G% {   VMMCall Get_DDB' K2 `' i" n# T; y1 U1 h/ b' f
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
0 p/ A0 [" t$ n5 l0 |) G% q7 R2 z; D
$ T1 z8 C7 P1 r; m, N* Q9 [Note as well that you can easily detect this method with SoftICE:
8 `+ s* |: A: h7 Z* L   bpx Get_DDB if ax==0202 || ax==7a5fh7 Q6 ~% k0 m; |, N! {" Z
- s1 C2 ]" N1 a8 _4 z
__________________________________________________________________________
6 s/ [! z* m$ U5 v6 u5 M7 @. e3 V  w" o
Method 10
7 e5 V1 V3 i! b=========8 g/ T" J* [5 W; l

4 y! G& `' T* E( X5 W=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with; w& B; I0 @- B! g1 \! b) |! w2 e2 ?
  SoftICE while the option is enable!!
1 c. g' n0 K& n0 ?$ P4 g6 f$ Q( V
9 N) Z0 d  `+ |" q; fThis trick is very efficient:  ^4 N* g7 W" T& u# R4 w
by checking the Debug Registers, you can detect if SoftICE is loaded( o9 G9 }& ]. f) a
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
( {' n4 N+ w6 B. Nthere are some memory breakpoints set (dr0 to dr3) simply by reading their8 M. r- Q) ~0 x
value (in ring0 only). Values can be manipulated and or changed as well- J* R6 o% j/ u" X4 w7 T# i, u
(clearing BPMs for instance)
5 ?9 E. P; c1 w# o* S& @1 ^4 b# d+ b# e$ W2 d2 n: f  N
__________________________________________________________________________9 R. _' D& w  m" u' v  A
( b4 K3 b! {" f) b5 ~4 B
Method 11+ J9 x- U" @/ @# M
=========
/ B8 a! s/ U; U+ l. n3 Q
  v5 i' N! W1 Z$ G' u* }# B7 h8 CThis method is most known as 'MeltICE' because it has been freely distributed/ Z! ]9 l- K9 Y3 u( }
via www.winfiles.com. However it was first used by NuMega people to allow
2 |9 B! ?% S; c2 CSymbol Loader to check if SoftICE was active or not (the code is located1 E$ b) b7 u/ h- {6 V. N# o1 F
inside nmtrans.dll).
3 h4 _1 G$ O' c5 z+ `7 [
+ Q. M2 v" B7 x2 `: K0 L% lThe way it works is very simple:" u) u- |& ~/ w9 X. M( X
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for2 m1 h9 l9 r& t# }
WinNT) with the CreateFileA API.
& O3 }0 w4 z! u6 b; m! q5 ~: i
% _$ @& W8 E* wHere is a sample (checking for 'SICE'):- @" l: H. y: W$ r0 }' d9 H
& W- M) q+ ^# C4 L
BOOL IsSoftIce95Loaded()
; W7 S/ I1 Q! A8 b1 w$ \/ b" a1 L{! n: a4 b$ r  ]0 R
   HANDLE hFile;  : O8 x& k  M9 E
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,$ H8 e3 r2 y/ h3 U8 [
                      FILE_SHARE_READ | FILE_SHARE_WRITE,
' T) U& v- `4 m0 S                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
& |4 w, ~2 ?0 M: h   if( hFile != INVALID_HANDLE_VALUE )
% P( L2 c+ E/ C$ W   {; x+ I5 N7 c1 q; n% e; Z' I) h
      CloseHandle(hFile);
' p  l- h+ t( _( |- ]      return TRUE;+ x: w7 `, O* }( x" s. F
   }
. W2 W; d$ U: j- v" S4 y   return FALSE;& z( Y" ~% v8 |' k6 u0 {. Y. }4 R; v
}
( l  {1 K4 f* o8 \8 C6 I2 W
  T8 c* n, f* ?: M1 nAlthough this trick calls the CreateFileA function, don't even expect to be
0 ^0 ]0 q& ]" p  |% sable to intercept it by installing a IFS hook: it will not work, no way!2 n, L2 ^! p) r3 X) f; r8 H( |, i9 y, S
In fact, after the call to CreateFileA it will get through VWIN32 0x001F
, s3 j- H0 _, H) B( e- uservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
0 Y# r5 V! Y( sand then browse the DDB list until it find the VxD and its DDB_Control_Proc
2 p1 O+ O. _; K' V% @, ]3 T1 Kfield.2 Y2 Q" D( P/ H& M
In fact, its purpose is not to load/unload VxDs but only to send a
7 i7 [! T( [: X# W8 OW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)  J- l7 S: J$ k( ]% Q
to the VxD Control_Dispatch proc (how the hell a shareware soft could try* o/ R: [, A# U( S# ~
to load/unload a non-dynamically loadable driver such as SoftICE ;-).
$ m5 X6 T2 L( B+ ^/ |4 AIf the VxD is loaded, it will always clear eax and the Carry flag to allow
4 b* F  j" {9 @9 J1 Y7 {( Eits handle to be opened and then, will be detected.+ V5 n7 @" h+ g! M, l
You can check that simply by hooking Winice.exe control proc entry point, b0 L: z4 A4 ^1 ]8 |
while running MeltICE.
& g  c/ J7 H3 f  L- z, P( i, Q7 u  z* X2 d' L

5 O+ J) |' O' e  00401067:  push      00402025    ; \\.\SICE6 q" h. S: m( X; @
  0040106C:  call      CreateFileA* ^7 _% X4 f1 \2 |3 N' f4 [' {# B3 s7 q
  00401071:  cmp       eax,-001
# [! i, U- X3 p6 }2 K  00401074:  je        004010913 H9 }5 j" V) Y: L; G. @$ \

+ y9 z' X& n: y4 V# W8 j
: g& s" {" k3 Z' w/ IThere could be hundreds of BPX you could use to detect this trick.% W4 h# r+ Z- P% x) t1 [3 j( u& G
-The most classical one is:
& I# N; j: j# i, x" q; @  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
; T& L6 T/ G0 |4 [5 W    *(esp-&gt;4+4)=='NTIC'0 Z. {! b; m' V* V
0 S9 U9 y- L; t5 r& B
-The most exotic ones (could be very slooooow :-(
* P  g5 g) y: Q8 @- @% h   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  % v; d1 W! H- m4 r# ~  S
     ;will break 3 times :-(
3 G' C2 _1 B" U( P7 l
2 N4 J2 d0 S' A0 e4 y7 W-or (a bit) faster: ! ^% M, W' H" D7 x3 b4 S
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')" D0 ^& w! O) F9 o. m4 C0 c  c

4 \; m8 ^5 r) Q, |# e, H' ]6 L   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  * I$ k! l) ?6 Q8 _
     ;will break 3 times :-(
/ }7 k- h- U8 l* M% j
, G1 E! S* k+ T4 \2 O  Q0 a5 u" w-Much faster:
  P) j  T0 z5 f   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
5 S; p! d3 X7 X2 \! j0 D) ]* A( v
' a) X8 W$ ^, ?# T% S- qNote also that some programs (like AZPR3.00) use de old 16-bit _lopen4 W  F* [$ ?& `/ ~! f" P. L
function to do the same job:* W- H6 h9 A1 ]# y6 T4 P

7 I( a5 [1 l2 I- F0 a5 q   push    00                        ; OF_READ
8 ~3 i: |$ L; M. P# d   mov     eax,[00656634]            ; '\\.\SICE',0
. e2 m; z2 W9 ?5 j3 _. a. `! S5 d   push    eax# o3 z9 c' Z6 U& R; G$ i" x; L
   call    KERNEL32!_lopen
5 ]/ r. {0 v0 m6 @# d   inc     eax
# ?) i+ B2 y: @+ z   jnz     00650589                  ; detected
0 w( w- O: A5 Z. s# D   push    00                        ; OF_READ
9 R$ Z0 {4 t. R0 `) ~   mov     eax,[00656638]            ; '\\.\SICE'% s; Z+ s" h" ~# `: n1 q
   push    eax4 A/ w: m4 Z) G" @7 g) x# t$ ^
   call    KERNEL32!_lopen# u0 ?# i9 L5 D1 k. T, p6 w4 O( f- w- W
   inc     eax
- y) U7 Z0 \/ ?; B; Q$ \5 n, y   jz      006505ae                  ; not detected
6 F( l' a$ g3 ~! O& C* W7 l6 h# d9 d  E' X! U& i

# R3 [& a4 C% Y* }2 u, ^- V__________________________________________________________________________+ |0 ], H6 J/ ?# I* k" W
& a6 }1 x! P2 ~% T  O9 f7 i5 h6 v
Method 12
; U, v- C9 u, [. r=========3 B. e" g& S% C3 ^( J* Z& Y
& Y! b, f* o9 l
This trick is similar to int41h/4fh Debugger installation check (code 055 r7 X& r4 c4 E
&amp; 06) but very limited because it's only available for Win95/98 (not NT)
5 J2 S, [' Y' c2 z/ B+ q$ Y/ was it uses the VxDCall backdoor. This detection was found in Bleem Demo.* ]4 |  ~5 x6 m; L' R+ S# \5 T
0 V* w3 i- H6 F9 B$ m  Q6 {: X
   push  0000004fh         ; function 4fh8 x* s& b6 E: F9 m
   push  002a002ah         ; high word specifies which VxD (VWIN32)
$ O* q1 [* H- ^) |, Q0 l7 _                           ; low word specifies which service  u+ O, `3 i5 F) m
                             (VWIN32_Int41Dispatch)4 t# G3 i/ h9 I
   call  Kernel32!ORD_001  ; VxdCall
! y' ~/ _$ Y  v2 I6 e  v   cmp   ax, 0f386h        ; magic number returned by system debuggers, V1 K9 C! P) ?/ w
   jz    SoftICE_detected
6 T9 ^8 w7 d" [' Q2 L) q$ {8 V; ?, {8 U8 i( B
Here again, several ways to detect it:* }/ c& z: b  D5 n/ a3 C- c

/ E  I2 \5 J# ~- l1 r9 a  W5 F0 n    BPINT 41 if ax==4f
! k: c2 w9 l1 D2 m; Q" Z% U% j0 O
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
4 w* E3 ]6 u+ i1 M9 u+ g2 c, j2 l
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
% S! U% L9 Y: f, b3 _4 E" X( K- C3 T: \& c( Z
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
2 t/ L3 l& Y9 l" a! a$ {% B2 `( V5 V
__________________________________________________________________________
) r5 c6 W' v# q) d1 ^" D9 ^, f" O) w2 E% p4 N/ @/ q+ ?
Method 13
. N9 Z' |: [" Z' P/ ^=========& e+ ]. S; E4 @$ n6 t, O
' n2 V$ P% V% x) W0 ~
Not a real method of detection, but a good way to know if SoftICE is
& _6 J# e$ s3 d: j+ j& Jinstalled on a computer and to locate its installation directory.
6 s1 c$ D1 Y; h; g$ D- Q/ J0 u8 \It is used by few softs which access the following registry keys (usually #2) :; }9 K4 B* T0 \: Q

: y( y. i3 m! t5 ]. h/ a-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion4 q  O# Z  f- R9 M
\Uninstall\SoftICE
" A* [8 F8 J# R( {1 ?) T-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE) \, ^  D: s% H9 ?
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
) Q% X  @% f; X7 ~\App Paths\Loader32.Exe4 o) |; A+ k5 _  M/ }/ a6 ~
' S9 Y" d0 `- p' G
. Z* ^- `3 b: h( g1 K* K
Note that some nasty apps could then erase all files from SoftICE directory/ J3 K2 D& v) T# S8 J3 \8 t7 o
(I faced that once :-(
/ Y2 |9 P) F) Y3 m
! S2 k* [2 b+ s& [( l  JUseful breakpoint to detect it:7 Q  y4 p& e$ V9 Y" d

# A3 [  \3 P) e! w     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'+ r# ^5 C3 h; V6 }! T, H
! V; B0 {. A8 J- t5 j: l
__________________________________________________________________________
& U6 T9 Q3 F& A9 ?& X( `
: |2 j2 I  E# k: N9 Z& K  J! d3 I% R* X: ^
Method 14
9 S$ _% z8 n+ Z$ P2 l2 e' G=========$ w1 M. Y: h( ^3 B' W; H3 \) `
$ y2 r2 g* n# C4 t5 Z
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
2 Y" t. ?8 O  Q! H; M' H5 o$ g1 f( Mis to determines whether a debugger is running on your system (ring0 only).  Q3 ]4 B# \- L
0 d3 K- v1 n- H4 {9 b) z
   VMMCall Test_Debug_Installed0 R' y  d" x: |% m0 H1 l
   je      not_installed
7 Z# ]8 ~" b; Z/ a: m6 E# ]0 E* P9 `% \  e3 B) d4 t
This service just checks a flag.
! D7 F. ^. t4 a</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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