About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>% t1 }! L1 ^3 ^! b) D8 u
<TBODY>/ r( Z6 {5 F7 o6 k
<TR>
9 d3 T/ |/ f, k  h7 q' b4 _6 J" F/ B<TD><PRE>Method 01 / \2 u$ u! ^. o4 z* N4 Y) k; k
=========+ Z# b4 ~3 A, |; g

' v0 h# \; P0 O9 fThis method of detection of SoftICE (as well as the following one) is. Q+ V" d; n7 u. t; z, g
used by the majority of packers/encryptors found on Internet.
6 i& ]  ~7 I3 t0 @; O" s( pIt seeks the signature of BoundsChecker in SoftICE
8 B( Q5 q4 @% L  U* ]' o" {% Q2 I
; i; G2 L8 s2 }* ^8 F# D* _    mov     ebp, 04243484Bh        ; 'BCHK'
# j- E2 ?2 O% i; A) s% i    mov     ax, 04h9 X0 q7 K3 N4 v' X
    int     3       + z1 ^5 w# p+ x& z+ y# _" Q! U' M
    cmp     al,48 S- O! F5 @3 d- c& n8 a2 [1 Y( F% \
    jnz     SoftICE_Detected. \6 q3 x0 ~3 R" N& s( R

# E- t5 K# p9 w8 D. p___________________________________________________________________________! @) z: z1 H  C: k9 m" }  c9 T

$ E  ]" ^- A+ D$ AMethod 02
2 _; |. d0 X. X4 I8 n, {5 U- ]! b=========
8 M, o4 d' O' x/ c
5 r$ ]; k; m) s; ]5 J, S0 CStill a method very much used (perhaps the most frequent one).  It is used' Y' `" q" k" b# i2 h2 g; N# D" _
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,# h) i$ F  S9 r9 @$ A$ n! C
or execute SoftICE commands..." s; m" v* N$ y0 J9 c1 F, A
It is also used to crash SoftICE and to force it to execute any commands3 u. R2 Q0 h' ?' W/ M7 R
(HBOOT...) :-((  . R! v7 ?5 v+ F6 R
3 Y& F! B8 G4 }( ]1 F
Here is a quick description:6 `5 A" w: Y7 K5 b4 G% a
-AX = 0910h   (Display string in SIce windows)6 ]2 V( o6 [: {  V# d1 o: x
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
! H) ^" f7 I* @4 c-AX = 0912h   (Get breakpoint infos)
, J! O8 F2 x1 j4 t* C3 l3 J-AX = 0913h   (Set Sice breakpoints)5 e9 }5 W$ s& h. Z( g$ T+ ^/ D; I/ n
-AX = 0914h   (Remove SIce breakoints)
% ~4 p! P" o3 z# s
: {$ r% G" |9 u3 ZEach time you'll meet this trick, you'll see:
; g+ X# v4 L2 `* o  o4 a9 ]5 i-SI = 4647h
6 p( k- h% l6 e, w: d* G# _-DI = 4A4Dh
4 p: Y. [. D$ _: iWhich are the 'magic values' used by SoftIce.
+ P5 o2 z2 w$ L; wFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.
6 f$ a3 D! `# ~( F9 l- f( Y7 ^  E
, _; b0 l5 v9 o' e; v& I  WHere is one example from the file "Haspinst.exe" which is the dongle HASP9 u0 J0 p8 L% K7 ?
Envelope utility use to protect DOS applications:2 s/ v& Y, s- c' P

9 Q+ v- e3 X+ L2 V
* i4 n( }2 U; b% b  N" j3 C8 b9 V4C19:0095   MOV    AX,0911  ; execute command.5 g% j3 P6 v3 [( Y7 G* S# N  q3 p
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).# X/ a2 P1 m' o) h5 A1 y5 m
4C19:009A   MOV    SI,4647  ; 1st magic value." k$ P' e/ d7 p, c7 D
4C19:009D   MOV    DI,4A4D  ; 2nd magic value., o- h! w! g5 v/ v* d$ N0 }
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)  O. d0 Q9 m" y' }, o( D+ C
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
  \3 Q2 {' ?% i# L4C19:00A4   INC    CX
' g! M7 Z" ~( `, h( ]* K4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
# T% o) p& P/ I  L* _4 W$ \4C19:00A8   JB     0095     ; 6 different commands.
* ^2 D9 ?0 v# Z- e9 U* U4C19:00AA   JMP    0002     ; Bad_Guy jmp back.) V1 N8 Y  m! V7 w6 W7 }1 Z1 j
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
% P* N$ c) C- o) _0 z: P- k5 G! |. b% |
The program will execute 6 different SIce commands located at ds:dx, which
0 s& O$ q  j! C. u/ E/ o/ |are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
8 E. [9 C: }* Q1 O) g9 j
5 d1 C# ^3 u* G- X0 w( u; K& ]/ O# p* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded./ z. S4 t! n2 C9 S$ x
___________________________________________________________________________$ J" K! s4 ^. D* K  m4 J- N+ B6 X  y

- }  L0 _$ f9 {$ r. F0 G- w& B0 H' S: K( b+ ]8 K4 U
Method 03
/ W0 J* Z1 J+ N# K+ m3 C) z" r=========
  N$ |. T$ c3 k# p
, D; l. D. _0 K0 N1 M# TLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h6 E8 {% o& Q/ a# A0 i( ^/ h
(API Get entry point)
: R" w8 z9 F" |        
) r3 _7 h  }( D9 j: v2 O+ {9 k  P/ t- _# j6 w
    xor     di,di
' V( B/ |, S3 n) D' h& l9 p    mov     es,di
$ Z* _9 m: Y0 M& Z0 c7 t    mov     ax, 1684h       " V8 g" X# S8 m9 S. m. F
    mov     bx, 0202h       ; VxD ID of winice
. v. e& U5 E1 d! L! x    int     2Fh. s$ q' }  S( j$ j/ ^& ^. l
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
( ?0 V# X; F/ |& h3 d    add     ax, di3 R: \9 Z/ n: W, I* ^& v1 d
    test    ax,ax; Y* r: [. S" r
    jnz     SoftICE_Detected, _; `0 _+ }- T1 v: T' ^. C; `

# @9 e% p: ]) H" d4 r___________________________________________________________________________
1 _; z. K. M2 S2 B
: e7 N  s4 w; m. ^4 R$ H& w( k6 NMethod 04
% b1 Q; a+ F4 q( {  g) W, o6 c6 m* Z=========
3 O$ K: E! v) F4 D3 d
  Z! T- P, z+ C: q: S" d2 c2 g" [Method identical to the preceding one except that it seeks the ID of SoftICE& V$ e: W5 y) d/ w
GFX VxD.
/ W4 i! I6 y/ Y. S* h2 q0 y- q
7 I+ i2 R2 }3 @7 n    xor     di,di7 J# f, z3 ~; l) K2 q
    mov     es,di
0 G% d1 S5 ]; ]4 U    mov     ax, 1684h       ) K7 N4 D, w# O% o7 X
    mov     bx, 7a5Fh       ; VxD ID of SIWVID
5 A8 F: w: X9 I/ U    int     2fh
9 v" C- Y9 G7 M8 t! m, i; R    mov     ax, es          ; ES:DI -&gt; VxD API entry point
. x3 R- H! [5 {* o, P    add     ax, di+ \! M2 u$ v% U  Y
    test    ax,ax
2 x& e/ i7 F1 U' [) _4 o0 a    jnz     SoftICE_Detected
+ K  p6 ^2 t" }! Z; h& b
9 Y* [1 j$ o  z- H' O0 _; m__________________________________________________________________________4 o9 j% h$ f  R& S. D2 }3 ?! O4 I

! w! ^6 T5 i6 r, ]: l8 _2 _+ X" d& z# @; f" ~$ Z4 H- r; O' T; h' Y
Method 05
8 }% [: [. ]6 D4 C: S; o  q=========# _7 D" ]8 d4 v5 x
* h. p2 a4 l9 U9 @8 \% j( R
Method seeking the 'magic number' 0F386h returned (in ax) by all system
  B5 l& K9 f2 p0 e5 _$ H  Fdebugger. It calls the int 41h, function 4Fh.
5 d3 z' Q4 C; r7 A8 C. ^There are several alternatives.  , l* a& w7 Y3 [3 d; u4 C) A9 ?5 q

) E" ~1 z2 b! P; s" U, YThe following one is the simplest:+ ?" @: p0 E& H

# B# ?; w& L: H! v% U3 t    mov     ax,4fh
, ^! ]4 ?# G) b& o7 A8 w* `    int     41h7 u  h4 v0 J8 n& V. [! P4 P3 Y$ `
    cmp     ax, 0F386
8 C- ]! \  [) T    jz      SoftICE_detected& r& U% V/ J8 H8 c

7 u' s4 P, P0 w8 q% y1 U: [5 d2 ~7 Z0 m+ i
Next method as well as the following one are 2 examples from Stone's 6 e: P) N4 Z# i( J* k* s
"stn-wid.zip" (www.cracking.net):
# O5 h9 P4 `+ E8 d0 y9 s
7 i! A7 |. ?. v# D* O$ r% T( z3 ^6 @    mov     bx, cs
9 C5 s& u9 m7 J# B$ _    lea     dx, int41handler2$ o1 c! g- r: @8 M
    xchg    dx, es:[41h*4]
$ A8 V9 V6 z) _$ j    xchg    bx, es:[41h*4+2]$ D, H# f1 y" m: h$ n0 _
    mov     ax,4fh
