找回密码
 注册

QQ登录

只需一步,快速开始

About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>, [3 C7 ^# z# E6 X. W! j( j) |
<TBODY>* v8 c1 P6 j0 y1 Q9 i. n
<TR>" Y1 I5 \+ L2 [
<TD><PRE>Method 01 ! |0 l: _% I3 X0 ~! P* a
=========) o5 k! f) _% c& f
6 R: E" d% d' k! ]
This method of detection of SoftICE (as well as the following one) is, ]) m' [9 w5 f: K4 r) U2 l
used by the majority of packers/encryptors found on Internet.% ?" q4 v& f: A; u/ L9 O* M" e
It seeks the signature of BoundsChecker in SoftICE
: Y6 x5 p0 ?6 _# ^1 _- C: D+ y
% C( t* Y$ ^8 ~2 g( ^    mov     ebp, 04243484Bh        ; 'BCHK'1 o0 _9 S( S9 F* T: U
    mov     ax, 04h
0 k+ w2 b" z* ~8 A( `- _# n8 ^    int     3       ' [; l9 M" H& {
    cmp     al,4
( t( j4 s: `" _! \( c    jnz     SoftICE_Detected3 ?8 R. O5 Z: @: X8 c
/ ]( Q0 k5 H" E2 N: `$ e
___________________________________________________________________________
$ j/ l, T7 {5 p4 o
# d  h. G! M' G* rMethod 02
; I1 F3 S. h1 p9 Q; T=========
! Z& R1 O0 m9 q" {( F. S* G3 Z' Q7 V( v4 f  r
Still a method very much used (perhaps the most frequent one).  It is used
; \2 q- L) p! X. r0 _! q( k* Ato get SoftICE 'Back Door commands' which gives infos on Breakpoints,+ I) N  O8 Z4 [3 R/ X& ]7 {
or execute SoftICE commands...
* N% }; J' ]! {It is also used to crash SoftICE and to force it to execute any commands
4 n# z5 u9 C2 O(HBOOT...) :-((  
$ W, Z4 k# }, j# _" ^  g
1 S. k! n0 `5 h. n; x; zHere is a quick description:9 k/ K9 }* S3 Z' F$ d
-AX = 0910h   (Display string in SIce windows)# P: v" X$ r0 \; I# [5 h
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)7 H5 j3 `1 h' e0 ]4 B0 M
-AX = 0912h   (Get breakpoint infos)' |* R9 T5 X( {! G
-AX = 0913h   (Set Sice breakpoints)0 e# i5 {* z5 t. c
-AX = 0914h   (Remove SIce breakoints)
% w0 }- k! A" s+ y; v" I4 V$ H2 h/ Q# J
Each time you'll meet this trick, you'll see:$ k3 p% u- U; c  u! S' [) k
-SI = 4647h
0 i1 @! D, J& N: S2 k6 c-DI = 4A4Dh. h3 A  F. |, R& a. g% O, H
Which are the 'magic values' used by SoftIce.) {5 p0 t3 D8 F$ B
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.
  o7 O; D1 X6 ]0 x; U* c8 D0 q9 T  {% p9 _. z
Here is one example from the file "Haspinst.exe" which is the dongle HASP* m% Q$ ~- T5 C. U
Envelope utility use to protect DOS applications:
2 }  n. M- `. L7 p2 M, ~% z+ c1 z: L) h4 M

. f+ P. g9 h8 y4C19:0095   MOV    AX,0911  ; execute command.% ?( S7 [: R% y, ]9 [
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
; [3 u9 k. L' Q. v" l; X4C19:009A   MOV    SI,4647  ; 1st magic value.) G$ |& |; G2 F( ?: N
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
; C0 U$ v; N) u0 F4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)3 m# G9 v5 t( S) N
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute! H0 H" O0 }4 T' s3 d
4C19:00A4   INC    CX) ^' ]4 z: w+ V/ X
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute8 m  s0 N" j) ]$ V
4C19:00A8   JB     0095     ; 6 different commands.
4 m" k) m2 I1 V8 P2 k4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
$ g% H+ K) \" g  I- H) N& Q4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
( x6 g" E& P6 v
/ y' Z. i. {1 L3 {; \- AThe program will execute 6 different SIce commands located at ds:dx, which( {. i2 [: H1 K5 z7 U3 ?
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
9 S6 D( x7 a- w7 L* R9 b; c; `+ [- ]! Y. W
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
; N; n& q, p8 L3 E9 o8 s___________________________________________________________________________4 n) S$ a: @9 `- b
; ?7 W, a) t8 V& S

) _$ r; C1 p* U. p. jMethod 03
! W/ }# K5 O' K- R=========
9 e& c0 V) N4 b' {2 h5 C3 P& \7 n: L/ R
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h, o9 {) N' D8 s) r0 q6 ]4 y
(API Get entry point)  K' p' r& W% T8 l  x
        
! ~2 [; a$ \- z/ {* ?! }
6 z& b$ z" i9 n% t6 |    xor     di,di
- l  [4 o3 ^3 \$ {+ t    mov     es,di
" c3 e0 E2 o6 H4 }+ K    mov     ax, 1684h      
4 X* \5 V, B" }    mov     bx, 0202h       ; VxD ID of winice  |. L3 @! p$ s5 D
    int     2Fh
1 i& U/ Q4 R: c. n# t3 a- q5 R- [    mov     ax, es          ; ES:DI -&gt; VxD API entry point
* l5 Z0 ?  i% N  \    add     ax, di/ b! s* w  T1 ^
    test    ax,ax8 I+ d4 \: [: |2 R/ |
    jnz     SoftICE_Detected* u8 o+ N! f4 h
  n, s# @/ Q  R$ Z
___________________________________________________________________________0 ^% M3 M- l8 ?3 H! @

  p# k6 h. O) N1 {3 h- g9 eMethod 04
$ j1 h  b) Q6 U$ e9 }; k=========
2 W! V( g$ H8 _% Z% ^6 X- k- p0 I# M3 h* j
Method identical to the preceding one except that it seeks the ID of SoftICE* {+ ~- `9 G! f  }, G& Z
GFX VxD.
( T; |; u# [/ N- |2 K" K" J* B7 ]1 ~' @" W! N/ j  Y( H( E
    xor     di,di
: d3 t$ d8 L) X) h    mov     es,di& u( ^1 W4 b& K! h3 H6 b' o
    mov     ax, 1684h      
: X% V+ h; [! d2 E6 D' A) K    mov     bx, 7a5Fh       ; VxD ID of SIWVID' A& H7 f3 R) M6 h
    int     2fh
& \: e4 A" h* ~" l. v& J$ r* g    mov     ax, es          ; ES:DI -&gt; VxD API entry point8 p) J+ P( w* v+ H- O- u" P  }
    add     ax, di" L( e" S0 {; Y
    test    ax,ax
4 m6 h- o+ D( H) m    jnz     SoftICE_Detected
' z9 |& @# f7 A, ~. M  B# U! @7 I9 V, c' u6 m
__________________________________________________________________________7 w6 u' }7 M' z* N% r) x2 @! g$ ?. l

8 _" E, v+ Y6 }* a+ H! V8 m& H7 k/ V0 o  i. J
Method 051 n3 ~3 v' h, {) T% `( O
=========1 F5 j' H3 B4 K8 D5 e+ T( w$ Q2 S

3 C$ W3 E7 O8 ]. }Method seeking the 'magic number' 0F386h returned (in ax) by all system
( F, I+ A8 b; ?! g8 [& y8 }debugger. It calls the int 41h, function 4Fh.! F/ `" R' h8 H( C
There are several alternatives.  
% \' F4 h" S2 ]3 t3 k" V% g; R4 Q: y
The following one is the simplest:7 a+ K+ h4 L. W; V1 b
- _5 g/ g2 K5 y, h" K; G
    mov     ax,4fh
' B: n4 M" E6 d7 L! O    int     41h. ], c, I3 S( ?/ P: `& b6 k
    cmp     ax, 0F386
( g% ?: Z& X' Q2 d    jz      SoftICE_detected; k- B4 J) C8 N, u+ V$ ~
$ \  h* j3 E6 l1 y5 k0 `

5 q6 k. y! W" E' Z( U0 gNext method as well as the following one are 2 examples from Stone's $ _( X3 V9 r# x: H$ x' C" N, q7 U
"stn-wid.zip" (www.cracking.net):
/ _5 q* }/ @& ]
; m  N8 c& S  {$ P9 c$ B% l    mov     bx, cs/ }7 U- E1 z  |( N$ ^: P
    lea     dx, int41handler2
- j# C8 z4 Q. @3 r    xchg    dx, es:[41h*4]0 a7 D# Z$ o0 C# b# R0 R" m
    xchg    bx, es:[41h*4+2]2 c, w" I, V: Y! K6 u# Z3 F) j
    mov     ax,4fh
% c: S0 q1 J: g6 a4 u, `5 y    int     41h: }7 |- X; }8 f) v# S. f* U. \
    xchg    dx, es:[41h*4]8 c, h( t9 V/ e5 h9 B
    xchg    bx, es:[41h*4+2]' J! m6 J6 [0 Z$ i5 ?
    cmp     ax, 0f386h' x: p2 d5 q9 f
    jz      SoftICE_detected/ L& U0 v7 _: r

+ D) C7 K2 h0 J& `int41handler2 PROC4 n5 X- I+ [9 @; \) f" I9 ]+ ~" e
    iret
8 s2 x( a2 ~  w6 _) D) A! [7 wint41handler2 ENDP
( N8 D( `7 D& n: F
. V, r) |  g0 W: m( e* H
: Y& r% v  |+ n, m7 b  i' s& f_________________________________________________________________________% [' x3 U6 I0 p

( M7 Q1 c) {; F2 i7 O$ _! o7 T6 O. _' n# h) t
Method 06
9 i2 a# F9 s! l=========/ P% I: G0 j$ u4 V
2 i8 z  x# E; S9 A8 y

* K5 f# Y% d% D2nd method similar to the preceding one but more difficult to detect:! d! D# p" w' K( ^' m
7 [+ b, `4 G, [; \( L

' k$ @" P  Y7 V7 Q4 u+ Yint41handler PROC& \7 v7 t; u8 ], O9 e+ i
    mov     cl,al; x% N" F  }  G: C0 D" I% a5 c
    iret% C' V& m' }; R$ E. v3 X5 a
int41handler ENDP
* `$ K- d* A8 h4 |  u8 J2 o5 \$ r
% U2 t) Z  i/ S& q2 e+ r; Y& O% K( R* i: u7 N3 w: J
    xor     ax,ax9 ^  A2 F' v* {0 W
    mov     es,ax: Z. F2 ?+ E5 g5 ^4 I) ^  ]5 Z
    mov     bx, cs* ]2 A! s6 C! [; ~
    lea     dx, int41handler! D* E  q, w! A! z6 ?, k
    xchg    dx, es:[41h*4]
  c( L7 S9 Q( y+ U5 G    xchg    bx, es:[41h*4+2]
' z, z% T! f) U) Z+ B( f+ x8 {: K    in      al, 40h) a; J5 M: j* y4 A2 h
    xor     cx,cx
" y: a7 y; x5 O& u. v$ Y    int     41h
* T+ g) u- C3 m" J( m* z. j    xchg    dx, es:[41h*4], _; |$ f: |* Z- L6 z  g$ d
    xchg    bx, es:[41h*4+2]4 X0 Z. C/ |. k. G4 `
    cmp     cl,al% o* I% [; w% l4 z) W
    jnz     SoftICE_detected" @" C( f: N6 A6 T" i9 K

: y, e3 u4 D' T  p. e_________________________________________________________________________
6 b, a* j* w$ z8 I
8 i  J! b% R* eMethod 07
- B+ b. m; ^9 o' z0 g8 W=========
9 o& v3 c1 @0 P8 G
: k0 g2 W2 o1 @: AMethod of detection of the WinICE handler in the int68h (V86)- G2 Q  |- ^, P  J
2 I4 `+ _; u9 L9 J& j6 t
    mov     ah,43h
9 o# g) {& [, p, z" @    int     68h$ B  m% Z4 |- ]5 e% e; i& F3 H
    cmp     ax,0F386h
; B$ z, ~: c3 c3 {    jz      SoftICE_Detected
% _- c- u( D  b# S0 {
6 L/ t: n+ W: h" F0 Y' i7 s# H: h$ ]
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit8 q+ ]  O6 I# c# _% {* l  x. k( A+ I
   app like this:
3 t" k! x# H/ u# \: R1 e
  h' }, a7 K- r$ F   BPX exec_int if ax==68
' F' g1 {( K' [/ s. Q% K   (function called is located at byte ptr [ebp+1Dh] and client eip is
/ C- u$ A* X3 c6 p4 B' ^   located at [ebp+48h] for 32Bit apps)
& s' s' ~8 E) ?- E! q9 g/ ]8 B- `% i) ^__________________________________________________________________________
: b7 B" H! j6 [5 A
3 |2 f% e) R5 B  U: k8 ?# j" ]$ [) |! K4 V; G  h
Method 08
$ L. g/ a# w/ z$ H# |* V=========
# i7 f& J0 q9 g
0 }8 a) Y. \+ j8 ^9 U4 l  p7 RIt is not a method of detection of SoftICE but a possibility to crash the
; ~, P5 t' [3 O8 H% l* ysystem by intercepting int 01h and int 03h and redirecting them to another5 w4 V  I0 g1 a- O2 L! a
routine.
0 ^. C" X5 E0 s$ y3 p* hIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points, T( B% B7 }6 D% C2 o
to the new routine to execute (hangs computer...). @7 Z) D, r) o) [0 `9 i

# I( l4 g, H, h  Z1 S2 l    mov     ah, 25h$ c' v/ T5 b9 e
    mov     al, Int_Number (01h or 03h)' Z5 O/ H1 N! x: B6 U
    mov     dx, offset New_Int_Routine5 u0 n6 h5 }; \/ k2 K0 L
    int     21h
: x+ {; x; d) b# t) l' ^! i+ y1 D0 {9 O2 g2 h' h
__________________________________________________________________________
8 n2 l0 V/ F. c; D: r- e( F; t- ]* G  K8 x
Method 09- b" V: A: i- W" W, ]5 V5 }
=========
9 S8 s" ^/ T2 E2 G9 X3 q9 X8 ?% S
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only# ]0 c5 c% W  q4 w
performed in ring0 (VxD or a ring3 app using the VxdCall)." w+ F$ S3 z' a( i7 y# c
The Get_DDB service is used to determine whether or not a VxD is installed/ ?# M5 R3 o+ ~: X: w/ M% K" A& r; W
for the specified device and returns a Device Description Block (in ecx) for  d* G) A% U2 i7 T- g' V7 B8 s
that device if it is installed.8 B7 S+ O, z- x' o' J- t

