About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
+ ]% f; _; C# A; e/ T4 p$ ?<TBODY>
5 I! V1 [6 E: Q% o# j- q- H<TR>
5 C8 h9 r9 S% U9 y+ d9 T<TD><PRE>Method 01
1 u1 {  e9 d1 [- x! J1 K=========
& U$ k$ V. |( a: s3 k, ~
5 Y8 z0 O, J+ I1 |. E8 h% E) r4 dThis method of detection of SoftICE (as well as the following one) is* S1 x1 j8 |9 n$ x* q1 X7 ~! ^
used by the majority of packers/encryptors found on Internet.5 t9 W* K+ l# X( G3 j, Y
It seeks the signature of BoundsChecker in SoftICE* F# g1 N- S6 q
$ x/ f! S/ m$ Z4 x
    mov     ebp, 04243484Bh        ; 'BCHK'
, N: C. h: C6 v* e+ u+ g; I    mov     ax, 04h: ^4 g9 D+ w$ r  Y: n
    int     3      
4 x6 L$ ~& \8 I; ?    cmp     al,4
% l: O2 }& V- ?3 ?( v; U1 n. `8 p    jnz     SoftICE_Detected& p$ z$ i& O2 q6 Z. z3 S

, e8 j' m  W& K  t, j+ s" e% l( x___________________________________________________________________________
2 o! S9 @/ @. G3 t1 G  {
- D. v7 X9 J2 W  {% K2 N# fMethod 02  h9 P7 M( @6 K5 U  D% T
=========" w+ r$ n0 E: _! N4 Y% b

" ^; [  `* |# t. n- v! o6 r6 mStill a method very much used (perhaps the most frequent one).  It is used3 q( V% F' V2 x% p) H" [
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,( C& P9 H; V/ Z, p. t
or execute SoftICE commands...
1 D5 y! s! [3 gIt is also used to crash SoftICE and to force it to execute any commands9 {' @) A- @* b; _' e" h1 j; t6 @
(HBOOT...) :-((  + \( F* [1 a: X# o- r3 d3 m8 ]$ i' {
! ^& W0 D$ W, k3 L. \. ?1 I
Here is a quick description:
3 N" ~8 }+ \: |5 E) \  b' n-AX = 0910h   (Display string in SIce windows)8 z1 o9 u, e% Z7 d6 z6 h
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
9 S- l, }) U4 Q' Q5 G$ t1 w-AX = 0912h   (Get breakpoint infos)
1 w: m' ]( G; R# Q9 c+ M-AX = 0913h   (Set Sice breakpoints)
1 D5 ^& @" L* w+ r" l-AX = 0914h   (Remove SIce breakoints)+ l( U  M0 O4 _1 t: g4 Q
, I! B8 i& x" z/ s
Each time you'll meet this trick, you'll see:, L  u( n; o  h% |
-SI = 4647h
% d4 s2 j4 d8 g" ^-DI = 4A4Dh
+ c+ c$ K* F& G, oWhich are the 'magic values' used by SoftIce.
4 n( c$ Y" F0 K) a+ t+ Q# HFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.# y) o! A/ I. ?0 C: Z/ ^2 Q
- U" Q5 u0 F6 R# [4 j+ r8 p3 E" J
Here is one example from the file "Haspinst.exe" which is the dongle HASP
! Y- m' H: l2 m  x& gEnvelope utility use to protect DOS applications:4 A  U$ n3 \9 o. L

6 b2 e# b  ~1 t3 E& e5 }, ]
2 L/ z2 X1 h; m) t& A3 c- V4C19:0095   MOV    AX,0911  ; execute command.
8 ~! H# Z" `$ {+ x; u) [4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below)." c/ [- `, Y. j
4C19:009A   MOV    SI,4647  ; 1st magic value.
9 _2 ]8 x5 R2 X; Y& z* G4 O4C19:009D   MOV    DI,4A4D  ; 2nd magic value.$ ]- y/ N% x: L7 `; Q4 K5 Y8 W
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
, A* N* E: }/ _4 R9 |1 u4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute" |  Q, v: e; p* c
4C19:00A4   INC    CX
* f" h, v$ u$ m" s4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute% B+ B: T/ |7 Y1 A& Z
4C19:00A8   JB     0095     ; 6 different commands.( J. I. B) x/ b( Q9 y. X: j* @, l, Q' y
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.+ [7 S: H) p! k* f# \
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)$ `  d5 W! k* x0 w' M
( k5 [, @# @5 e  w+ ^4 l
The program will execute 6 different SIce commands located at ds:dx, which
1 ^- c! f5 l8 t. \are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.3 r* U+ f1 k* i9 J/ I
2 X  _" G9 w. f- x( `
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
5 G0 C; j' b$ n% A/ k) P2 e0 U2 f% v___________________________________________________________________________6 r# e$ {+ l0 e8 l
  e# K9 s# H2 d. h
0 `& B4 G0 W% c( r  c8 d
Method 03
2 w2 C$ E0 y" x* D+ n  O=========
( i8 p* V1 d/ q1 D
& A$ d: }3 y4 p  Z' }% o' iLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h$ R2 \4 F& s1 @
(API Get entry point)6 N  m" ~4 o% q+ a
        
! Q$ y; f: _9 M) `# x5 |3 Q4 O. L4 v: |  w) U: ]$ ~
    xor     di,di. ]3 f3 z" X" E8 e+ V* U6 M
    mov     es,di' S; Y! Z9 `+ b) h9 M1 D7 H8 S) f
    mov     ax, 1684h       - c" g. Z, |2 P; b5 `4 r$ x
    mov     bx, 0202h       ; VxD ID of winice
2 p- C+ _9 M) ?2 |  q    int     2Fh, i+ @* j% B% w' O" A$ r, v
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
7 P- U6 j% s" g* N; r" Q8 {    add     ax, di
8 t" N1 L" j5 p, J5 }, Y    test    ax,ax7 T! G5 u1 k( Y2 S9 F
    jnz     SoftICE_Detected4 R7 |7 D  _) r  m( S
3 t1 G. S* u( l; a
___________________________________________________________________________
  s! i5 K- z, x+ ^) w( o0 r2 s1 \3 `; M) b) v' h- q
Method 043 O$ C/ Q& s' v5 v' C
=========# t' U+ w* [2 e
8 i. S' ]  X0 ?5 e
Method identical to the preceding one except that it seeks the ID of SoftICE  c6 ?/ j# _, N# F, B& n2 O
GFX VxD.4 [6 H4 r0 a, a) D

3 d2 B7 q& N# [' w! q) j1 H    xor     di,di. M- {" E1 e* d) o4 k1 x
    mov     es,di
: E1 `1 l6 D' ?3 h+ Z4 t; _0 v, a! N    mov     ax, 1684h       2 M0 ?1 B  O8 C: B; R
    mov     bx, 7a5Fh       ; VxD ID of SIWVID
% p- U3 `$ H: b( D) B    int     2fh
, \$ L3 q( ~4 D    mov     ax, es          ; ES:DI -&gt; VxD API entry point
) Z( \" J" l) F  |    add     ax, di
( t. x1 u, ^: {/ ?4 m3 {- S    test    ax,ax$ I! {6 C% j* M6 e- A
    jnz     SoftICE_Detected) `1 g$ z# l/ w5 J
9 |% ~( `  G4 x0 W" x9 D
__________________________________________________________________________
! ?! Z9 `) l- W
/ M1 O, f% Q) c0 ^/ F; T
  P6 ?" [) u0 N, n) a6 IMethod 05( i  w0 e( E8 Z" K+ s8 M
=========$ N% R+ G. {; T- h

# O/ P+ V$ O% @$ E& Q7 mMethod seeking the 'magic number' 0F386h returned (in ax) by all system
) }. Z( P& H; A! Hdebugger. It calls the int 41h, function 4Fh.# d( m+ k- J0 w5 g. h
There are several alternatives.  
2 p( M) u0 I/ U# I% ]( Y; h" G8 D% K* `2 M
The following one is the simplest:7 j6 N: D1 K3 U  c' D3 L/ D- g' W

/ ^; k6 p( N- _2 Q- P    mov     ax,4fh' ^$ j  S( P( p, |. L3 `
    int     41h
# _! a, d2 S: k/ g    cmp     ax, 0F386
1 o" ~1 `; `+ E3 h6 Y    jz      SoftICE_detected
8 X  R* `" w$ ?: ^' y  }8 @9 p/ p+ ~
' l* Z+ q- g2 _! w/ F% T# v
Next method as well as the following one are 2 examples from Stone's 7 r- y; @5 ~1 K: E7 W# T/ O1 N
"stn-wid.zip" (www.cracking.net):
" n4 `$ G# S- D0 K1 d5 F4 t2 }+ S0 j; l: B' I
    mov     bx, cs
5 l: ~1 [8 x' m) O% S    lea     dx, int41handler2
8 Z# |+ q& W2 l; \! }/ ^' }    xchg    dx, es:[41h*4]5 \% N; x) H( y# L" g7 q2 Q1 B
    xchg    bx, es:[41h*4+2]
* I2 ?$ n4 w# n/ B, z2 f    mov     ax,4fh
) V+ j: o3 |3 C& \. u' U4 m    int     41h+ {( E! G. |2 F7 T1 p
    xchg    dx, es:[41h*4]
& P  B  K: B4 y3 \    xchg    bx, es:[41h*4+2]; G! t8 J0 o) ^4 o& T* ~
    cmp     ax, 0f386h5 H2 W* O6 A+ o5 D2 p
    jz      SoftICE_detected& D- D8 M5 }2 w! {" Y

' J3 t: I9 T+ o$ yint41handler2 PROC( \1 N: Q( W, P9 u) ^7 ?
    iret
4 {& _* G# E; W) r4 G2 ]0 ]5 l9 {1 hint41handler2 ENDP
' R4 J- Q6 Q9 T
. u& |- H) X  j
) O4 T* c' T* \, a: e, i_________________________________________________________________________
5 U* x, m2 P0 t4 ]9 m, q- ?8 D/ G6 Y8 T2 N) I- o6 J& Q8 `+ Q! S% B8 W
4 ]& s/ Z1 I# }
Method 06: L, Y% Q* n- M* Y- f: s
=========
9 ]0 X7 P. `+ v; w
( v! i9 c$ I/ S  E4 W  }: x( j" m. A2 [( ]
2nd method similar to the preceding one but more difficult to detect:
7 x; U+ W6 Z! x$ s. Z! I. u% `9 D+ f5 e/ @) l3 A: u- M) P7 E

# r/ Q/ k" c3 @! fint41handler PROC2 L* f# e" b" o8 [7 I8 `$ _
    mov     cl,al' T5 g4 L- E# L) N
    iret+ M, {8 F* N' u: }, ^
int41handler ENDP: X" m4 ]) J& b' I  Q5 g; Y
' v' O! J8 e; H/ u$ {8 s# p
, y) l6 x* P; R4 n* f
    xor     ax,ax( @. x+ ^, r! ]& w2 o
    mov     es,ax
  h. G- N* B( A  [# @9 }# U4 B7 t    mov     bx, cs
: {* c4 `; h- b" l. f) Y    lea     dx, int41handler$ C  j; y0 I) p/ [* i
    xchg    dx, es:[41h*4]0 C+ N% N$ W# v; p, Y
    xchg    bx, es:[41h*4+2]
/ J% z6 Y! A  }4 z8 ?' \, K0 M8 b4 u3 P    in      al, 40h
. Q8 H* z- A0 V: S    xor     cx,cx# F" `" M; `3 b5 ~
    int     41h8 M' u) h3 l. g% X8 G
    xchg    dx, es:[41h*4]
0 G' o/ A6 i6 g" k    xchg    bx, es:[41h*4+2]# I" r& i- V3 g
    cmp     cl,al
# c' `$ K+ p" `( W" c* W6 }) Q    jnz     SoftICE_detected
1 F) h0 r- v- h
2 ?3 W9 Y9 ^7 F% i3 o_________________________________________________________________________1 e1 O5 C- |8 ~# t1 o3 G' i% r

# B: h# X- ~6 f  n: }: x8 }' UMethod 07
" c# q, |9 V4 |( M=========
7 E9 [2 s; b& _# T
( C1 ^. ~9 D1 GMethod of detection of the WinICE handler in the int68h (V86)) \8 U3 M8 H# _7 U9 v5 ~0 E% f* ^

5 y  N7 O% c2 D# R1 t* o% I    mov     ah,43h8 u  i$ f% N2 x0 `/ m  }# Z9 S
    int     68h0 u& j& h* G/ B' V, R. O6 i4 u
    cmp     ax,0F386h1 z: w, I! R. N) y7 @6 h  |
    jz      SoftICE_Detected
3 B$ z( c: z% r- T; y; \. x, w; R; _6 ]. H( }9 G: X2 |

% B1 N. L  q8 M/ {" B4 m+ x- e# ?=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit' [6 b; E# e# [/ R3 G% N
   app like this:# ]- [4 Q% X' A% i3 b) M3 |& D9 c

! S1 m, \& U* k* O0 L   BPX exec_int if ax==68% R' H% o( g% G8 ^- Y% j8 _
   (function called is located at byte ptr [ebp+1Dh] and client eip is+ Z7 {8 W4 u, o8 d
   located at [ebp+48h] for 32Bit apps): W1 U+ D; @, i$ m1 b
__________________________________________________________________________
3 n8 a. a. ?) W' M+ ~
9 Q+ Q9 ?4 x* D, ~" z$ l; l4 c$ R+ P# a6 n. @
Method 08. w! s: v$ l! F- m6 y7 x; s" Q
=========9 n- d" ~( b2 d4 {

* q, o  L# B! KIt is not a method of detection of SoftICE but a possibility to crash the
: i$ y5 |0 r0 ssystem by intercepting int 01h and int 03h and redirecting them to another
9 _  K6 V7 H: ~2 _- r* yroutine.
. p" w4 G. I8 M7 n# KIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points' Z' D: r% y( Z& S3 P" m
to the new routine to execute (hangs computer...)
9 t6 B6 R7 u8 [/ p$ `( j- D" x* r& d7 `3 Y! I- _/ A
    mov     ah, 25h
0 E3 G3 m7 s7 ^1 |+ Q% M; _    mov     al, Int_Number (01h or 03h)" U2 E" C6 |$ o/ L' U. O* i
    mov     dx, offset New_Int_Routine
( D" e+ `0 |  z/ o7 B    int     21h* }& j% A. \5 q

. ~- F9 o5 c/ U6 q1 `0 ~3 o8 ?  S__________________________________________________________________________/ v" ?$ [9 Q& C# Q
' B7 `  n. k- g# h- ~3 ^" M  m& W2 `
Method 090 K8 a$ t0 G' o: X" H* W
=========3 u3 d3 N: U; h% ~1 T; _9 Y3 C5 v

) L3 X# v/ T" r5 C/ d% f6 DThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only% M9 E2 O) ?9 J: h- j7 z
performed in ring0 (VxD or a ring3 app using the VxdCall).
/ g0 s* j' G3 ^( wThe Get_DDB service is used to determine whether or not a VxD is installed+ [  `7 A5 E$ T3 ~
for the specified device and returns a Device Description Block (in ecx) for
, A7 ^6 r# g6 J: z  {, {. Tthat device if it is installed.0 C+ Q1 [6 [+ P

& C8 g4 w& [: b/ u4 w   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
$ v# n& W) U, {2 g& f9 X" k6 R. o   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)8 T+ ?+ e' \; K* J/ w
   VMMCall Get_DDB& G" m. C  P: e. `4 b, z0 k9 |
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed; N- m2 L, M! {) c+ u2 V

( m! M) ]; v" FNote as well that you can easily detect this method with SoftICE:* [$ \6 }! E! J: {. M$ s. j
   bpx Get_DDB if ax==0202 || ax==7a5fh" v9 Y0 z& w9 ~" f; z

! ?$ V- C7 _# S3 W0 ~__________________________________________________________________________
9 ~& D4 y+ `2 y4 W7 b; E) m9 x, e$ y$ s
Method 10" m/ N8 I. K& P: @( J/ d3 s
=========
' r6 j" l  j0 ?9 h
6 Z! r  |; n% F=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
5 D1 Q1 ?9 s' D( c  SoftICE while the option is enable!!
2 N4 C: e7 p/ ~; W; U, }' L; d- J) b, o/ p1 I4 X  g
This trick is very efficient:
: i5 w( M' e" L7 W7 j' Gby checking the Debug Registers, you can detect if SoftICE is loaded
6 e: p. Y3 M! d; ~+ w4 ~1 c) @+ V(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if5 y/ f; `# N( L* {: ?3 d
there are some memory breakpoints set (dr0 to dr3) simply by reading their
. e) @) j! }1 i( lvalue (in ring0 only). Values can be manipulated and or changed as well7 K( P% o; e! N- Z+ a: E
(clearing BPMs for instance)
3 g' _0 V6 z% G1 {6 N
* n% u4 u' N; l6 u% P' y( ~__________________________________________________________________________4 ]% k6 h* h) g2 Y4 {" s& }- g

9 A" R# b# E9 s1 Q, d7 H( ]Method 11
- H1 k1 l& e" y+ ^6 `5 P# A& ?# ]. \=========' p$ l$ \! {3 B. T2 e( d
. }' {4 F4 M/ P
This method is most known as 'MeltICE' because it has been freely distributed
2 M1 ^0 n, g' [4 hvia www.winfiles.com. However it was first used by NuMega people to allow2 m2 t# A' L9 R( S: u1 ?
Symbol Loader to check if SoftICE was active or not (the code is located
, `9 r- Y* ~  einside nmtrans.dll).& K$ g! \5 g2 X2 v+ _% s

* G: r/ j, |) n- \7 R. |The way it works is very simple:/ J7 u; b- H2 e7 Q7 |' i/ y
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
4 t. u6 v* o  p/ OWinNT) with the CreateFileA API.
3 W5 B: n/ V+ W* a6 u+ X$ `3 [' t
  \9 b, M/ Y7 w2 l7 qHere is a sample (checking for 'SICE'):
( O5 O; ]- {! ]. o
: I3 N. h. q7 F5 W/ sBOOL IsSoftIce95Loaded()
0 [' L8 P; d" N* ]6 v3 a2 D{
+ l, I" o7 b- |  L& p8 C, B   HANDLE hFile;  
2 L1 g( e* R- C! l- P: T   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
0 \' U4 a& _( I+ `                      FILE_SHARE_READ | FILE_SHARE_WRITE,( G% k0 ^* U& h: S, ]' }
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);& u% K- Q2 X3 K0 p' C; L
   if( hFile != INVALID_HANDLE_VALUE )
) ^5 Z$ M- e" W6 ~   {  X7 |7 G6 w- I1 D# E, G
      CloseHandle(hFile);
6 i0 B9 c& ~1 T) X      return TRUE;
  h- I: q% M% y0 K' x; N8 H0 t2 h   }7 |/ k0 a1 k7 s- Y( Q2 x/ a
   return FALSE;
/ Z2 H- C$ a1 I" Z, D}
6 H$ P9 e3 j3 M! |. t
3 v+ R: c4 ~- NAlthough this trick calls the CreateFileA function, don't even expect to be% b6 o: M$ x, J- ~% ^! Q  @
able to intercept it by installing a IFS hook: it will not work, no way!
; _5 a- [: C6 s$ xIn fact, after the call to CreateFileA it will get through VWIN32 0x001F+ k. N: ~$ G! C0 v
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)1 V0 ~" \8 Y" z, A3 f
and then browse the DDB list until it find the VxD and its DDB_Control_Proc2 @# ^. i* x3 q
field.
) s9 w; h& s  Q6 r% {! g+ \" @In fact, its purpose is not to load/unload VxDs but only to send a
+ [" F4 t$ ?6 p6 kW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)  S1 b  |" s0 ?/ H
to the VxD Control_Dispatch proc (how the hell a shareware soft could try
* a  q% p+ y5 A- ~! Gto load/unload a non-dynamically loadable driver such as SoftICE ;-).
1 E  s( @2 N& u6 k6 OIf the VxD is loaded, it will always clear eax and the Carry flag to allow
1 h- u# X# S6 R1 h; Z, }its handle to be opened and then, will be detected.
" R  G1 U6 F8 D( \; W& oYou can check that simply by hooking Winice.exe control proc entry point) P; y: O) S6 B! m
while running MeltICE." l4 I$ L6 f; k! v; k3 O
7 w9 J  W/ a/ D/ ]& Q) E
. R3 M: s8 ]4 j* n2 N: \5 s3 X" K; g
  00401067:  push      00402025    ; \\.\SICE
( k4 y3 o8 }+ {5 L- C- m  0040106C:  call      CreateFileA
' q& Q2 s4 O" ~! t1 _  00401071:  cmp       eax,-0016 Z+ H, ?$ B. \
  00401074:  je        00401091
: p, |% X3 d! ^  k1 F8 j
. e9 _0 {" x* p9 I
' W# F. X; L' sThere could be hundreds of BPX you could use to detect this trick.) i6 g7 m+ K, ~' M
-The most classical one is:
$ U6 |& |9 M: j1 m8 k  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
8 x3 e0 E. W7 h& H( d7 {    *(esp-&gt;4+4)=='NTIC') x( h1 @8 w, D/ i. t: ]! D
9 k6 h6 M* I2 }3 Q& {( u
-The most exotic ones (could be very slooooow :-(: ^" [7 Y9 V. Z: A1 `
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
* y0 @# P% _$ L5 {% i! P& B. o) J     ;will break 3 times :-(% e; p1 i$ u6 d5 H" P! I- t. s
+ Y) |% L" R0 m) N9 B
-or (a bit) faster:
( P! b& ~6 i2 l   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')9 F' f6 _; m- m9 n/ F* V
- h5 U" i( w7 O* z" I
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
2 ]5 W  w1 o* g8 N8 y     ;will break 3 times :-(& _6 v3 u) a. ?( ~! B

8 V( q1 E  _9 n# `% E+ w" G-Much faster:
' i& c& X5 e8 a3 z. |   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
7 R" l0 t8 ]' ]
8 m$ @( P0 K: x- O) `Note also that some programs (like AZPR3.00) use de old 16-bit _lopen6 J  s0 q- K2 I. {
function to do the same job:- C( S$ o, S& L% f% d

% U9 u4 {! @* h' F   push    00                        ; OF_READ
; s7 l+ u' e$ j: G7 H6 n( j   mov     eax,[00656634]            ; '\\.\SICE',0
! S. F" a( S% P   push    eax3 i+ i' f% y- p5 T2 S/ ]+ W9 Z
   call    KERNEL32!_lopen. ~/ F) l( a1 j& G8 e! d& y
   inc     eax4 }; ~$ D' d. Y) Q
   jnz     00650589                  ; detected
9 F, E5 r, W6 v! G$ ?2 h   push    00                        ; OF_READ" V/ Y1 p2 g. E) C
   mov     eax,[00656638]            ; '\\.\SICE'
7 ?  w& s2 Y9 m+ ?$ L4 k   push    eax
& @* _, }  @5 d  L: A   call    KERNEL32!_lopen
3 F/ f& e& K& P   inc     eax. Q' b( O8 C" i+ d, X* q
   jz      006505ae                  ; not detected; U( ?0 a" H8 j; Z- ]# s

( o) Z. ^7 L0 Q! @( |: {
4 N% \! `# O5 v7 G$ F__________________________________________________________________________
" a) W6 V& X# C# p/ Z# v, o2 ]& K  R& e/ g" L0 T
Method 12
6 ^' O% O. J) R# ]  F  U6 ]=========( `# K! U2 f' G: @/ E2 ?
& L2 ~& R* S# {& H% H1 f/ b
This trick is similar to int41h/4fh Debugger installation check (code 05
# j+ g, K! ^  }4 A&amp; 06) but very limited because it's only available for Win95/98 (not NT)
2 [. z6 r( k5 p4 ^( _as it uses the VxDCall backdoor. This detection was found in Bleem Demo.3 i+ ]: q- L8 Y
& ~5 j. y0 i" G# O1 }) @9 B& q
   push  0000004fh         ; function 4fh
( w. Y: ^6 \8 [   push  002a002ah         ; high word specifies which VxD (VWIN32)
# W% a5 q* U4 ~9 w- }* s, X, u8 s                           ; low word specifies which service( f" C3 l  k( V  ^4 V) @6 [
                             (VWIN32_Int41Dispatch)9 @  }% D- a: ?1 R3 u1 D6 \# K8 h
   call  Kernel32!ORD_001  ; VxdCall0 T' g* T( K; {- g; l! F: F
   cmp   ax, 0f386h        ; magic number returned by system debuggers
$ }3 T- W% N. Q& j/ \8 Z7 a& j  Z   jz    SoftICE_detected
, Q# @! p$ e. b4 i2 D5 D( N. w2 ?2 v- Z9 s% S
Here again, several ways to detect it:2 U& e% q6 x- j, L6 n4 [: r# }
. t7 n* e/ D) r; E3 R
    BPINT 41 if ax==4f
; ?$ s+ G9 }% i
; C4 ^  h1 F5 T) L8 I, [6 k    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
9 w* c4 S% g/ O  y. P: T+ x/ p3 O3 K. {' D6 r, f+ y
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
9 {$ D: [( W4 Z+ M
% J5 F3 S; K: s4 Z- Q# e5 B    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
6 U) W9 Z' D# \1 S$ Z; L; h0 e2 n* k
__________________________________________________________________________8 k0 s1 y. H/ k0 `9 h2 I
  B5 Z3 b' Y9 x0 p. Y
Method 13
+ M4 m" t& P% F6 u! t=========
; f4 f- x! e2 L) m4 \2 `
+ z6 C! G3 T1 C1 o3 E" t8 qNot a real method of detection, but a good way to know if SoftICE is
# j3 H# o5 `" Jinstalled on a computer and to locate its installation directory.7 h+ b$ Q. i" {! Y/ w* m9 ~
It is used by few softs which access the following registry keys (usually #2) :
- |$ k3 V! n% i5 K' d7 u- w/ G7 T, o/ n4 P' ~  n7 G$ c2 f
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
/ h& ]/ }$ y9 b\Uninstall\SoftICE# t0 s/ j$ L1 ]- V) O
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
5 i5 m& l) {8 \& H-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
2 A2 m) x; \  v- d' ]4 k  o+ {# n8 s\App Paths\Loader32.Exe
) j2 w2 E( Z2 \: a( X" @6 u7 Y& i% e4 l  l' h# F+ _' w

. a8 ]- o' N1 \0 f9 oNote that some nasty apps could then erase all files from SoftICE directory
4 V% `* k0 G: Z+ Z  q2 D(I faced that once :-(
, ]# Y& y" a) O- T
9 _" T1 y1 W$ [Useful breakpoint to detect it:+ g0 f- C( P0 A1 d5 G

6 L& K' n  J* F     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'3 r+ m  G( D) X! C
+ ^* @( B. G4 o! m- Z+ ^# n- q
__________________________________________________________________________. ?$ k5 J# E3 B) ?- ~8 e* z

4 ^( T3 V$ L$ Q& v( S4 _. t5 M& `" q) @+ ]) Z: a6 u* _
Method 14 2 i3 W, w" V2 `7 }
=========6 I9 p* S" [! \
3 g6 f9 a, i4 g+ y1 Z1 p. V
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose- d" T* x" f1 E7 \
is to determines whether a debugger is running on your system (ring0 only).
# m6 C/ t1 ]8 @8 S( b/ }% d+ V, v8 C1 }
   VMMCall Test_Debug_Installed  B, {5 |$ u1 N3 h0 J
   je      not_installed/ O" L( X0 S1 @4 j9 n- d% b

+ {% r) J# T6 B2 V/ W, {This service just checks a flag." }% {- c6 G+ y/ v% _( a
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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