; I9 d1 D4 ]8 m3 V  T    int     41h% X0 d* l. d( _; m" F& ]* A
    xchg    dx, es:[41h*4]5 X7 A, |* \& T/ v& A0 y
    xchg    bx, es:[41h*4+2]4 E5 k( \2 y& A5 ~% U$ }+ ~; h
    cmp     ax, 0f386h+ C2 V* J5 a6 P7 ^0 C. J
    jz      SoftICE_detected4 p6 D3 T" {, j6 Q- V/ K

4 ~" _5 q# d( W. vint41handler2 PROC
6 i' F; X& n7 W. `) }* o2 S( f# L    iret
0 l! K' t' C; ?int41handler2 ENDP
8 v+ M# l( a2 a
, v. @) @) s$ n; |% h/ x
0 m, K  z4 |4 x; `! e3 i7 Z% W_________________________________________________________________________
8 C1 x4 l" E9 x$ M
$ O& E  l* L% Y5 A0 g# Z- g) R
3 C9 R- G, c# }8 V4 M9 {( Q4 Z1 e) E, P" |Method 06& E; h8 m, n' t7 L" n4 G# c1 T; ~
=========9 J4 d, ^/ i  u, }2 [) X5 a4 I+ s7 v
4 p! y& s7 G7 R3 U4 g

# ^  }( h/ c3 O2 k& Q2nd method similar to the preceding one but more difficult to detect:
, c3 A1 Z1 d+ |8 F$ ]* A$ S4 }+ Q) C! t% E
8 v4 l$ B& _+ p$ Z* D- n% H# b
int41handler PROC1 X2 ?7 t+ L7 H& ~  e7 |# P
    mov     cl,al
* V: c% A) b" x8 g: h0 J6 v    iret
* q% D- O! u# R/ _6 Lint41handler ENDP4 y/ ]$ C. @& q$ o( S9 B/ M

7 c9 K/ Y5 b: L: U+ x2 ?. i8 n" @) C( d
, E) g4 Q6 {/ y$ Q8 M    xor     ax,ax: ]% O+ O  G3 P4 P
    mov     es,ax3 _4 @5 v- [: ]
    mov     bx, cs! D/ r) C/ Z6 B9 U5 K: ?% d
    lea     dx, int41handler
! y" _' K6 m5 t0 k/ o) f    xchg    dx, es:[41h*4]
/ y/ v' ^7 N) |! I! ^    xchg    bx, es:[41h*4+2]7 K* i" Y6 g: e- K% u" P7 K8 F% ?( K
    in      al, 40h- C% ?- R8 K, z  D0 [
    xor     cx,cx
& O; F8 l  M7 }    int     41h
( \( F$ p# b5 ]& _5 T2 ^4 P    xchg    dx, es:[41h*4]
6 y' S$ T1 R$ _    xchg    bx, es:[41h*4+2]
+ }% _3 W4 F' \. j2 f2 m    cmp     cl,al
4 S4 P) P0 N8 r$ }    jnz     SoftICE_detected$ V8 k, z3 R& q8 L. ?
, |" j7 }. W, q
_________________________________________________________________________" w" G8 V3 f- w

1 V3 V' g0 H- O6 O( Y4 CMethod 079 p4 \' M5 p8 ^) o
=========
3 H5 N$ u4 W- `. g9 F/ Q+ E; M3 Z1 B- T& t( I9 V: H5 l
Method of detection of the WinICE handler in the int68h (V86)
1 v# C- \3 R* Y$ l- E1 ]% e) h$ S8 y- b2 T
    mov     ah,43h/ N' D, X! D9 _9 H6 B2 Z1 d
    int     68h# U. \) S, Q* I
    cmp     ax,0F386h
( c3 L. x9 I, V  U7 z: b/ j! j2 i    jz      SoftICE_Detected
8 |+ R, U# G, l: g$ o7 f& p  I* L9 ^( Z. A

; N5 q; A, U& [+ ?3 y( G, z=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
7 v! f  a7 a) v; E4 {5 G5 n   app like this:- N  S6 b. i7 B6 }, w4 ]/ [8 d
( b. q- I/ r7 m# g% w. A; j
   BPX exec_int if ax==68' w9 B: \. Q7 H) m3 M2 E  Z& R
   (function called is located at byte ptr [ebp+1Dh] and client eip is
% V' k8 e. g/ ?# d  [9 l   located at [ebp+48h] for 32Bit apps), B2 [9 Z4 ~8 O
__________________________________________________________________________% z; `, I% Q6 r3 d

( E  I3 _# V: J2 Q* ^
* [5 B/ k9 c, `2 R6 bMethod 08
5 X0 i# \5 c, R7 |=========
0 ]! q7 p8 |/ r+ ?/ B7 V# ]9 T* `: d" [( M8 I8 k
It is not a method of detection of SoftICE but a possibility to crash the+ t: i* y/ `7 w; G1 m3 j8 l
system by intercepting int 01h and int 03h and redirecting them to another8 }0 _5 D) m7 @* h+ g
routine." w7 p9 ]6 D5 @. n- Y. [
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points* c% D( e! y$ y
to the new routine to execute (hangs computer...)7 i7 {, T- D6 L% v5 _
) \0 T" B$ h: U) Q/ S# f/ H
    mov     ah, 25h; Z- d6 N2 @" J3 C, l8 s7 x$ T, e
    mov     al, Int_Number (01h or 03h)
  H" S" \8 v! R- l    mov     dx, offset New_Int_Routine
* A6 s2 s2 w) B: j/ H    int     21h+ P% b. G. a. O  j6 i* R8 \' V
4 L9 S6 k* n/ Q  k
__________________________________________________________________________
0 _  L' u" g$ h  G/ f* P4 L9 ]! g6 P6 H6 G' W0 h& s. `. {
Method 09( e" |  Q' G+ D# b3 ^
=========
  j! u2 M7 c8 `$ k& Z! |
- \9 ?: @$ m0 eThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only7 P6 ?( y8 M6 a: {9 n5 }
performed in ring0 (VxD or a ring3 app using the VxdCall).
# [( b6 F9 U( ^2 YThe Get_DDB service is used to determine whether or not a VxD is installed
" n6 X9 e- g4 Pfor the specified device and returns a Device Description Block (in ecx) for& K* r: J+ @$ N5 R  e3 h8 M: X
that device if it is installed.5 H. I, D+ @: b7 r, n. q

" H6 h! `& U$ P; t3 b   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
0 d3 p/ ^1 `- n( }   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)* h7 `' h" R* r7 z! M
   VMMCall Get_DDB: e( G" e$ S. v- l
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
' j$ c" u; R* e, p" b& m  `( j: ^2 j' e( x" G6 ^, t  A
Note as well that you can easily detect this method with SoftICE:
$ z& {* r5 W+ x( }. B3 T' W   bpx Get_DDB if ax==0202 || ax==7a5fh8 z/ U( M' K+ p0 Q0 V! t

9 o% B7 ~! p5 t$ ~/ q6 j# y7 D__________________________________________________________________________7 Y5 X) S4 O6 a! C

' c8 w8 u# D3 v+ eMethod 103 t6 I+ N3 l, ^+ `
=========/ z$ E2 p" ^8 G3 n# e) B0 V3 }
$ G0 G# R4 @  ^2 t! s
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
9 I0 H$ K7 o6 b4 W+ }  SoftICE while the option is enable!!# S- }4 w8 x6 @0 k

1 b1 Q7 w' P9 hThis trick is very efficient:
$ Q$ i5 P5 N; Cby checking the Debug Registers, you can detect if SoftICE is loaded
' s! h% j0 ^! U& A+ W(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
) u8 h- p7 V# G9 {& M$ E. a; `there are some memory breakpoints set (dr0 to dr3) simply by reading their
, e$ V2 j; d( [. s, rvalue (in ring0 only). Values can be manipulated and or changed as well- u" ?: T- t! u% p$ e
(clearing BPMs for instance)
* H; w+ S- _0 T, z- `9 ]- [
5 \* q: h+ i  g9 o__________________________________________________________________________, Q7 q7 K2 ~0 d% w# D6 [0 O
2 ]9 [5 z+ g$ ^% j/ N
Method 11
. y' n. @' h; ~=========+ e6 E' X- l- D$ Z8 h2 a! B2 A0 p
1 s  v' _6 F) C' d. p' i
This method is most known as 'MeltICE' because it has been freely distributed
1 f: j/ ?# ^! w- uvia www.winfiles.com. However it was first used by NuMega people to allow
8 |- l, x7 a* Y& q1 ~: vSymbol Loader to check if SoftICE was active or not (the code is located
3 a& T; b) K* {0 k5 Oinside nmtrans.dll).! C5 ?$ n1 n$ ?
3 C. a- R1 e: K$ E; q
The way it works is very simple:% C; @/ h/ b( X9 m* c' w) `
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for! J8 O* a( [' {) @, J3 ?
WinNT) with the CreateFileA API.
* Q' \, k1 F2 V; c; }6 n6 i
6 v& v( d6 j/ K! }Here is a sample (checking for 'SICE'):
: h2 t3 ?3 q6 @# @! L7 q0 f: n
BOOL IsSoftIce95Loaded()6 {2 K: s* z% {7 E& E% {. n# I- ~
{
6 f, q2 k" U$ o   HANDLE hFile;  
& y* n5 u4 Z- E, R# i   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
" L& H/ P  ]( e- @+ d                      FILE_SHARE_READ | FILE_SHARE_WRITE,
1 \, P. j! W3 x) f0 D                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);: V) a5 b3 t+ d6 u2 U: s7 @3 N' ^0 i
   if( hFile != INVALID_HANDLE_VALUE )
* h+ g6 [0 R7 j2 l' @* c/ g: P: |   {0 n7 }* t7 g, ~6 m0 s
      CloseHandle(hFile);
# a- ?8 S! V1 K$ r+ A: Y8 i      return TRUE;9 F) T$ F$ `- u1 u6 x( _* x
   }
' l5 ^1 R2 U/ f5 u6 r" s7 E# D6 W   return FALSE;% F( n0 U3 Y' E2 h( h# t
}  c+ _6 [* A! b3 d* E: Y* l

: w9 x8 Z1 M1 e- k) U2 }; k  {Although this trick calls the CreateFileA function, don't even expect to be2 q: q# U) g) ~4 q& R4 i& B
able to intercept it by installing a IFS hook: it will not work, no way!+ R- U# Q, d1 B: A' E% O
In fact, after the call to CreateFileA it will get through VWIN32 0x001F; h4 M8 W9 }1 W7 U6 s! _0 T+ v
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
1 T) H9 g3 C/ J3 a/ O; N# |4 Gand then browse the DDB list until it find the VxD and its DDB_Control_Proc2 E: N2 h% H+ b# K9 D; {
field.
1 w- K+ f% u5 K, \In fact, its purpose is not to load/unload VxDs but only to send a 5 G7 E) x% t" C' D+ H9 ^
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
1 o: x! b% ~. K5 C6 s! s$ }to the VxD Control_Dispatch proc (how the hell a shareware soft could try% E7 q, X2 i" Y( y
to load/unload a non-dynamically loadable driver such as SoftICE ;-).
2 X% n7 `* ~. h& K3 ?: L6 v4 }If the VxD is loaded, it will always clear eax and the Carry flag to allow
1 a# j/ e' e( i8 }8 j$ V5 [, fits handle to be opened and then, will be detected.
% q: M: d- K) OYou can check that simply by hooking Winice.exe control proc entry point
9 A8 N1 i) \2 L4 a3 Awhile running MeltICE.
/ n) A$ {0 P$ ^9 H9 D0 [- M3 ^( j6 r0 Z7 H% u
: ^7 \( G' n" p* ], F+ O2 U
  00401067:  push      00402025    ; \\.\SICE9 K2 G0 Z+ i6 W# @
  0040106C:  call      CreateFileA# |! D1 p0 I0 L( \6 q
  00401071:  cmp       eax,-0015 a# e. r, e9 _5 f/ I* U- L
  00401074:  je        004010912 v' G. q( J8 F0 U" ]: ]

4 U1 G$ }- x) H/ x; U- k7 g/ H7 B5 |/ v
There could be hundreds of BPX you could use to detect this trick.( @$ |8 u* Q" Q
-The most classical one is:
- O/ C& v7 d  p- C) V; E' _9 t0 B  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
, z1 J8 \& |# D6 j1 Z) `9 i    *(esp-&gt;4+4)=='NTIC'# l) c# P1 v+ Z; ~

8 F8 v8 p' u! d4 n3 m1 b-The most exotic ones (could be very slooooow :-(8 q7 y' r, v4 z' g/ v! s
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  : E( ?& w: a% n; V; L0 d
     ;will break 3 times :-(
6 Z+ v2 v8 K8 D% R7 ?( k( v. H7 K" T) v- y3 s6 Q+ ?* q
-or (a bit) faster:
7 ~; v* @* g7 t+ _/ Z1 I   BPINT 30 if (*edi=='SICE' || *edi=='SIWV'), U& S/ _2 B" k& q3 H! N# h3 M
7 |: K' |! \  a( A
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'    s; T- k- c+ m* x
     ;will break 3 times :-(3 k# e! {* b/ s& `; _. j
$ t" Z* H4 [$ q, u: d: f
-Much faster:! b. R7 C  l: M- v
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'( e8 V7 P5 G% s  p( C. F7 f7 e; ~9 s

6 [7 o8 |: c& B) G; s0 I3 zNote also that some programs (like AZPR3.00) use de old 16-bit _lopen
: w1 M2 v; A* Wfunction to do the same job:
& l: H# l" f' M8 F; \
& S& W; [2 B# r) ]) w   push    00                        ; OF_READ0 \4 A5 V% W" W0 l. n
   mov     eax,[00656634]            ; '\\.\SICE',0
! t9 R; F' r4 \# L! i8 B; I   push    eax( r* c$ v( ]6 F6 Z2 B9 B& m5 r1 _! P
   call    KERNEL32!_lopen
# z3 @8 h, B  t5 M3 C- r5 r   inc     eax
4 [2 H8 A+ f1 R   jnz     00650589                  ; detected5 ]+ W. A+ t! P* U( G
   push    00                        ; OF_READ
: r6 Y6 y- s: g. X' C% l! p   mov     eax,[00656638]            ; '\\.\SICE'
3 F/ k$ b/ L; T7 d# c7 P   push    eax$ q" a" e+ k! l; L+ L( J
   call    KERNEL32!_lopen
8 p4 c  p: k7 |! t, Y   inc     eax' U$ F4 |3 ^# ]3 F2 _( m6 U3 X' d- A
   jz      006505ae                  ; not detected, m" B/ s$ H  o
- c  e! f1 A& _2 I
; c& `3 i  A+ @) `( f4 V- Y: S5 K
__________________________________________________________________________* x8 q8 z! k8 B, p

3 {5 D1 d) g" T# d9 n, p, AMethod 12  U( E  D3 o6 H& |: m; w5 }2 K
=========
" ?( M% i% k  L# Q. z/ ]0 \4 p( d0 S9 n+ ]; }) X
This trick is similar to int41h/4fh Debugger installation check (code 05
& o+ |: s; Q2 }( o1 d6 z& u&amp; 06) but very limited because it's only available for Win95/98 (not NT)2 f; x# G, n/ l1 k5 _+ j. o
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.9 V4 O  |. ~0 V2 C9 {

: V" Z% H7 I- e; ?1 n7 I: n   push  0000004fh         ; function 4fh
0 e* q# m. g, k7 @   push  002a002ah         ; high word specifies which VxD (VWIN32)7 h4 R( r9 t( |/ k  `% W* `
                           ; low word specifies which service
$ o1 N# S% V; P2 [, S9 f. M                             (VWIN32_Int41Dispatch)
& f+ Y, Y+ l" P9 N: ~4 x   call  Kernel32!ORD_001  ; VxdCall
7 I! x& I5 X6 X- j' ]; m   cmp   ax, 0f386h        ; magic number returned by system debuggers( v. t3 F8 c8 ^5 u  C1 }
   jz    SoftICE_detected8 _. s. P% u2 j) Z1 n, C6 q

$ Y& C! W8 ^* X$ C5 [" m, A( k2 xHere again, several ways to detect it:: w' K: q' T* a% H# ]+ k
* E8 j, {0 k+ A  h! F$ x0 B. K# Y+ C
    BPINT 41 if ax==4f
* e+ Z# M2 I& w$ X; }
4 I$ \* c; W) {7 u    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
+ G9 f- R9 {6 @' ~1 P' e4 k
% W6 O1 h" @3 s. e3 b& N    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
" T+ d1 t% X8 f# u  _5 _- v' J* t' J- t0 c
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!3 Q. p( F2 o" f8 b: L

/ d2 i  c+ o) l$ D__________________________________________________________________________
9 T( d% E" n4 B" c
, @! b3 ^. ^8 o  H- i+ D2 {$ pMethod 130 U( Q0 r: k3 E) l2 G: @5 W
=========( I: P% V7 K" q3 _/ S6 [0 I/ r" r- t

# F2 f* u2 I1 C( S0 X+ `; ENot a real method of detection, but a good way to know if SoftICE is6 ?" M7 y9 c  o+ G6 s. y( B
installed on a computer and to locate its installation directory.0 l" S5 a8 r% `, ~6 p
It is used by few softs which access the following registry keys (usually #2) :
2 m( }& P6 f; g- V/ B* w7 u: B
$ M& s0 F' H* t; h+ `% }2 J6 `-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion4 [5 o% a: T9 y8 A
\Uninstall\SoftICE  Y6 F$ B9 g( s, F
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE1 d' y% x% w8 l0 U- g' @
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
1 Q. s* W# e) v; P% j\App Paths\Loader32.Exe
1 I0 \% ^& _+ [0 i% @+ O& G% r3 q
0 z" v% c% ?. B/ A* I# y
# K5 ]0 M! ]- |0 gNote that some nasty apps could then erase all files from SoftICE directory
7 ~# F! @5 f% F. y5 ?( ^. a: u4 B8 K(I faced that once :-(, G- w! h* G* I$ h+ U
: K' I, b6 k& ^; b& b) {( Z/ d2 \
Useful breakpoint to detect it:
$ D/ q" S4 W5 @1 V! S
7 k% ?5 |  L' l, b: U) \5 y. ~     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'2 _# S! S( p: c+ p

+ }9 z* u/ a  _8 M: F__________________________________________________________________________% ?" m5 G1 j' e9 Y

' H0 O3 m* t- \. K
! p3 o. _5 \8 Y) b+ ?1 MMethod 14 3 W2 U+ @' }6 Z. ]2 e
=========0 d1 ]/ {- {8 `9 b

6 I) ^) U' Q8 I2 n# eA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose! S' I& j) f) Q2 X
is to determines whether a debugger is running on your system (ring0 only).
- T; E9 V9 W* \8 [' x3 W  B: \* M( C) k+ d- }2 v
   VMMCall Test_Debug_Installed% |6 d9 y" U6 j4 G
   je      not_installed# Q) U% j" C1 s6 N
6 P& l( I/ C, ^: @! U
This service just checks a flag.
. `$ P8 R3 v) v4 \8 r0 [1 R& T# k</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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