% A6 Q' {, F. P9 R; K8 R   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID1 \  K# W* Q5 x; o  r
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
5 S  r9 V$ H& b& S. k" |! v   VMMCall Get_DDB- M1 x7 p' |( M. K
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed* Z; y( V0 s& G0 n+ Z, X3 o" @
8 ?! d& R- ]& i. ^, G
Note as well that you can easily detect this method with SoftICE:  X, }7 C  r4 J. {$ f
   bpx Get_DDB if ax==0202 || ax==7a5fh
# t$ Z& n: C; U1 i) w4 j* t* w9 @. D$ T
__________________________________________________________________________
  v" U# n( b# `) N* B# t5 j* @; B
. r/ D3 D1 Y# T" a" Z7 kMethod 10( @; f5 g& O1 n
=========# N3 P% N  x% j6 R* J2 b
5 m3 A0 a, Z' E9 N( f
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with) ~4 O9 ^6 h2 e) t' i$ g9 l% `
  SoftICE while the option is enable!!" D8 w; D# [$ c! l

# Y" Y4 z7 D# c1 A7 _( }, DThis trick is very efficient:
. U, S* {& `6 w9 k" S# _by checking the Debug Registers, you can detect if SoftICE is loaded
+ x8 Q, {+ }% e, w& e/ F& ~  H8 q(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
* N- [* `7 W% {. U0 I* o; mthere are some memory breakpoints set (dr0 to dr3) simply by reading their: a5 R; H" Q& l' l' U
value (in ring0 only). Values can be manipulated and or changed as well& u& }; Q; b$ j; Z# M" p+ N
(clearing BPMs for instance)( r+ N" C2 g9 G7 }( [
+ j( }" }7 Z2 ]3 o
__________________________________________________________________________
: K, z! u; P  P/ G6 T* d  n1 }9 {+ w# B' ]; e" \
Method 11- V$ x% N7 |0 ~' M
=========
3 X) i, {% X# ]8 I1 d$ a7 }+ @- C
1 K( M2 |/ t0 Y' bThis method is most known as 'MeltICE' because it has been freely distributed
, q( |! i8 L% E! Q1 I' Svia www.winfiles.com. However it was first used by NuMega people to allow8 n) D3 a& [4 [) e
Symbol Loader to check if SoftICE was active or not (the code is located$ S6 v9 c( q8 D5 O
inside nmtrans.dll).
+ T. K* G$ p; ]# |% m# D" M% D; y' X" h: h
The way it works is very simple:+ S; h/ y' \9 c' X
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for1 ]  R1 e! x  }3 b
WinNT) with the CreateFileA API.
, `% \4 A* D8 Q. x
% G+ D4 G4 E9 G7 lHere is a sample (checking for 'SICE'):8 z; P" a6 V- y5 L' N* v
3 A( U) a/ k1 ]% g  Y; {
BOOL IsSoftIce95Loaded()
9 ~5 ~) o" z+ R0 O+ a4 V/ N{
) H) v$ k! D$ V6 }. h$ P   HANDLE hFile;  
) L. @- |7 f6 u" B5 R0 g# |   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
: j9 @9 Y2 \) U" N                      FILE_SHARE_READ | FILE_SHARE_WRITE,
  o, w- G. M- t* h/ S# l                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);5 i6 ~* ]; a5 a6 s* T; H
   if( hFile != INVALID_HANDLE_VALUE )
6 M+ h$ O. h6 L" p   {
8 ^# G* W$ y+ j$ [& b      CloseHandle(hFile);, e7 N/ }* I* S+ b! s  _0 S8 T
      return TRUE;
& C  [, k! A: u; l   }4 j$ {* h9 ?, C: q: Y* k' \; E
   return FALSE;
9 w+ K+ b0 L: _  b9 C4 `0 b6 r8 W}1 x9 @4 F, r$ p0 V
( m$ M4 b) V( p3 \8 |
Although this trick calls the CreateFileA function, don't even expect to be
) Z3 |5 F! `+ D/ V/ Cable to intercept it by installing a IFS hook: it will not work, no way!
$ ?" R2 j% _4 G' @: `' Z+ mIn fact, after the call to CreateFileA it will get through VWIN32 0x001F/ L2 ?0 Y1 d/ |3 |4 `' E* A
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)8 {& t( r9 a5 |! h2 H8 ~
and then browse the DDB list until it find the VxD and its DDB_Control_Proc0 |2 F3 B! F8 t5 y, b6 _
field.
0 U' F4 v, i1 C$ L, J. e. J  AIn fact, its purpose is not to load/unload VxDs but only to send a , ]" Q! _3 {* i, t9 G$ n. _
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
1 V0 O  F  \. p+ y; p9 M# oto the VxD Control_Dispatch proc (how the hell a shareware soft could try  N; W4 e6 \# ]1 N. s* ]
to load/unload a non-dynamically loadable driver such as SoftICE ;-).  ]2 U7 S1 e3 l2 J1 i9 X4 M  ]
If the VxD is loaded, it will always clear eax and the Carry flag to allow
' s9 A5 ~) f) P7 Fits handle to be opened and then, will be detected.
, _0 ~) }- `% x  rYou can check that simply by hooking Winice.exe control proc entry point
0 E- g# d4 a8 m2 R; ]# R% Ewhile running MeltICE.
- e* z6 n! ^+ B- P3 s3 O1 T% j9 ~- M6 A9 r* _

# @; j4 _1 a" G, m' k- Y  00401067:  push      00402025    ; \\.\SICE
( u1 x+ B  o9 K, S% q  0040106C:  call      CreateFileA
! d6 z; q( }0 |/ g  00401071:  cmp       eax,-001$ a  S; M6 H/ _
  00401074:  je        00401091
  h# M, b' t. w# @$ o( A/ b- M6 \' z3 [) O# o" w; Q
. {* M- y1 F: f% M( y
There could be hundreds of BPX you could use to detect this trick.' _) u7 u9 {3 W
-The most classical one is:
- T& O3 O0 m, T0 M8 @4 Y3 W/ _- o& n  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||. G$ x1 b' h4 d* F' R3 t
    *(esp-&gt;4+4)=='NTIC') N! E: R( `4 b- z1 \
