About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
3 u  A9 c) B3 u4 u# j; I<TBODY># a$ O; |! r. b
<TR>
5 X- Q  ]7 H  S7 }9 M<TD><PRE>Method 01
; Y( e4 _$ \& X0 x5 a2 K3 Z6 H=========$ r: G# c0 T( s1 K' {
6 G( a: ^0 s9 f! o7 V
This method of detection of SoftICE (as well as the following one) is- F' e0 `( [' |1 A- ~8 {) D
used by the majority of packers/encryptors found on Internet.0 v5 o+ U3 ?7 A* H9 ~8 p* W
It seeks the signature of BoundsChecker in SoftICE
8 H% o8 s! z' H- Z5 s
# b' z* V$ b9 u$ p: q9 n0 ?3 y    mov     ebp, 04243484Bh        ; 'BCHK'
2 Z6 I* k( E, x  o( W( C7 x: _* x    mov     ax, 04h
* l) X  ^1 _( X! ?    int     3       : m3 [" z3 S+ w8 v: |0 q% ?
    cmp     al,42 C0 }- G, o( i+ ?' a5 y
    jnz     SoftICE_Detected4 }7 a; \" G+ y6 |' F$ {

( h  f$ _- l+ Q- H___________________________________________________________________________% g3 L! `  U( u) |  Q% g/ U- n1 n
% Q2 y6 K' ]+ Y2 K. x
Method 02& t  a+ L$ e) c7 h
=========# k: C! U  f' F  y! T
& p4 r9 b/ N& C' ]' W# T6 W) a! T: N
Still a method very much used (perhaps the most frequent one).  It is used& w, _/ b1 ?, e, I) v: B+ H! q
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,# X, i; F. }/ m( [* Y
or execute SoftICE commands...9 z  a% K' ^# @$ m
It is also used to crash SoftICE and to force it to execute any commands
: U2 ]1 {- @9 A0 `(HBOOT...) :-((  
- P6 Z3 j6 A4 O7 w$ w2 `
3 j/ X7 c  U5 l, B! b/ s' E) uHere is a quick description:+ r9 w% x8 @+ n$ z1 d' k1 r
-AX = 0910h   (Display string in SIce windows)) P0 m9 J( X5 k; B5 }
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
& V2 R& y" e$ P! B6 L) A$ c-AX = 0912h   (Get breakpoint infos)
4 `: z' g3 A( F5 n' Q+ H0 {-AX = 0913h   (Set Sice breakpoints)
9 x4 r- n7 B6 |: V' a- A  i-AX = 0914h   (Remove SIce breakoints)
3 I  N" X1 w/ F) ], Z, |' C8 P6 p7 @: }
Each time you'll meet this trick, you'll see:5 Q* a& _, v: T! Y4 T$ w
-SI = 4647h# Z. o- w" i, G8 x" u/ g' K% v
-DI = 4A4Dh- c5 e: f) B3 j
Which are the 'magic values' used by SoftIce.4 i$ k- Z1 j, M
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.  C, ^6 K! x$ X" E% o+ s0 r
5 C8 x. O4 u3 O9 ?4 t
Here is one example from the file "Haspinst.exe" which is the dongle HASP
( S( h* H# y7 s7 S; K3 XEnvelope utility use to protect DOS applications:5 L4 N  m3 U/ k3 G
/ P) j( _$ S, d* k9 d. `

6 y. D1 k8 J: h+ V4C19:0095   MOV    AX,0911  ; execute command./ T& m  |9 {" ^6 D# T
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).6 F0 r  @) C" E$ k/ W9 q
4C19:009A   MOV    SI,4647  ; 1st magic value.6 o: B+ w5 P. d+ O3 h' t& P+ H4 G
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.: u' R* y7 S) m
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
% @3 ]9 y  X, t$ I+ J) R# |) q4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute- O& s7 I. H) L, p0 {# J+ F
4C19:00A4   INC    CX( n/ T5 D9 v& r% q3 ~! P6 l
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
: i1 N* V, o0 j/ [% _2 l4C19:00A8   JB     0095     ; 6 different commands." x' O. m3 k2 \$ W( ~3 z, m" i1 ^
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
' `2 m9 j% B4 S, V) N' a4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)6 s/ P  E" e$ |6 r: h

: Q* F, m' H! D! Z3 X: HThe program will execute 6 different SIce commands located at ds:dx, which
) Q9 v$ H" C/ J5 S2 O- f  qare: LDT, IDT, GDT, TSS, RS, and ...HBOOT., D, @- ~, q0 r. J2 N  ~% `
& F, K2 v! B  L8 ]2 S( O# ~" b
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.$ g( ]3 Y8 c, K8 S# V$ F
___________________________________________________________________________
$ `# z9 E. E7 }9 W; W1 U
3 c* S& M$ Y& n# Q6 \, n: z4 q/ |
! \. b- S4 W2 GMethod 03
$ B  E; |/ z" p" G=========
1 H" n. T4 Y) X- k+ D: e2 c5 l& o$ u% d7 M# s4 [
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
1 H0 O! z8 d3 ]1 l- G$ O(API Get entry point)8 O! E' }; V9 T
        2 J8 A; X2 I, g7 l! h) t% G
% @1 w* L) ]& ?3 H7 l- y) `5 k( @
    xor     di,di
" i' |5 g1 \1 G    mov     es,di8 y5 ?" w5 E( X4 p6 f% B0 A8 o- K
    mov     ax, 1684h      
/ q3 g7 W6 G- ]    mov     bx, 0202h       ; VxD ID of winice3 L1 u8 x! a# H/ i8 |
    int     2Fh
2 j4 h- v' t5 O. [4 @    mov     ax, es          ; ES:DI -&gt; VxD API entry point3 u0 Q1 v5 [& C5 K1 {
    add     ax, di
$ V4 J/ v. w# L3 r# R1 j% u: `8 Q    test    ax,ax
* d+ e7 ^8 S# E' q8 _' |/ p    jnz     SoftICE_Detected
4 X" k1 N5 a1 ^- [. ?1 d; h- F) z
$ [' n; g7 F/ Y+ {0 I4 C( U___________________________________________________________________________
. y8 _5 l2 Y4 T& j4 r" h6 A6 t6 V
Method 04
$ M1 G3 F: Z& ~, T=========, R# c- o: |9 M0 X
' W. O- \0 f! `% k: T
Method identical to the preceding one except that it seeks the ID of SoftICE. a, R4 z8 j  s. b: s% G- {& X
GFX VxD.
0 M( m% ~3 r" v( c* i2 _2 r& {
0 k! U0 B% M, V- o# b7 ~    xor     di,di
; j: P) L& L3 X    mov     es,di
9 f0 D5 h2 Y" A6 _! W6 g9 n    mov     ax, 1684h       ' l! ^* V+ t' N8 m
    mov     bx, 7a5Fh       ; VxD ID of SIWVID
4 I7 S: r' t" D+ }6 b    int     2fh  d9 O5 N4 ?' }: h! M
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
$ ~% I- N; _3 A    add     ax, di
3 Q) y6 W. F2 c& A    test    ax,ax
5 K6 k8 [5 v9 t. b: k9 L    jnz     SoftICE_Detected
4 Y5 ^6 C+ P& f1 ~* l2 s; x8 f0 r' J
__________________________________________________________________________+ C3 S3 m1 L+ h

6 x; C. I- X( C" Q( n# |! l
6 j4 p5 g% {* v# Z, `, rMethod 05
' L& `# e; q* D0 A=========
& V$ p4 F$ U% Z' g2 }' X2 x# N" s. o; P$ n8 ^, Z7 M6 n, V+ y% Q9 h5 c
Method seeking the 'magic number' 0F386h returned (in ax) by all system
  \7 |' o4 o7 F9 y! a3 J  {* zdebugger. It calls the int 41h, function 4Fh.4 c* D5 z' u# I; h, q
There are several alternatives.  
' w0 `) M. P6 t& N
+ I9 S1 n5 [# D1 y9 BThe following one is the simplest:
( V9 p1 f0 m* K0 g1 O3 T4 K3 A9 _4 s
" d( w# v8 m8 Q    mov     ax,4fh
% A* i8 ^* E6 e, x% A- z4 `    int     41h
- ~+ y5 Y- `5 N    cmp     ax, 0F386
: {7 E: R! m6 U- X/ W- w    jz      SoftICE_detected
) |: _- a# X& R& X+ f& e8 C( D+ o5 ~

2 f5 e9 f1 X5 i/ c/ k1 qNext method as well as the following one are 2 examples from Stone's
% _8 Z3 @1 `8 \1 k, d' M"stn-wid.zip" (www.cracking.net):
% P. d2 I. z" |# C6 E% a# }2 i% W. V5 K0 o, A
    mov     bx, cs- z0 D0 g) t% {
    lea     dx, int41handler2: i0 v7 k1 Y6 g4 M) h: U+ c
    xchg    dx, es:[41h*4]
2 R- g% \3 _# Z3 T    xchg    bx, es:[41h*4+2]
: P) @8 v3 q' ~  u    mov     ax,4fh
3 c0 A$ I8 ]9 A: V7 @    int     41h: R3 [1 |  s, m, a$ s' Q0 Z
    xchg    dx, es:[41h*4]
, @; y" U) r* _) }/ q    xchg    bx, es:[41h*4+2]$ `3 |1 D( I2 J. ^/ A1 X" X3 f5 p
    cmp     ax, 0f386h
" O& V( X4 @7 k    jz      SoftICE_detected! h# p5 L6 m. e
7 S3 ~) g6 K0 o- b/ N% v
int41handler2 PROC! @5 ~* O1 c' v% y' p
    iret5 N2 I9 `7 C1 g$ c" X/ u0 x) K
int41handler2 ENDP$ j/ h, U4 o+ ^$ E8 W+ ?
' t1 J9 y6 \0 }7 Z+ x( x

* s, a2 }. v9 ^" Y/ X6 c$ y- G_________________________________________________________________________
+ [$ `: s# P1 K* L! j" v! x0 }; t2 d1 z% c- c

- n% ^0 f- d* K1 d% Y4 eMethod 06/ E; [# i5 N3 g/ K" {, Z; `) H9 ^
=========
  ?7 z# z( \1 t2 q
2 h( A3 B, A/ E6 @
' [7 F& Z) G, P" y4 }, |6 L" }2nd method similar to the preceding one but more difficult to detect:0 P# d7 O5 ?/ Z) D+ c3 q' v/ {( _
) j% u8 l; p# ^& [% b' P- O7 M

8 j* d7 R+ H; _( P" ~4 [! n; [int41handler PROC' o3 i) A* _7 ~7 \$ m
    mov     cl,al3 t* c" w; b3 \% e
    iret
0 R% M" k7 K7 j: L; ^# @" u* H3 jint41handler ENDP- Z9 e( d, b2 k- U( ?6 g- M
. P" c2 e& ?2 d- N: c

7 W& V) C4 p, |+ _( q    xor     ax,ax; L, M  g9 X+ L5 Q" U+ o1 X2 w
    mov     es,ax
5 h0 }! [0 s0 X: U* i/ A2 z    mov     bx, cs
0 @- c0 S6 K# E2 `9 ]# F    lea     dx, int41handler
( I: U( n4 w3 t. G- u3 J4 ^    xchg    dx, es:[41h*4]
3 m2 x8 B8 c5 ^4 g& g2 W# P    xchg    bx, es:[41h*4+2]
. i9 c& y3 Z( b# j$ `    in      al, 40h5 n6 u8 U1 D0 }$ F, G7 E6 W' \
    xor     cx,cx
  x+ K2 H% E" [! s6 U0 O5 Q7 W    int     41h! g5 J) f$ o7 @$ n/ ]" c7 V
    xchg    dx, es:[41h*4]  Q* s3 Y' ]7 r9 X
    xchg    bx, es:[41h*4+2]7 ~& e+ E# j% J$ ^3 t
    cmp     cl,al
2 ^# E% a' c' p: ]" h    jnz     SoftICE_detected
$ _! e* U& w/ b- ]3 @7 H0 P3 P2 F$ Z0 T
_________________________________________________________________________7 v/ o0 T" `3 y* G! `! W% k

3 y4 {7 r, h) ]( V% X: uMethod 071 G( T3 u9 G* V5 v) v2 l
=========
$ }+ {4 T' Z9 e* O% ~; t7 _0 ]! u% Y$ p6 b% s
Method of detection of the WinICE handler in the int68h (V86)
* N$ m4 n- q2 k8 q! D4 x
9 v2 Y$ J8 d0 p: Y3 E) s5 f5 j    mov     ah,43h
% B1 u* X- [0 b1 R2 e    int     68h/ H' H% k  Y  {
    cmp     ax,0F386h4 [4 [5 l, U# c7 @3 o
    jz      SoftICE_Detected
# x: G# `6 B: P6 b; @  }( R: k! c  B- @' Q- C- t. j

9 F$ K* C! z/ ]=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
2 `5 G+ \( O' N9 {; b   app like this:
  _& x" V, D% F1 X/ P+ R
, O: w/ ~4 C1 k# O8 ^1 F4 d  n4 D   BPX exec_int if ax==68
8 }. J: E  y2 I2 m' E   (function called is located at byte ptr [ebp+1Dh] and client eip is
2 }; J; h$ _( s$ G: g" t   located at [ebp+48h] for 32Bit apps)
( h0 h" B6 [; s. s5 Y% }- A" V__________________________________________________________________________
" B' e  f" ]1 V7 L4 @9 z/ |% v8 g* e1 ^: U) x- w6 O' b
" y  W0 g- t8 U# U& {( E. l, o# R4 n
Method 08* R4 B' C1 o& {( M8 N; \% D3 @
=========
+ R* k0 I3 E  Z8 l7 f$ B# e5 O7 `9 G+ F; n: N( b/ Z
It is not a method of detection of SoftICE but a possibility to crash the
4 O" j1 j# {7 h1 g% _$ F5 osystem by intercepting int 01h and int 03h and redirecting them to another8 E3 D, u7 _1 p' T2 c7 A4 H+ x
routine.. K, T7 z$ p& L, L$ `5 M
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
# v% n5 m" `7 m5 J$ Q. U/ Q, zto the new routine to execute (hangs computer...)
4 P. ]7 A8 w. L. j/ B$ Q7 R* }
; X' G. l7 [9 M6 [$ F4 s    mov     ah, 25h/ n. P% Q! j4 S: T
    mov     al, Int_Number (01h or 03h)3 ?! _3 O4 C. X7 Z$ F' |3 A
    mov     dx, offset New_Int_Routine6 {" f$ n6 P  ~, C+ \# C& @7 z' U
    int     21h
/ G! ?+ R% n& j" P
' X* Y4 r, W8 o9 q/ o. R3 \__________________________________________________________________________3 J8 u  ?1 R/ i1 B

( e1 k3 X- {) Y2 X$ bMethod 095 `0 V- E! T, d/ @( i4 ]
=========6 T$ ], `" _% Q! q6 d0 t, a& u

" E8 W/ ^4 l: f2 Z% jThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
; `+ M3 I. W, i! g, \performed in ring0 (VxD or a ring3 app using the VxdCall).
6 w& J( I; }8 e) v% M4 lThe Get_DDB service is used to determine whether or not a VxD is installed
; w! g3 z3 S3 z* C" Rfor the specified device and returns a Device Description Block (in ecx) for0 q' ~/ U/ }# S0 y# R0 x' m* o  j
that device if it is installed., J5 W2 S- G5 b# o2 ~
3 H8 U0 n7 w6 F
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID* v3 ~  n" ~3 h1 j& {: r9 O& d4 Z$ N7 X
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-); H' E0 N" m' G3 o: k  G5 v
   VMMCall Get_DDB
" K* U- L( Q. X/ x3 Q; U; V! m: p   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
; M; X0 Q7 y# s  a& Y; Q
" a7 t* r7 L7 u2 T: \Note as well that you can easily detect this method with SoftICE:* W* V3 v+ I) q8 v
   bpx Get_DDB if ax==0202 || ax==7a5fh' X3 i1 R" S0 u3 i# o: l7 c
7 Y7 Q/ @  Z% Q& M1 ^, L% D. z- Z; R
__________________________________________________________________________5 h& i* T) F' Q3 H! s7 x

* M0 b$ P1 \/ |& |Method 10
7 C3 Q. d) Y$ Z$ u' h& B/ r' X=========
! |5 Y2 f/ \+ }1 e1 O/ A2 r+ J+ n
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with' G. H2 r; _5 U' X
  SoftICE while the option is enable!!* p1 \. F6 v; E3 o. C' Z! X7 Z
0 I, b9 {# _, U- K
This trick is very efficient:% G/ O" Q0 I7 p- _) `) Z* {
by checking the Debug Registers, you can detect if SoftICE is loaded# C8 H5 H- K8 v1 g. @0 p/ O
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if( N0 I# y$ p5 [8 M$ ]
there are some memory breakpoints set (dr0 to dr3) simply by reading their
- s# d- a3 z' C& Nvalue (in ring0 only). Values can be manipulated and or changed as well7 s' N7 Z$ ?0 |2 \# T
(clearing BPMs for instance)4 P( z5 ?4 c2 u; n0 Q0 |

: `' s+ v! U% k5 {" U' e* r) b! d! q__________________________________________________________________________
' [  w( S; ?4 ^% x
& N! A/ l8 r; mMethod 11
4 n: g" J* R& \0 P7 s6 X' D=========7 e( j3 n: F0 J8 s+ E

& t% U6 y' u& hThis method is most known as 'MeltICE' because it has been freely distributed: O, W" q* i* S$ m9 C
via www.winfiles.com. However it was first used by NuMega people to allow7 d% `- `5 d3 ^. P9 t* U$ r
Symbol Loader to check if SoftICE was active or not (the code is located+ K2 h- k9 P! D3 s5 d3 [) ?
inside nmtrans.dll)./ F( ^. q1 P9 l* b# ]2 S+ P' o5 h& s% s

" f+ h( W6 i' x" O7 I+ Z, vThe way it works is very simple:
* w4 e, c  v* ^! L" m/ {It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for7 O8 J6 o% V; J* |4 M
WinNT) with the CreateFileA API.
1 ^& C' n, M: Z  ]: t8 k# n
& @& v9 G) J! V$ [) WHere is a sample (checking for 'SICE'):
  y$ y) @  r% f$ p- s
8 R: L9 C* h) J- v0 R4 R( P- yBOOL IsSoftIce95Loaded()
  W) y! P/ p1 R0 L: R5 s( a{2 `2 C# G9 w3 A( c2 I
   HANDLE hFile;  & j  l- a0 T7 F, J2 s7 B5 o9 W
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
- n. F4 O) [* q5 ]                      FILE_SHARE_READ | FILE_SHARE_WRITE,5 k/ [$ a1 \( B6 Z4 a; W9 R7 u
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);, k. A4 I: ^: M  r9 o3 K4 a3 T
   if( hFile != INVALID_HANDLE_VALUE ), i1 Z$ I  D7 h6 B" ?
   {- R; s; R$ g( T; D  q, A  m
      CloseHandle(hFile);
# G/ H0 y! h1 y4 f$ O% h" c( ^      return TRUE;
; H* r! I/ [* h( @   }% b3 l5 S2 ^3 T# S- T
   return FALSE;/ K4 z/ x2 C% I& x9 E3 ?5 K5 V
}  c* m3 N9 T' M- Q6 }4 y
& |) E. Y1 s7 [2 U$ _. d4 C
Although this trick calls the CreateFileA function, don't even expect to be
% ]7 S4 ~4 G3 [# p, Z% `able to intercept it by installing a IFS hook: it will not work, no way!
8 z/ i5 T5 @2 p9 l0 SIn fact, after the call to CreateFileA it will get through VWIN32 0x001F! M5 j4 a3 ~2 _  ^$ n% H, k
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
5 W1 z! Z; S- Q' T, Kand then browse the DDB list until it find the VxD and its DDB_Control_Proc. W% k( d4 m) O* Z' }. V
field.6 R4 Y$ l! ]& C4 N; U
In fact, its purpose is not to load/unload VxDs but only to send a
$ j4 T% S# h  T+ G8 m$ HW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
0 L  N( Q- M3 n$ p3 G) X# L$ kto the VxD Control_Dispatch proc (how the hell a shareware soft could try
& S6 }' V  n& R0 F8 Y4 w3 T* Cto load/unload a non-dynamically loadable driver such as SoftICE ;-).
1 q, B+ C! M$ |1 K( G# D+ MIf the VxD is loaded, it will always clear eax and the Carry flag to allow* c! T4 i# t/ B$ Q( o, P! T
its handle to be opened and then, will be detected.+ D' q2 W8 r1 c& T; J$ C, {
You can check that simply by hooking Winice.exe control proc entry point
8 c* ?3 g5 r/ @/ g; Z9 B# s. k  E3 twhile running MeltICE.
' E/ U0 q9 Y7 e
( t; Y2 I5 e- ~* G5 _3 x6 e4 h" K+ G# J0 ]/ Q6 R! |
  00401067:  push      00402025    ; \\.\SICE
; G0 b! F# C) k7 p  0040106C:  call      CreateFileA0 I# q( i% q2 J) u3 Z0 E
  00401071:  cmp       eax,-001" B8 l" _. P, x! J4 i. _, G) b
  00401074:  je        00401091  b+ @- h  Q: s' D: z) ]. K2 z# v
# \! Y# e- V7 x% p- M

9 r' R# |! T9 aThere could be hundreds of BPX you could use to detect this trick.: G, L/ z2 w8 W; m  ]6 [' P! B
-The most classical one is:
7 y' I5 G' |% I$ i  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||- v$ [: y9 n6 S; G# O$ G2 z
    *(esp-&gt;4+4)=='NTIC'; _* ?! Z0 ?: m7 u( \: Z+ A* d3 P  [

9 O0 |% L" ~1 h  \, W  f- n-The most exotic ones (could be very slooooow :-(; a  J  {, \! x# x1 K/ k$ Y
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
: Y, G* `, r: m9 R     ;will break 3 times :-(
" J) ^* e- N/ {6 c
) s' ~7 P9 g! w# B-or (a bit) faster:
( S  h* ~9 b0 M+ U- x9 j! ]- l0 d   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
5 h* w. u4 L$ }- p3 I3 c
, X! m5 t: R9 t& T8 O   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
  N/ T& _3 A8 U5 W9 L     ;will break 3 times :-(
; l( C: e- a" p
1 Y. q  }( A9 J-Much faster:
8 i: A2 m/ i2 l  Z! x% ~1 Q   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
  o* L; u  S& d8 K# V  D8 H5 l- Y* C/ v
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen8 y# ~$ q& C6 Z
function to do the same job:
, u. y1 t5 E* ^3 ~7 N3 Y( e9 z6 [# ]
   push    00                        ; OF_READ6 @: ^& x: t2 s8 P' U8 {
   mov     eax,[00656634]            ; '\\.\SICE',0' x  u# E# Z$ }4 k, B
   push    eax0 H# f6 j; K/ F
   call    KERNEL32!_lopen
  |& `5 M+ b6 H6 ?   inc     eax$ [4 V. X; k, e- N7 {
   jnz     00650589                  ; detected
. g3 c3 |* J  K( q# b: s/ a& q   push    00                        ; OF_READ
7 a6 v* l+ \. }6 R+ a$ \   mov     eax,[00656638]            ; '\\.\SICE'  r4 L9 V/ v/ _+ M$ T) E: v! s
   push    eax
7 R, `6 h% i$ l; n5 p   call    KERNEL32!_lopen+ s# f  y0 ^7 J! V' R' ]  a
   inc     eax6 J7 _  ?9 O+ }3 Y; g, T8 r
   jz      006505ae                  ; not detected
# g& L: x( l8 b5 S- M' J# r# }- F/ S. B/ u3 m/ m) z
4 \* D# T# V+ E# E9 b# v9 [" X# \
__________________________________________________________________________+ ]9 a& c' O) d4 t

2 S8 T* P1 `0 D$ m( \# ]4 U6 HMethod 12
5 a- K4 t& e) P4 g" X=========0 L! \( M3 s! j
) c, L; J. [2 n5 s- O# O+ G
This trick is similar to int41h/4fh Debugger installation check (code 05" K' S7 u7 T9 O0 i; j
&amp; 06) but very limited because it's only available for Win95/98 (not NT)
0 E: F8 x( A( h9 B% Y/ B% @as it uses the VxDCall backdoor. This detection was found in Bleem Demo.
' d" ]2 v0 C$ z0 t: T" N/ R" i- y& \+ }! K. O9 o4 S
   push  0000004fh         ; function 4fh
& v  d8 w9 g, _! @- i   push  002a002ah         ; high word specifies which VxD (VWIN32)/ v! _. o2 t0 ]8 M$ Z( a
                           ; low word specifies which service4 y1 U7 A* z- d& w7 x; [8 F; S
                             (VWIN32_Int41Dispatch)9 C- A' f  K9 `2 t1 M, t* w
   call  Kernel32!ORD_001  ; VxdCall
2 n# F9 h) c( `8 i   cmp   ax, 0f386h        ; magic number returned by system debuggers
; D" x. I! |" M! e; G6 M! h   jz    SoftICE_detected
6 K- ^) E+ r3 E, G0 v
1 N- U) i9 a+ f6 y" S& n% hHere again, several ways to detect it:* v: v( R6 \1 x" H0 p% P

; W4 ^8 k0 n" F$ @" r6 e6 o    BPINT 41 if ax==4f! G3 R! @3 }% L8 \5 E  ^/ i
5 W. y) U* M5 m
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
! g3 g1 u) r5 C0 N! |' X3 h# u4 }' G- m9 `7 v5 S
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A  t) K# {% X6 |. i9 |( E# T
  J( ?* O8 |* f/ o4 q+ D& z0 ~
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!1 P, ]) `  [7 {# j
8 l" w, Q& j% J8 m# d
__________________________________________________________________________
, }; L6 N: D' y, @% V3 x1 z+ p3 U  w6 {" K, Y
Method 13$ [$ i- E9 }7 D& u
=========
$ _8 |: @  x7 g8 s, ?, S8 W4 y8 A- ]
Not a real method of detection, but a good way to know if SoftICE is1 R1 p" d1 d$ C3 o( ]
installed on a computer and to locate its installation directory.
  p) E7 W" G, WIt is used by few softs which access the following registry keys (usually #2) :# y7 ~5 r5 ]* J9 N/ x
! p$ q5 T7 h; C- d1 i' _+ ?6 {
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
; |( B8 o" \, G2 W\Uninstall\SoftICE0 E2 B7 t0 m* }/ ^7 c' [6 @! I
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
1 q0 @+ W1 l, ]3 p8 ]" K-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
% N. Y& p/ T) I+ L\App Paths\Loader32.Exe0 C+ k. l4 A' @7 g5 b: c6 w
0 _0 ?: E: b( L$ I- `  N

9 R3 ]' N9 g! d' gNote that some nasty apps could then erase all files from SoftICE directory
  I2 _6 q) }+ ?2 v5 Y(I faced that once :-(
, m9 _; b; w( J& w
/ g$ R% n  f3 ]- T+ eUseful breakpoint to detect it:, X/ Z' p& q9 y4 n# U6 A' y! q
5 N) S/ M2 l$ W$ @
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
! K$ c, y9 `$ N  L/ |
1 A: k; f$ K* A2 M! J5 w__________________________________________________________________________% m. b# U/ J' y

- B# w" m, x2 ~' H: H/ p3 _% Q/ B
2 }+ L; X3 \) G+ ]Method 14
0 }% h  M" _- K% n=========; s( K' r, w$ f# T4 e* T8 t# E
& c0 o3 L& H4 x, w3 K% R5 p
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose! U  O9 q& P, i1 m4 @0 R. N
is to determines whether a debugger is running on your system (ring0 only).
4 \& l  v0 q' f3 m7 v  e1 Y4 Q% n' j! }8 D' X* x1 B; c6 T) f
   VMMCall Test_Debug_Installed: h* H1 E8 g$ L4 `
   je      not_installed
+ e2 q, B8 q5 ?! m" H' ?. p/ V6 w7 Z  Y( E! C7 J2 C$ N1 T
This service just checks a flag.  e* D; \  l7 o4 t3 d$ w# C
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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