About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>+ x. a  E4 A- g6 a/ ?! c6 f
<TBODY>
5 V4 Y% ]; g( r' u; D! N: F<TR>
+ a" W# T# B* s* ]5 `  E<TD><PRE>Method 01 + V1 O6 h1 |' [: G# ~/ k  l& i
=========
, U1 _& y& Y7 a5 b1 r; v9 n* K* i  }
  f7 X( f) c7 ]  nThis method of detection of SoftICE (as well as the following one) is0 n5 V7 r0 Y) a+ ^$ H
used by the majority of packers/encryptors found on Internet.
5 j0 `) A$ _1 M5 K; GIt seeks the signature of BoundsChecker in SoftICE7 T6 B2 i1 Z6 e+ x  T

1 e3 S2 u7 B+ x$ }2 C    mov     ebp, 04243484Bh        ; 'BCHK'* n( a# |  a# l8 s* _8 j1 m% ^
    mov     ax, 04h9 Y' U: \1 j9 y: n. Q) {
    int     3      
6 V$ B! }9 D: i- ^6 O1 I- r" g    cmp     al,4
2 N- z  T" L; V- R5 {    jnz     SoftICE_Detected0 W- c9 _& f2 }& u" o4 J, a$ g( W

4 f  \( ?! r/ I9 B* V___________________________________________________________________________3 \* S/ G, y5 v
& K( D, Z* P8 f3 O/ k1 f- C9 e1 A0 x
Method 027 I' n# ]4 t/ N- q8 }
=========
& K* q, A2 ]# d2 d5 `, {8 r" e5 M3 f* ~0 G4 j4 K) g4 x' E
Still a method very much used (perhaps the most frequent one).  It is used- G4 o4 y9 O% v
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,
4 V1 k! e8 H5 y8 R" mor execute SoftICE commands...; k' i$ J! B( n' Q- R! V
It is also used to crash SoftICE and to force it to execute any commands- j6 W4 ?; V8 z- `
(HBOOT...) :-((  
- U4 {/ P1 h0 }# g& B: N5 B) N+ n, q- F  e
Here is a quick description:
" ]! [% G! o5 q- s1 ], G-AX = 0910h   (Display string in SIce windows)" u9 d7 R( H! S: j& q
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)  t+ }- V# [2 s( B1 v7 z& K
-AX = 0912h   (Get breakpoint infos)
$ Q7 @* D! ]  L7 q+ M-AX = 0913h   (Set Sice breakpoints)
2 a; T) w$ d  q( \2 n-AX = 0914h   (Remove SIce breakoints)# u8 T1 [2 g8 g

7 F8 I6 o  o3 M- V( a: zEach time you'll meet this trick, you'll see:) Y* b7 o8 |* K9 P8 E
-SI = 4647h6 [# \" c3 P6 Y) L* C" `5 N4 k. v7 r
-DI = 4A4Dh; `/ |" T& u8 }/ }! _
Which are the 'magic values' used by SoftIce.# Z3 L2 x# E9 T
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.
) V/ W4 F0 N" F. ?; O) E6 m8 Q0 j' W. e. L3 U6 y
Here is one example from the file "Haspinst.exe" which is the dongle HASP
: Z9 b8 ?, p) E2 O  m+ kEnvelope utility use to protect DOS applications:3 n/ ~, l% [0 D, |! y

. h/ k7 u* B- X5 L: Q% r' i6 t/ N1 E3 N: Z
4C19:0095   MOV    AX,0911  ; execute command.  C( \- ^% ~" J% ?
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
" l, W( t4 @6 b$ {  Q4C19:009A   MOV    SI,4647  ; 1st magic value.
$ \% [1 J- Q- C5 W4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
- ]' z* O* _! W3 }4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)" m$ e  [7 d% F, m& {: B% u& r9 X
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
6 G/ }! y# M$ }4 @# Z$ ?4C19:00A4   INC    CX
* _4 N" W3 S9 E, ^4 @  U4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute5 }/ P; B& q, k% E" J; K
4C19:00A8   JB     0095     ; 6 different commands.
1 a. U4 ?) |# N$ M5 V4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
- E3 {! d5 A  l6 v4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)! t% F* X* z4 l' X4 N! u% B

1 l3 [4 ~  T  n* g9 v. cThe program will execute 6 different SIce commands located at ds:dx, which$ l0 H5 d& o( T* t8 f
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
1 b' k- G0 x( e9 d+ ]; ?; \0 P* T! ]8 I3 ]: M* s3 p
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
5 S! @/ \+ V/ N. W! D9 r' ~' N___________________________________________________________________________
5 @! d" }% ]+ |1 J0 W: N% l! h
  T3 {2 P* K. o& w  Y$ m$ X8 i6 M  ?; N$ S
Method 03# D0 b' y9 W3 k  L$ W$ q" b( ]  V$ p
=========
; a( Q" w4 V5 _1 J' S. Z* K% V& |2 c
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h# k0 Q4 K& w4 x. N5 J
(API Get entry point)
  U+ e0 y( a& \) q0 \% G        3 z, ~( z, }* u0 k* O6 @

# v  Q$ T+ }3 C! M3 c# h    xor     di,di
  ~) c* P5 T( ]- X0 o    mov     es,di% {0 g4 e  w, `! i+ p
    mov     ax, 1684h      
, }" O; f/ n, ?$ \, ?    mov     bx, 0202h       ; VxD ID of winice1 i3 \4 F9 [* E  `1 f4 j# n( w
    int     2Fh