0 S. \5 B3 T. A/ C7 P5 W% L
-The most exotic ones (could be very slooooow :-(  t- p8 q+ w7 Y, H8 N7 c
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  5 [# {" t$ d$ O! ^6 G* Y3 `( f7 p, j% H
     ;will break 3 times :-(
1 n1 Q# ]# g  q: \; t7 w& p$ o. w/ V' [: d2 M3 A
-or (a bit) faster: , f7 o$ Q, @: c) x% P9 A
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')2 ^( o0 g" J/ d
3 J, l, g8 B5 ^2 q
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
# w' v. f& Q5 ?* P" d     ;will break 3 times :-(" ]" h& K, S( h# H
6 w5 H, F- L$ ^8 `7 C( S
-Much faster:
, B1 n9 F: P2 \$ b; f   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'6 v( _1 v% @0 l& x
- h% U- Y# ]7 D& J% k& }* v
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen
4 y: M- [" O' B3 y7 cfunction to do the same job:% \: }& O4 a; j) U  b( V
  ]0 O# u5 i# J2 g9 L
   push    00                        ; OF_READ
) L7 C; B3 E' s( {- T( [8 ^   mov     eax,[00656634]            ; '\\.\SICE',0
# F. p- u' E( Q3 Y- ?9 A4 e   push    eax
) L. Q' O9 \6 R/ b   call    KERNEL32!_lopen: C- E9 w* Z7 {: r" Y( \
   inc     eax- n8 p& d/ ^) D4 f7 N' d  E0 P
   jnz     00650589                  ; detected5 V* U, F2 S  C* {$ K1 S) [
   push    00                        ; OF_READ
: i5 w' h5 K- _( L5 e   mov     eax,[00656638]            ; '\\.\SICE'
6 q. \! M1 r7 Z& G3 E- b   push    eax2 J* i, O9 q) p) `
   call    KERNEL32!_lopen8 N+ U/ @6 M& C5 U4 L3 F0 O. _
   inc     eax
3 G; K3 m. g- o0 |7 B   jz      006505ae                  ; not detected
$ J( k) g  o' Y/ Y7 U
5 f1 D  t" k( Q% l4 M
: j0 b$ L' f& [) ]/ }" A4 Z. b__________________________________________________________________________8 h) N% e& b! y/ o+ d9 M

8 ?% n% \4 T1 w' ^5 \& R5 ~8 yMethod 12
+ K; C9 L* A- r6 ]3 e# `) @, z=========
% o! o4 a, G1 o  g) t
% R. ]6 J5 x, `+ \, kThis trick is similar to int41h/4fh Debugger installation check (code 05  I$ v# y4 k( ~: X
&amp; 06) but very limited because it's only available for Win95/98 (not NT), a0 S4 s1 k3 V( U% x) w
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.
" \/ ?6 ^/ f+ ~; U9 E6 D: P) w% W# y3 S. U$ L$ i" u0 d: ~0 R
   push  0000004fh         ; function 4fh
: B" G* N+ Z. U   push  002a002ah         ; high word specifies which VxD (VWIN32)
" r6 D/ V) u( M/ {( `- U( _                           ; low word specifies which service8 B% t. ^" I6 Z  v5 n4 K
                             (VWIN32_Int41Dispatch)
) n+ S* [7 Q8 ?0 A- W& ~   call  Kernel32!ORD_001  ; VxdCall
6 M$ e7 |' A5 q; F/ w; G: R   cmp   ax, 0f386h        ; magic number returned by system debuggers! [( `8 E) G7 Z6 F; f
   jz    SoftICE_detected8 v$ S; L+ v0 h( M0 ?8 t2 P/ {

& M( K! w: z& M! z7 l3 yHere again, several ways to detect it:
7 |! y& H$ Y$ A1 B* M% f( s" L3 |7 K( ^+ @
    BPINT 41 if ax==4f+ _8 d4 u$ k% M; Z0 ~" L" [
1 ^& w, s) d; y2 s5 G4 p# ]- L5 R% Z
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one" O# L. O' `9 F" v* b0 b% k

- Q* ?! d- n5 T) d- s1 Y$ l! d7 a    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A+ K5 a* H; z9 q& z' H
5 T+ ]+ @  h( C0 d; {
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
5 o/ o3 t2 }% K  q
. m3 A/ k- g7 E! ^; j" Z__________________________________________________________________________  ]  L2 ]( X9 ]7 E5 B" Q# o3 Q* \

& A4 ]/ i1 x/ I1 x# f7 f( |: uMethod 13
$ m1 F7 c7 G6 n" I7 L=========
" E) t" J2 G' L, R4 g0 |2 v8 h3 W5 S1 t* u& ?7 J8 Y
Not a real method of detection, but a good way to know if SoftICE is
% v  B2 G# L/ b% G3 Linstalled on a computer and to locate its installation directory.
' D' Z+ D, Q- ~0 z$ vIt is used by few softs which access the following registry keys (usually #2) :
. {) q  v" i% g% A# r2 A6 c
+ N1 z5 n1 s% Y- R-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
# N/ e: N+ X1 R- ]1 ?+ n\Uninstall\SoftICE
4 n1 p( I8 o8 ~, @" R-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE1 Z7 C6 v. `0 G8 _7 g0 J
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
9 m7 |9 U, U( c/ B, p5 w\App Paths\Loader32.Exe8 ~5 i8 G0 E8 b
0 n, ~. C9 G. B& K5 l; H( z

' Y$ K/ n" g1 b& i1 V% D# E4 r2 GNote that some nasty apps could then erase all files from SoftICE directory
. m3 W/ j6 V- l7 v( W8 c) l(I faced that once :-(0 t. U& C: `: M/ x5 e8 w0 {7 L

5 U" v; u. B2 J. {Useful breakpoint to detect it:) T6 P( r3 x; k
3 j( Q& P$ g% h) ]
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
0 ], u8 t$ z+ d3 }2 Y
3 p1 ?; R4 j; S8 q__________________________________________________________________________) c* L9 j$ N, ]2 r( r& o' P
, b7 ]9 i$ ]& S+ ]- w

1 w, V; a+ Y7 j, {  S$ iMethod 14
3 k2 o5 k  C8 H) \1 K=========& F0 a( X! J  R% J

; V' C) c) j& |. W; KA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
* W- l: O# a. ~& r  w- Pis to determines whether a debugger is running on your system (ring0 only).
& q8 w& M- c7 F+ k! Y6 g% i
, V# p* b6 i3 Q# R) ?   VMMCall Test_Debug_Installed9 W, f7 i- q% n' }, y) j
   je      not_installed8 W8 m  v7 O" y5 k! j
4 z* X$ q3 S$ `4 m. e8 U
This service just checks a flag.
7 T3 X4 x. H3 t2 l  p0 U2 L) u</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|本地广告联系: QQ:905790666 TEL:13176190456|Archiver|手机版|小黑屋|汶上信息港 ( 鲁ICP备19052200号-1 )

GMT+8, 2026-8-18 09:45

Powered by Discuz! X5.0

© 2001-2026 Discuz! Team.

快速回复 返回顶部 返回列表