5 f4 D' q/ ], W6 i% G# c! ^) A    mov     ax, es          ; ES:DI -&gt; VxD API entry point; s& S$ j/ C! L( f6 Q3 r
    add     ax, di
0 L# \; E2 p1 ~    test    ax,ax: e1 s6 T. E+ {
    jnz     SoftICE_Detected
% k" F- U; ~6 Q: t* S6 f
# f2 d; |5 l6 O  m9 |. S___________________________________________________________________________
: y+ ?8 l9 f9 g9 c2 f7 K
( e% W6 v. H( @6 X, I9 Y1 F2 R5 XMethod 047 l8 b+ t# V8 @  Z' Q0 }: J- a8 i
=========
1 |9 O+ N! J$ P% J# W8 i- U8 a0 [* U' ?# T$ ?
Method identical to the preceding one except that it seeks the ID of SoftICE
& k, H" {) \" S) P" G! W0 jGFX VxD.7 s' g3 l4 E- A1 x6 O$ U- p
" E! z) _2 o, R6 D9 c. I; c
    xor     di,di( R7 V" z% m6 e' W
    mov     es,di
3 R" F/ ~3 Y; s    mov     ax, 1684h       / ^6 W& a: b. V
    mov     bx, 7a5Fh       ; VxD ID of SIWVID: t6 ~/ c: |. T# t4 @8 H) x& d  a
    int     2fh  b* J0 ^* k# P0 ~& @
    mov     ax, es          ; ES:DI -&gt; VxD API entry point# l; M# ~4 y3 n  m+ ^
    add     ax, di
5 d9 x/ p# F% Z) B* S# L    test    ax,ax8 ^" n3 f) L6 N* _$ G6 N7 s( O$ t" ?
    jnz     SoftICE_Detected
; p" ^* u- T6 l7 Z/ S8 d% G* e, @" d8 v
__________________________________________________________________________
6 K: d) R% x9 |2 b8 X  _( W& G* m" a2 D! u# b) P3 }6 f. p
9 z, {1 M1 H1 R9 c
Method 05
# L) g  x/ G; T" ~! b6 ^=========. {. W6 x5 S8 O2 V# k5 X) A
1 V6 A2 s1 s" t0 X3 W7 b0 m3 w6 \
Method seeking the 'magic number' 0F386h returned (in ax) by all system
9 T" W4 f) |0 d3 d) Q3 }3 T# R; Hdebugger. It calls the int 41h, function 4Fh.
" V& a* Z4 n1 X5 KThere are several alternatives.  
: a+ q9 R$ U7 B/ z& y% H9 L9 Z
7 u0 w' a6 P, K, bThe following one is the simplest:
( @' U9 T' d8 |9 y3 D2 O8 |& O8 U! u2 u" D( p7 Q) k
    mov     ax,4fh
* Z0 x6 r: J& H) b* @    int     41h* \; ]6 L  d/ h  U
    cmp     ax, 0F386  s. d& [  h$ M' M4 Y- b9 W& B
    jz      SoftICE_detected
, [. H  X. t+ I9 w) U* s, T/ E0 T8 `6 p0 I8 }9 K) C
3 e+ j* i' a/ k  v9 p* t, p; ]
Next method as well as the following one are 2 examples from Stone's " n# k: N0 p: _, U. j; W* l3 @0 b
"stn-wid.zip" (www.cracking.net):- T  s3 H! E' d# ^" x" [: f

1 H/ L) p8 i$ p/ X    mov     bx, cs
" Z- v# }+ J: [* W' d; p: R: d    lea     dx, int41handler2
* r4 `% h  t; `* Y( `6 S    xchg    dx, es:[41h*4]
* |( u' p3 W* i: a. \# f    xchg    bx, es:[41h*4+2]
0 w, R- a% m5 E3 z  ~    mov     ax,4fh
1 N2 X- F3 ^9 |+ R    int     41h
$ g( z& h  g* F% h( C  K    xchg    dx, es:[41h*4]
, _8 c2 G8 q7 ^: c1 b2 c    xchg    bx, es:[41h*4+2]& V& n8 s' [" Y% s8 J
    cmp     ax, 0f386h
" \: C, \. x- ]) U# A    jz      SoftICE_detected( ?2 j' g  g$ N' o
' A; A" e9 b( O) X3 a1 _+ a  J
int41handler2 PROC5 ~! O# ^& ?/ ]5 d
    iret
. K# {1 ~4 E3 R* N; Rint41handler2 ENDP
0 C' e# \, J( n+ q, d7 |
3 V, {0 k7 P2 c+ H
  p+ H8 B! B; m( V! W$ C1 W$ M9 __________________________________________________________________________
1 e# I4 C, f/ b* Y( O/ ^+ z
; e$ D. k. d: r' ?6 O& d9 U5 _! O$ a# U+ e$ M
Method 06
! t% o2 u+ `1 o0 Q=========. c! N' q# o1 q% a7 n7 w9 Q! E0 T

/ I" @  P: ~" G/ a8 S+ e( D! t/ ?$ S% ?! N  X& G7 Y
2nd method similar to the preceding one but more difficult to detect:
4 d9 i  N2 d9 d+ M7 E7 E& ~
1 N4 ?  X! C$ l5 x4 j$ T
3 ], Z" D5 l+ Z* Lint41handler PROC
7 K  o8 \* W9 `- U    mov     cl,al
  G2 I6 q  v% _- H* m    iret
% D+ p5 Z2 i. F& G& R6 {/ bint41handler ENDP# P/ f5 W) Q+ J& [& x

: H3 I8 u# h" _, u4 }+ P- h8 V9 m
    xor     ax,ax! f* A" v5 m/ t* O
    mov     es,ax! V, E( _$ r$ j6 ?
    mov     bx, cs/ m( f- Q- M; _  K8 x
    lea     dx, int41handler& G; u9 [9 `; z2 Y
    xchg    dx, es:[41h*4]  G, e' P( U  p  e
    xchg    bx, es:[41h*4+2]
5 d1 a! h8 {; F6 X2 D; A/ Z* _    in      al, 40h; l+ e2 z! b& e% L' `* F' R
    xor     cx,cx8 T+ q7 m6 v9 W) e3 B: u
    int     41h
7 X5 F+ I9 b/ r7 {- h+ P    xchg    dx, es:[41h*4]
+ |3 H. ^2 p) r3 v$ L% V4 K    xchg    bx, es:[41h*4+2]0 n$ Q6 Z6 E! B2 m- {: v
    cmp     cl,al" j  l. o) U4 u
    jnz     SoftICE_detected
, X# A% _. Y% X7 N4 v" _
. C4 u, h8 d& h9 t: p_________________________________________________________________________
/ R+ v. x# c3 v& s  w1 v# x0 e* {( A  a( Y; a2 ]) p$ Q" T
Method 07
- u5 F$ R+ I5 X  ]: j=========
* d6 p$ V( G3 L+ U1 J4 Q, ~5 {5 t6 ?, m# I8 }" a3 b
Method of detection of the WinICE handler in the int68h (V86)
9 w2 d0 G, b/ |) O+ i7 }, g
2 u! p9 [5 j" `/ A7 S* m, p    mov     ah,43h/ j( ?$ L+ M4 R& q, [
    int     68h
" A) f/ n# \0 T) Q    cmp     ax,0F386h
; Z$ |5 U- q% H: q2 M% a) h    jz      SoftICE_Detected
* h& R- `. P( K$ V5 _" C6 q& Q8 x- h# x: T3 _

) L5 S6 q9 Y5 s1 A# @  |2 u4 s=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
" |5 Z! X. v# }5 _9 [& {' k   app like this:1 n: w7 a4 W! o; ]( {( j8 k
8 s2 W- o5 \0 O
   BPX exec_int if ax==686 B( G  v% x' z% E# G' H2 e, }/ B
   (function called is located at byte ptr [ebp+1Dh] and client eip is* x" C8 |' z6 b& A8 B; H) C# M
   located at [ebp+48h] for 32Bit apps)0 u. Z; _7 \- i( B8 [6 W, H
__________________________________________________________________________
% m" R8 e9 c% A- I6 q* W/ ?; }, c! y* U" ]5 j; V  F
; A6 @& }. Q1 s: M" u/ G- x7 ?
Method 08
3 O/ F5 j! Y$ n3 {6 x' `=========
5 m" Y# n1 _: ?( y$ I( J/ c$ d$ Q$ b: x9 ~, @
It is not a method of detection of SoftICE but a possibility to crash the
$ A5 J& M* s+ H2 c1 @3 h" \system by intercepting int 01h and int 03h and redirecting them to another
; ~+ J9 F; d# v6 P: w& k; qroutine.
0 X6 \9 z% I& v5 w* u* a$ ZIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points6 E, n9 z7 p  w6 W0 g
to the new routine to execute (hangs computer...)& ~% K1 a! D, v  i# q" S" l8 x* \5 p

0 J% ?; ]6 l* A2 M- s+ \5 m    mov     ah, 25h
2 O" c# c$ A8 j4 p    mov     al, Int_Number (01h or 03h)
& |/ k8 A* y. `& X7 w* M    mov     dx, offset New_Int_Routine: V, S1 o8 f; N4 l- ~/ v  w$ S
    int     21h, Z7 g$ H: v+ j* s2 L* \; s5 e

1 w( Y) H$ c# \! @+ w- I' V__________________________________________________________________________
6 `) i( I7 u2 W, ^0 U
+ A# n1 p( j4 J- R: C: h2 nMethod 09
& n+ I& `% Q+ t2 ~7 ^' ]- T=========
# j1 v( ~  W( D/ B
. x2 ]# F# P2 Z2 i- [2 M1 U" o" ]This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
/ B2 c& {3 f4 o- I1 Aperformed in ring0 (VxD or a ring3 app using the VxdCall).- K1 S3 @  A+ f6 {" x
The Get_DDB service is used to determine whether or not a VxD is installed
2 J. c6 f5 d8 ]; xfor the specified device and returns a Device Description Block (in ecx) for
+ _8 Y+ g0 {" ithat device if it is installed.
; v, @( g9 }  ]( q6 r3 a0 D0 \' m7 L5 I  s# ]4 H2 b; u) Y1 q
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
" c% e0 g3 X- n: a' w, D( b/ u   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
! P# e: U7 @/ b7 p* T6 Y- l   VMMCall Get_DDB3 I2 G- S3 `/ ?1 A7 \; s
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed9 V- s8 r7 v! |: t2 y" T" ?4 f

. x' K# ^! G! M5 P7 Z; XNote as well that you can easily detect this method with SoftICE:( [& l1 f# b: L0 Q; K2 q. c3 A
   bpx Get_DDB if ax==0202 || ax==7a5fh
7 h. q& W% U4 |: W% _: _3 ^
9 D8 `- p. D5 O9 S, t8 N$ O__________________________________________________________________________( F" K* r6 S0 S+ o; }! v
. U+ k+ C+ s' B/ N8 c5 {3 \. L
Method 10
5 R! ?/ x$ |) c8 P: K  g=========% O$ U$ h/ [2 @* c, O

1 d/ h% p, K/ K=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with% p. v9 `7 I  J6 V
  SoftICE while the option is enable!!2 ^; g) o8 k2 f+ Y  |  e1 _$ _

6 n# l) j0 {3 \* F5 D' m1 g" WThis trick is very efficient:
! q# M5 G" q3 n* ~5 wby checking the Debug Registers, you can detect if SoftICE is loaded" z7 s3 R! `3 {. m, M
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if; p+ E; f+ X3 |9 V; K
there are some memory breakpoints set (dr0 to dr3) simply by reading their) @- F# i3 q9 H; j) `
value (in ring0 only). Values can be manipulated and or changed as well
% \- V  V# j+ U# K5 I(clearing BPMs for instance)
* Y9 W6 w3 ?, o2 p" y  t' p; o
7 y: F# N% v+ b- Z* ~9 d__________________________________________________________________________. a1 K# p& ~8 @. y

* |: T) k+ b- H2 h0 |+ Q+ ]Method 114 C  ?8 Y" v$ j; w3 i+ @# C, e
=========' f0 ]& @/ N4 e. V

4 }% p( ?7 j8 k5 |* hThis method is most known as 'MeltICE' because it has been freely distributed- j2 f$ h1 u( _3 a
via www.winfiles.com. However it was first used by NuMega people to allow
' [/ j" x9 z- h; pSymbol Loader to check if SoftICE was active or not (the code is located
4 L, J8 `$ ?: U. Minside nmtrans.dll).+ e3 G2 K- a, V1 d

! \. _8 ]$ Y; ~5 r% u2 |$ FThe way it works is very simple:
2 V. X. q& @- |% P* C6 N8 |' ?& XIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for+ z; c5 R6 h3 A4 j0 @
WinNT) with the CreateFileA API.
( @& ?2 ~5 w8 D8 ^# L& i, P- p# ~) B' k8 B, `7 R6 `& o, x9 r
Here is a sample (checking for 'SICE'):* Z$ S6 C, F) T1 r5 Q- ]

9 @8 ?& z9 T& t& x+ qBOOL IsSoftIce95Loaded()2 q3 v  ~/ y0 q6 [: B$ J4 ]
{$ i% l* n% L/ V' x; T2 f: G
   HANDLE hFile;  
8 Z' b8 w. f% _' T7 P   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,* U- H0 [# t, v
                      FILE_SHARE_READ | FILE_SHARE_WRITE,
) t0 ]: b2 T7 A6 U4 O                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);$ O) \$ b5 ?: C  A2 s! @8 k
   if( hFile != INVALID_HANDLE_VALUE )
2 X) X  Z+ L" I1 {6 r0 g   {2 x8 B* N, ~3 E- @
      CloseHandle(hFile);4 h  W$ ~5 k. v/ C( t# q
      return TRUE;' H& X' d3 o, p7 e! L
   }
5 l8 N% n( S8 @1 O& u8 I9 a   return FALSE;
6 ^, w, _& P( R& l; Y* g}! W$ S2 p4 t9 K% L4 \/ N& P
5 S& U. B% ~$ \# o
Although this trick calls the CreateFileA function, don't even expect to be
: @. S8 I* O& v3 m5 b4 Lable to intercept it by installing a IFS hook: it will not work, no way!( F, u/ P* s2 t2 ~+ q
In fact, after the call to CreateFileA it will get through VWIN32 0x001F
* Q! E1 `+ B6 V4 Q# w6 _+ Gservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)+ Y1 i% [. r2 {) `
and then browse the DDB list until it find the VxD and its DDB_Control_Proc
) ?2 K9 i9 n/ }0 V% _7 v4 Cfield.5 B# z0 O# C- v. t: d0 U
In fact, its purpose is not to load/unload VxDs but only to send a $ f" [6 V; m2 }* {% a& w1 p, x
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)7 ]0 P" G) p9 j; a& s
to the VxD Control_Dispatch proc (how the hell a shareware soft could try
6 k7 w7 |3 s- h( fto load/unload a non-dynamically loadable driver such as SoftICE ;-).0 A  r' n5 D+ B0 o
If the VxD is loaded, it will always clear eax and the Carry flag to allow
  _2 `) e9 Q, v  k- i9 c2 n7 Fits handle to be opened and then, will be detected.5 V# g$ C. \  U5 v; {
You can check that simply by hooking Winice.exe control proc entry point2 q2 A0 T- m: S3 i- y3 W& Y
while running MeltICE.. T9 [/ V$ `* ^6 W2 s( t
$ P+ C! A' ]( Y9 m

# }0 l2 w6 J3 T5 Y* f& n  00401067:  push      00402025    ; \\.\SICE
% m( T7 ~8 V+ n  0040106C:  call      CreateFileA
' u; {) g" M9 X8 A, _1 j; s% c  00401071:  cmp       eax,-001
! L0 f8 t+ @) C  00401074:  je        00401091
( @# P" x$ X: m$ x) i4 |+ B! q5 u* r, u( A; {$ g$ F, ^

' S$ K- P+ v; P: RThere could be hundreds of BPX you could use to detect this trick.
, Z2 g( k  b  g6 N-The most classical one is:* m4 t4 v5 T5 @6 j0 y7 ^
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
1 [2 t( H% y+ v    *(esp-&gt;4+4)=='NTIC'- x0 H; ?1 b  ^- Z% t. ]+ f; \7 S

2 G& I$ F& x3 Z% U+ p( H8 L-The most exotic ones (could be very slooooow :-(
5 ?4 a; A2 p' [8 S! R0 t& `   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
  t1 K6 R0 @8 I4 E, F     ;will break 3 times :-(
' i( f8 q9 E: q( W# s, `& U
4 f3 b$ Y* E# F; P" l8 M-or (a bit) faster:
1 W2 j* ^1 W5 j) ~# Q   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
; J% Y  J. K+ s' \" h- D6 }7 w5 T' t
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  $ b8 {( Q. Y& l# u7 ~& C
     ;will break 3 times :-(9 R2 K7 W  w2 D6 t  h0 q" G

" Y! n/ P4 ^* c1 N-Much faster:* h) T8 }# d4 v
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'9 Z3 X) P, {0 @' U9 P6 w3 ^% \

) T5 T' l4 C; x1 ^$ C8 l7 T3 X# VNote also that some programs (like AZPR3.00) use de old 16-bit _lopen% v7 d+ L; X/ I) y6 d: D- H2 b
function to do the same job:9 t% z! S+ r, M- z: E

8 c! h4 l, `- {9 H7 A$ o   push    00                        ; OF_READ
) E, W1 Q# I, j. Y3 i   mov     eax,[00656634]            ; '\\.\SICE',04 B- ~% j. J8 |& a1 z' r
   push    eax$ h7 B$ \1 ^6 N: g2 x- Q# j* R" A
   call    KERNEL32!_lopen
! Q% E6 l1 `, Z   inc     eax( W  i0 a  Q/ c+ B7 h  Q+ {
   jnz     00650589                  ; detected% V6 Z5 C7 g4 m7 W8 O/ L
   push    00                        ; OF_READ, N8 o4 }- [6 F5 q: |
   mov     eax,[00656638]            ; '\\.\SICE'! U. h4 E: Y5 q) A4 z2 d
   push    eax
6 Q! \% F% r* `* ?. ?1 q   call    KERNEL32!_lopen, o$ C* Z- O; E' U7 b; {
   inc     eax" e5 k  G5 `( E& S) O- v3 J7 q: W
   jz      006505ae                  ; not detected+ t- Q( B* v# f( M9 N
. e% `; L. w9 k. {
$ \# R+ l! {# g4 Q9 I
__________________________________________________________________________7 R+ ~0 }, x2 u# T

: h+ z6 D# _2 ?; wMethod 12
- D* v7 v8 {' g! U5 v=========, p/ t% e: q6 W) d5 p7 J0 Q
. y, c: C! q# u3 e4 W9 H
This trick is similar to int41h/4fh Debugger installation check (code 05
0 L" k: t# a2 l4 ]6 |! G/ p&amp; 06) but very limited because it's only available for Win95/98 (not NT)
7 r5 U5 |# y* N; D# Aas it uses the VxDCall backdoor. This detection was found in Bleem Demo.
4 a. _# @' \& N# u( {3 J$ O0 \3 C! q6 _8 ?/ e  Q8 e( ^
   push  0000004fh         ; function 4fh# c: g2 z; q4 ]6 V$ Y% z6 d% i0 m8 J
   push  002a002ah         ; high word specifies which VxD (VWIN32)
5 P  {5 X5 D- v6 ?) b! I: S                           ; low word specifies which service
2 ^$ }- T3 ~; [                             (VWIN32_Int41Dispatch)2 g4 o' y: M7 V5 F
   call  Kernel32!ORD_001  ; VxdCall
* H- @* r6 {5 m& u  |1 T, Z! A   cmp   ax, 0f386h        ; magic number returned by system debuggers- T! _* |4 A/ q( M7 W; [: p
   jz    SoftICE_detected: O- M6 \7 G5 M% t4 o" V, X
7 ~, z. n7 a. ~0 a; c6 b  [
Here again, several ways to detect it:
: Q2 \8 R5 Z# G8 b# t7 g
7 y1 Y; N* l7 g    BPINT 41 if ax==4f
9 H, M9 o& s# N: ?7 b9 M' n+ V: |  |
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one1 P3 e# e2 O% D: B7 v! ]7 K1 z9 ^+ S
5 u7 e3 d; D& I! h
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A( n6 j' Q- J2 ^) [$ @+ ^0 K# R- x
) C/ [7 n  [  m' ]
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
1 m9 o9 S2 b. T: M1 D7 b, f! ~
5 b- j( p/ O* _3 [__________________________________________________________________________4 e8 |" ?4 p6 r3 `; z7 ^3 ~/ i

% T4 F, R5 `, w8 ^+ FMethod 13
( w: ~$ D' O4 B/ L. `, |6 c- T' M=========$ U) Q. \0 P) R" {5 i

, S3 V; }- X* D  p% WNot a real method of detection, but a good way to know if SoftICE is
9 q0 V+ _( B! M7 d! D- Pinstalled on a computer and to locate its installation directory.$ [2 `0 B. e5 R4 B) _; P  [1 U
It is used by few softs which access the following registry keys (usually #2) :0 ]5 m, C$ @" Q# h, G
9 x: F$ i/ M! h7 u" m0 s
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
% y; |) [% Y( ^+ n) q\Uninstall\SoftICE
- }8 f0 ~3 t: h# v5 H  K$ S! Z-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
# D; e. X5 E# W- v-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion% I6 l) ~- S4 Y2 d8 r  @
\App Paths\Loader32.Exe5 o! [" O( E0 B4 |) q1 ^
3 A% u3 X# y; f: R& ~

, E+ j% C& m) l. ]0 kNote that some nasty apps could then erase all files from SoftICE directory5 M7 r, X2 j9 t' E$ d. r
(I faced that once :-(  w1 I% ?/ N1 R( ~

2 r* [, L" C# {/ O1 [& I- L. a. pUseful breakpoint to detect it:, F& y5 d# Q8 {: F$ T8 e# I5 l3 d

, V& ^1 v/ D4 k$ _' F3 ~! p% }     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
3 S; m& G! m* s& t1 l7 u/ Z
4 z/ [& B+ Z5 B/ Y0 r; ^6 V__________________________________________________________________________
! W! f8 B( y3 F8 X$ e; e3 z* V5 y
/ I* I4 N$ Z! C8 L$ ?, w. y6 A. G& f6 N, y* c1 s- q2 n' k6 Z  v
Method 14 4 G: z' ~" k4 c" V; M8 _% x! H# J
=========
: d) h5 G1 x  M) U' }& A
% v/ b; A% B, C7 d8 Z% ]A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
4 i" f. l1 a  e. B# K1 n! Qis to determines whether a debugger is running on your system (ring0 only).9 ~3 T% U+ A8 M: N8 \5 D

$ a1 n9 t' D2 [2 ]- e& t& @   VMMCall Test_Debug_Installed4 N9 N6 S' |8 t$ n, c8 |
   je      not_installed
5 x3 c1 M" z" x' @3 Z- I
2 y0 ~7 Y1 P; r  p' s  N5 \This service just checks a flag.
/ B6 ]: s5 ]  M- a6 c' P</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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