About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
3 c; v" \* }$ @# e<TBODY>8 A8 V  }4 K! i9 H
<TR>
2 B$ `# ~! U; J) y# y7 U<TD><PRE>Method 01 6 N  T" r. s' \: K3 G$ H% H
=========
$ H1 H* f6 H9 R& w* S% |8 x3 u- h; a% D! M% e
This method of detection of SoftICE (as well as the following one) is
. l1 ?, Q& i: q* B. p5 Vused by the majority of packers/encryptors found on Internet./ v" H$ j7 s! U5 C; P4 ]& N% s
It seeks the signature of BoundsChecker in SoftICE8 Y( U# P/ L. D2 y1 L3 R9 q, v
0 s" o8 V  T5 g3 a! K7 b
    mov     ebp, 04243484Bh        ; 'BCHK'
5 a8 p2 A) a5 _$ `, d1 g    mov     ax, 04h6 o& ^8 k, O" D) _) a5 t3 S
    int     3      
; W# t' _* X  m* y/ l    cmp     al,4
% s* o) {# }$ D; S0 F    jnz     SoftICE_Detected& G, W) t" ~& [) h( ~
$ l, U( R$ `, O
___________________________________________________________________________
# h: G* |! V# q4 S) g( F
1 X8 _( e3 _: NMethod 02
/ H, T$ v* K7 b3 W, B=========
* ]* w, c' v  x6 ?' @8 z
% b1 K! N# e  B' Y! K$ lStill a method very much used (perhaps the most frequent one).  It is used* n) ]* @& j9 [0 v' O  [
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,3 m$ z! u3 K; K0 o
or execute SoftICE commands..." s9 i; V( C" \" ^# g2 [" v
It is also used to crash SoftICE and to force it to execute any commands
9 \. ?" A6 W* M+ v- u0 W0 Z(HBOOT...) :-((  , n" F/ u/ B" r7 Z

) v3 `$ o$ R0 L% i, ?" MHere is a quick description:& a: e* Q! A  [9 A/ ~8 o% |+ k
-AX = 0910h   (Display string in SIce windows)& B  r1 r% ~$ l: `" ^
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx): j) T4 M5 f+ b' y$ ^
-AX = 0912h   (Get breakpoint infos)
1 S+ `  M6 q1 U4 a3 `-AX = 0913h   (Set Sice breakpoints)
: R8 X0 T( {1 n-AX = 0914h   (Remove SIce breakoints)4 h% u+ [1 r/ S5 y  _
6 @7 I8 s8 a0 g9 C8 R, K: g! B
Each time you'll meet this trick, you'll see:7 q  L5 F  ^! A$ q' ?9 q# O
-SI = 4647h
3 n0 e% s' r2 T1 E( }  I1 f-DI = 4A4Dh' @/ R( _/ i6 J! I1 r
Which are the 'magic values' used by SoftIce.
' Q7 @7 o- `6 r! lFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.0 w1 d* b1 R! t) `

1 i1 d" O( [/ z& @+ qHere is one example from the file "Haspinst.exe" which is the dongle HASP8 O' L' K% d, b5 ]; s; L
Envelope utility use to protect DOS applications:
' }. Y/ }+ ]' Y+ h; E# ]) g+ }# L" ^
2 n1 V  C$ l+ B7 J
4C19:0095   MOV    AX,0911  ; execute command.& Q- r& G( T7 d5 W
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).  c1 O& p' D6 [" e! \7 \2 M
4C19:009A   MOV    SI,4647  ; 1st magic value., I5 n  q3 d2 H' T
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.$ d& i" R- T+ S$ p2 S
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)! \" u% S6 a: p/ |9 h5 F/ s
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
: W9 b* q! e+ t- ?- z4 i5 e; c4 H6 O4C19:00A4   INC    CX
/ O* n) C" j% Z1 S  N: D4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
* F2 }1 g3 g; A3 d* q: w' i" s2 d* I* S4C19:00A8   JB     0095     ; 6 different commands.! @1 H* f: h$ y
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
7 n1 v6 z: R( \: A7 r4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)5 ^% u* p$ E$ H. |- c, z& `

# n7 Y1 [. p: O" nThe program will execute 6 different SIce commands located at ds:dx, which
* R: S) L8 W& E0 X6 q# V6 T! Gare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
3 M3 F# L& _+ k% o% C0 C! N8 a
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
% @: F# p1 d8 }! @" L, v___________________________________________________________________________
5 X6 v6 K9 d2 o; Q
% y$ u( z! y6 O8 P* }) U; L
3 X, L7 B: b; C. h0 c1 T* K' FMethod 03
( T2 y" I) e1 W: e' L; g, x=========
/ r! ]% V; N' U8 Y- m/ v
4 W/ M1 k$ Z1 J2 d% j5 _/ YLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
' ], u) [/ O* f(API Get entry point)
& q  V$ {& {- m) Z, x        
5 `# N  f: ~+ G& H; f/ i; y+ L. S$ A5 U% O9 S# o- G6 c$ b
    xor     di,di
$ n; ~: |( h8 n4 B. P5 X    mov     es,di
# b; H/ {+ A" R$ E/ ~    mov     ax, 1684h      
# A4 k# k) n8 u+ g4 o- b) r    mov     bx, 0202h       ; VxD ID of winice& K" q7 i. g+ z: S5 `: d6 D
    int     2Fh
7 c5 h! q* @7 s+ H6 q8 q8 P    mov     ax, es          ; ES:DI -&gt; VxD API entry point
& Q3 u7 |# C* A7 o7 H: n    add     ax, di
: @- b: ?& n1 ^% z4 I, y. I- G. O. p    test    ax,ax" b8 ~! j4 {  n
    jnz     SoftICE_Detected
9 F$ c( g/ N0 U! N( p- V: ?) D: V: J, O# m: }4 [* P
___________________________________________________________________________
7 T  u) D5 x- r9 i
" U$ e" h1 t  f: s0 JMethod 04+ m/ l5 @9 r5 E5 ]% Q
=========* `6 J5 F+ S' ?* U

- ^& k5 m$ I1 A: C1 l4 v6 _( GMethod identical to the preceding one except that it seeks the ID of SoftICE/ H* ?# ]5 ~/ A; N- a. q7 {
GFX VxD.
1 G2 |0 O% K: @- d+ b0 J, _2 e" A6 }- |  {9 w# s, K
    xor     di,di
7 _' W0 ?1 _. j- U    mov     es,di
1 H  X! {8 O7 |3 k. w) {    mov     ax, 1684h      
) K  i/ b' u2 p; n! b3 c    mov     bx, 7a5Fh       ; VxD ID of SIWVID! ~7 _- e9 d  F* K' O5 v
    int     2fh+ ?, V4 K/ T4 C! K1 v$ ?
    mov     ax, es          ; ES:DI -&gt; VxD API entry point! B4 y2 q% }# g0 H
    add     ax, di
+ Q0 N6 D+ i( p+ K    test    ax,ax' Q2 b% |; W& c7 U
    jnz     SoftICE_Detected. _( I' G6 c1 L6 h9 o# E

. m7 G& T* G4 r0 X/ o6 a__________________________________________________________________________
: _; v1 E& p, K5 H3 ~2 v' k# y1 S
/ U/ v  o( w) `5 f3 p% m% ?: ^/ @
) W% \& X( |8 x5 ?3 \1 ~Method 05$ M+ p( L. A5 w/ p+ H
=========! ~$ \2 J% N  D
; ~) [4 R( {& w* S3 T4 R% O' o
Method seeking the 'magic number' 0F386h returned (in ax) by all system
' u5 V" K$ f& J3 Kdebugger. It calls the int 41h, function 4Fh.) B" v3 n' a+ P+ R* K" h' J8 N, h
There are several alternatives.  
5 \5 D" U1 ~1 _3 u' ], H/ W8 e) f- j2 _: ^- R: t/ o2 f! o
The following one is the simplest:% M" r4 C4 o# }
, ?7 l# t% h( t+ _  |
    mov     ax,4fh
7 G+ r$ _2 J. C% k/ l9 u7 R    int     41h8 B9 M; w2 P1 n9 s) y1 Q
    cmp     ax, 0F386
# q8 M. c3 o" [    jz      SoftICE_detected
/ f* G0 Y, P6 z! s# X8 t" G3 A5 \& W0 f) ?' R, E

  V7 ?) [+ \5 ^$ {% DNext method as well as the following one are 2 examples from Stone's
& R' K5 \9 w0 _"stn-wid.zip" (www.cracking.net):" R2 T; ?2 B; `7 A9 g

- z% d0 \& E) ~4 t% Y9 n    mov     bx, cs6 z/ L+ @$ c  A0 o
    lea     dx, int41handler2& W) _8 o5 ^( w" G! B& h3 q) J3 V
    xchg    dx, es:[41h*4]! |: J/ |* \, w4 F: N
    xchg    bx, es:[41h*4+2]# s- |3 m: \2 `+ a9 t! U
    mov     ax,4fh% p' J1 {3 R- Y) b" r" M, b
    int     41h  Y5 i+ B, H( ^! B5 ?$ c- m
    xchg    dx, es:[41h*4]
, @( V# b  i4 L# u% L    xchg    bx, es:[41h*4+2]
0 G$ V; r/ G8 [) L9 N* ?    cmp     ax, 0f386h7 x/ l8 M* x4 x" m& X6 J# [$ O
    jz      SoftICE_detected
# Q$ f5 p' T/ w- u$ x  S0 @& V
2 S0 u  I/ d( \int41handler2 PROC0 }& V% {% ~1 A& Z; y, q+ A$ X0 ?2 I6 G
    iret
, T9 E" u8 i4 Zint41handler2 ENDP
6 d7 T& V$ s5 W7 J# n) q  L& x# z. M+ `) E- Y$ ^7 k* v) {
8 k/ g: L' V, C1 D5 ]( }5 A
_________________________________________________________________________+ r6 A9 n" {4 I/ a1 c! @6 L0 z
+ W6 C. ?* u7 u6 q* w; E
9 U6 S0 o' [  M- J0 S
Method 060 s* }, B& Z- L) {2 b
=========
* W9 Q# |9 \2 {6 C( {* q7 ^
' k9 Z' N' F1 v" \# R7 _: L$ N$ j
2nd method similar to the preceding one but more difficult to detect:* a, L9 t0 `4 _- q
4 k; f8 @& [6 M  l1 u' L' ^' p/ }

( a  v! e5 [- _# X: Y6 {int41handler PROC
# C% Z. X! u) t) x1 h. o, O    mov     cl,al
. U0 i% t. F9 o( |! `    iret
: S9 g- y. n' S8 s4 Rint41handler ENDP
& K" y4 t+ H) }) j
  u, u/ }2 k0 ?( n: w7 Y# D  U8 c. P. o( q& T+ t( ^
    xor     ax,ax
3 |6 a0 Q7 s  ^' P, d3 {9 H. A    mov     es,ax3 x* S* U$ o1 n: A  S  ^
    mov     bx, cs' e+ M% P  [+ X5 T
    lea     dx, int41handler8 X  {* K* w' t  {1 L. C- t! Q
    xchg    dx, es:[41h*4]) d( m7 \8 G$ L
    xchg    bx, es:[41h*4+2], k$ i" Q) b" n/ L/ b
    in      al, 40h
1 A6 O: z( l! p! l8 }5 r8 J) [    xor     cx,cx
9 C! v5 {' v( h+ `    int     41h$ U  m( }5 v! g5 r; ?8 g' [
    xchg    dx, es:[41h*4]
7 `4 K) t, P' r2 X; L    xchg    bx, es:[41h*4+2]4 T; b5 l5 o) Y2 U0 c. b
    cmp     cl,al
% d* n" k- P7 o4 h    jnz     SoftICE_detected
% L7 H* J1 L" ^1 Z8 ]. _8 L9 P: L8 M& T4 }4 }3 j/ j4 B3 a
_________________________________________________________________________
4 B' L$ C* B9 R9 |
8 J7 S2 {) x4 s- P/ d7 \Method 07
2 y  n) u. }2 [* H=========" d! t, |4 a, R/ Z1 a, S
7 \5 |# I5 v/ E' F* l
Method of detection of the WinICE handler in the int68h (V86)
* y  Q$ S2 u6 |% C  E: }5 I: q* }; F) m! W' I9 t2 Y9 T8 J
    mov     ah,43h
7 y7 U- X5 c/ ]6 t5 m/ r+ M; q    int     68h. C5 u. u  Q* R
    cmp     ax,0F386h. D  n8 _2 f4 a. |8 w
    jz      SoftICE_Detected- O$ b/ r) V3 n/ \8 B, y

  g! Z0 L1 V) X/ A2 P! x6 g3 A/ ]1 Q$ c1 ?* A
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
; M2 ^. u8 }; B6 f   app like this:
; j7 A% T2 S  a2 p" L/ N: v7 Z7 I, x
( A& [5 Z2 B2 b0 A7 D$ O   BPX exec_int if ax==68" \$ M4 |  M) U  B0 d7 S0 j
   (function called is located at byte ptr [ebp+1Dh] and client eip is- x0 b, M/ R5 J  L
   located at [ebp+48h] for 32Bit apps)  E& [& I$ f. H* e
__________________________________________________________________________
- `3 G) K  z2 D
- ~" K. w- G* q7 Q& N% X/ R  {3 b7 c  g2 ~% \- N
Method 08
! w+ C$ {% a+ d9 e+ \/ }9 C9 i=========* u, d. \# v" _1 t; U/ m

# m# ^& A. J! x3 ~It is not a method of detection of SoftICE but a possibility to crash the+ }9 ]+ X) H9 Z( Z4 M8 f$ E4 U7 J! N
system by intercepting int 01h and int 03h and redirecting them to another
  k! Y5 q1 k$ F! ]routine.
1 {3 ^, X1 s4 o- pIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
" J2 S1 w0 P4 u) O& w1 S* h8 dto the new routine to execute (hangs computer...)
; F: k1 u3 U! m: |2 V9 l. g" m6 C
) D) e: C$ p. g% a/ a" k: I* @- M    mov     ah, 25h
9 V* ^/ e5 B2 x5 c. {    mov     al, Int_Number (01h or 03h)
  n  V5 ^1 c4 H) Y    mov     dx, offset New_Int_Routine7 C" v: f% m1 i
    int     21h
# T. Q4 F' }/ |5 r; y  O6 J* E1 j
__________________________________________________________________________
, [5 J% B/ r! J& ]* p( y) U* O; s  I4 \0 E  z
Method 094 `. [+ ^5 G# q- b
=========
" e* F1 \( {1 _6 U9 P" C0 E4 i0 ^* t4 L
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only# h  y5 Z7 X$ q) D. c; B% B- _; P, @
performed in ring0 (VxD or a ring3 app using the VxdCall).
- i4 Y+ ^! i: z4 f8 rThe Get_DDB service is used to determine whether or not a VxD is installed
! _% o. \) r7 Y/ k- V1 wfor the specified device and returns a Device Description Block (in ecx) for
& g' H" W: [, w; qthat device if it is installed.5 C9 ~8 {2 d  C# U% C* j, C! V
' _9 `: N. Y" E% C& T
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID* J  ^% ?4 ~: y$ I6 `) o
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)6 f2 |; F& v% N+ E8 u, h7 u- F
   VMMCall Get_DDB
- k- b/ z# j+ y1 C6 V2 L   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
9 V3 O1 a( x* y6 ]  b, R! S7 x6 W% j7 D2 g8 [. l2 z9 E% w& F( b2 v
Note as well that you can easily detect this method with SoftICE:1 [% a  U8 B3 `: U, r" J
   bpx Get_DDB if ax==0202 || ax==7a5fh3 R# U# {' z! D8 K& P. B) Z
+ ?2 d& q, I4 W2 k
__________________________________________________________________________
+ i) [0 k. E9 A4 P& P3 X  S1 d3 w5 _
Method 10
. t1 U; C. {  s1 ?" L=========
2 q9 T3 h3 u7 a1 d7 l2 |7 \6 J
. J. p& [+ ~# s=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with9 u+ r4 K2 O" P9 Q& y5 `: b
  SoftICE while the option is enable!!
/ ]. t9 D; _6 o+ W) A* m
! f4 H1 c0 I% f; cThis trick is very efficient:
3 K9 L: R9 c6 Q5 b: g3 a8 ~by checking the Debug Registers, you can detect if SoftICE is loaded$ ~7 x  J) v7 @) R0 \/ p% m5 n  p
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if& J$ {0 e& @6 n% \8 s  y# [
there are some memory breakpoints set (dr0 to dr3) simply by reading their: ^; j/ I( A; k' N
value (in ring0 only). Values can be manipulated and or changed as well
! C$ y5 b1 y; j/ q8 J5 A, C(clearing BPMs for instance)
+ d2 V' k( {7 ~
  Z' K- N: o+ Y. R( E4 ^__________________________________________________________________________
& B! E5 U2 D  B% n0 N: g
; F7 c, L2 y/ w" N* T% MMethod 11
  X5 U8 R; U; t5 s=========
7 H' L1 `/ I/ R( ]) F
/ p3 Q) P  f1 C8 B! f$ k3 D8 z6 UThis method is most known as 'MeltICE' because it has been freely distributed
  R# p; p4 ?# D  E% t! {via www.winfiles.com. However it was first used by NuMega people to allow
  z  {7 Z! g4 O! Q' u, m) Z$ qSymbol Loader to check if SoftICE was active or not (the code is located
, Y, u" Y* L2 i! e+ Q# C9 Zinside nmtrans.dll).1 J( w  c0 N; X: \

% N7 f0 P) K5 W$ u7 QThe way it works is very simple:6 C* {% _7 W; S# H% J; C! `
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
# N2 k- m6 g! F: q& `3 UWinNT) with the CreateFileA API.4 S9 D1 x. h% l$ h, w; E" D( y; O7 N  A

, Y$ C0 \4 n4 a2 NHere is a sample (checking for 'SICE'):3 G5 D! O7 P$ E9 b; g9 V
. u' C+ G: p; y
BOOL IsSoftIce95Loaded()
8 }# w  B( n; a( p6 Q9 }" d- l{
5 K; M# |3 C: g0 T7 j, K   HANDLE hFile;  . C2 a3 R9 c/ Q- @9 V8 e- D
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,) r6 [, n$ w! a3 D" |8 P/ K
                      FILE_SHARE_READ | FILE_SHARE_WRITE,
( @5 P$ @: V2 ], ~  _$ \                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
+ L: ~5 s8 l1 U8 K  ], ]6 b/ d   if( hFile != INVALID_HANDLE_VALUE )
& y* p- ]) V' k, z2 M   {
3 Z; ?( s8 w  S( Q& b      CloseHandle(hFile);
. P) Y: \& y( T" F0 R5 D      return TRUE;
  G  x# n4 a1 E& ?" u, R; R   }) `+ Q6 @& w$ v6 W7 ]1 y
   return FALSE;
) E/ Y9 ^8 A1 ^* [/ `' n1 R}
  V9 |: M, Y; l* X5 ^" x
$ |" U  J+ a4 Q9 l7 h2 q$ uAlthough this trick calls the CreateFileA function, don't even expect to be' P7 v7 P7 v) b
able to intercept it by installing a IFS hook: it will not work, no way!. _  y- V8 }! q4 c
In fact, after the call to CreateFileA it will get through VWIN32 0x001F
. Y' u! k+ Z8 H$ h# kservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
. e8 d& A: E7 C2 a) @3 Cand then browse the DDB list until it find the VxD and its DDB_Control_Proc6 O7 u, ~/ Q  B
field.6 L; l6 I, d( c
In fact, its purpose is not to load/unload VxDs but only to send a 0 q7 O, X4 r, f" V  A% {
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
: v$ Q. J' |/ P" o4 f- kto the VxD Control_Dispatch proc (how the hell a shareware soft could try
" H/ d' E2 c. s. S% y7 @% Jto load/unload a non-dynamically loadable driver such as SoftICE ;-).
- Z! B1 M9 z( @0 ~, G) r- qIf the VxD is loaded, it will always clear eax and the Carry flag to allow& A0 w7 J' u! [
its handle to be opened and then, will be detected., \7 P) S. s" O
You can check that simply by hooking Winice.exe control proc entry point
% U" \8 \. y$ Y- swhile running MeltICE.
$ t+ A2 c( @  s* S0 G0 |  u* o% S4 V- H; e+ X5 T

7 s0 T9 b& {2 X) ]4 `7 a6 E* b/ ^# y1 T  00401067:  push      00402025    ; \\.\SICE/ k+ ~. J: E5 Y# w7 I
  0040106C:  call      CreateFileA
  X& ]$ S  \. t! d) N# F  00401071:  cmp       eax,-001
+ \/ B; J! s3 i, |2 m. q* R  00401074:  je        00401091
( H5 x5 B3 Z3 g  |1 P. @
/ C7 j/ t2 b3 M. {7 P/ E5 b
$ ?- e, |% g$ c% N$ J; @% }8 ^There could be hundreds of BPX you could use to detect this trick.
0 ]( @% v, T& @  [8 G6 ~-The most classical one is:2 Z/ e, _) f5 ~
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||2 G2 D+ `1 X* F, R
    *(esp-&gt;4+4)=='NTIC'. S' O  H) y& v/ j' w9 d# H" Q) ^
$ e! ?/ \$ V2 L! [, `9 H$ J* {& s
-The most exotic ones (could be very slooooow :-(
6 _. g% K: w* A" P; k5 I' X   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
. L. G+ X, @% O% j! L     ;will break 3 times :-(
% I9 y0 T8 `$ p
0 ~; V8 N; R- z5 G; W' Y-or (a bit) faster: & E6 T" d: G6 k5 n6 r, y
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
# n4 K, I9 c4 b) [- N  H4 u5 T+ d; ~! S7 W
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
6 o( N1 u$ q" e  k/ E     ;will break 3 times :-(* e! p. x5 w+ K( M2 O

6 ]0 v/ P+ B* `% ^8 X2 ?2 o-Much faster:
  l4 |6 r2 U% _2 Q# L* Y   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
' Q- Z4 K' R, N; s7 \- V: Y3 H0 G0 I; r4 y' u% x; T- f
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen; J. R" l" }+ e" k
function to do the same job:
) I; \% `: I' u' L  Y9 L
0 I6 Y5 p/ _/ ]. x   push    00                        ; OF_READ
3 E! [" d0 n! k- ~8 z5 q   mov     eax,[00656634]            ; '\\.\SICE',0
* I: X; J3 _: Y$ m; G   push    eax" ^7 D( ^4 P& g% p* X: d' L3 ]* N
   call    KERNEL32!_lopen
: c  {, l& h$ r, x! x   inc     eax9 X' u8 e! N6 ]4 v6 |% {- \
   jnz     00650589                  ; detected
$ _2 r7 b# h; o, E# ?8 r   push    00                        ; OF_READ
8 p% K7 N0 z, G( @* I/ Q3 x   mov     eax,[00656638]            ; '\\.\SICE'
- T! p. |0 }+ }2 x* d7 z; A   push    eax
$ N. G. c5 L" j& A4 d6 [1 _   call    KERNEL32!_lopen  S9 y+ D; @  A( S* S; b
   inc     eax
5 E" `6 T/ @# L   jz      006505ae                  ; not detected0 M: u* [; i1 m- r. e. w

+ q9 K) C- _2 c8 H3 M+ ]8 X; c1 f' g3 [9 G; y* o. N
__________________________________________________________________________8 p' N* @4 `: m  O1 w. M, ~+ ~
6 L; K5 p7 Z9 e2 p4 O3 ~6 Q7 k
Method 12' n$ p* Z5 b7 c7 G& d$ f" S* h
=========! o& S4 ]8 H# m1 |5 Y

' g, O( P, R! O5 @This trick is similar to int41h/4fh Debugger installation check (code 05
2 u' |, |) n. a8 R&amp; 06) but very limited because it's only available for Win95/98 (not NT)7 r  g4 ?5 ?$ N9 Z$ s
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.! ~# I0 h' J& W7 B3 B- L
) s. Q, h2 k  q' h# _
   push  0000004fh         ; function 4fh- @1 a6 S9 m3 s4 r4 J
   push  002a002ah         ; high word specifies which VxD (VWIN32)" ]) Q8 O  u) ~( M5 v3 r# o
                           ; low word specifies which service1 I( y: ]( c! L  P+ @
                             (VWIN32_Int41Dispatch)
; [$ S' \4 E8 r# C! d! ~   call  Kernel32!ORD_001  ; VxdCall8 g  Y4 f7 g1 A4 Q
   cmp   ax, 0f386h        ; magic number returned by system debuggers) `) b8 _# [1 p9 q
   jz    SoftICE_detected. x6 i5 \+ @& A, \. d
7 p- Q' P$ N  e6 U1 C. v" p
Here again, several ways to detect it:2 S. e- T3 e0 v( e5 G
; ~8 d" a. K. D7 |$ Q. V$ U% U# i
    BPINT 41 if ax==4f
' G# h* F0 e: Y! r# }
* j0 i2 k6 B& f9 b! q    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
" e2 Q' W, W0 ^. ^
  v, ?9 }. Z' ^' J$ |% D$ q2 v    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
& s+ V5 f$ `: S) V0 _, L& M' k# h& Z& x. B" b
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
; A' p( g+ @, v3 \+ E3 l' U4 O
% p1 ~( _" \) @' J. W: H__________________________________________________________________________
6 c* G+ |( @7 F! N& d2 b+ A  A
& }9 o, F7 |; N* L. yMethod 13
5 n/ C' P% ], o( [- p5 S: @4 x6 ~=========7 q4 k8 R% B' w/ U

& e% g9 y  \5 J4 nNot a real method of detection, but a good way to know if SoftICE is$ r* _! b  r$ v1 a; P6 U3 B
installed on a computer and to locate its installation directory.
- n) |% x" y4 O) H( w7 @7 S' KIt is used by few softs which access the following registry keys (usually #2) :! X1 h# k* F& l* F
% w0 m& I$ o5 r0 J- ^+ p
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion4 H# v* i- W. O) f+ Y4 H: O
\Uninstall\SoftICE- H: l1 V: E  A
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE, d* ~8 A, o3 Q9 ~) c/ s
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
2 A8 X; |# `, j8 j& F" b  y$ r7 B, B8 a\App Paths\Loader32.Exe, Y# y' h  s$ [) t, j, m1 v
2 l! W/ F8 I6 f
! J* k3 ~; v0 w* Z/ @9 x$ l) J' b: O
Note that some nasty apps could then erase all files from SoftICE directory
: O6 J0 V3 w- Z- X+ G: j5 X(I faced that once :-(
+ r  I' F' [3 u+ s' y6 V
$ S# i+ w2 M8 T; n' w/ H( q/ |Useful breakpoint to detect it:
5 y9 D* T% B4 x% Y2 X) H. l8 A+ T( a/ t2 g7 @5 _! m  w. A9 z
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
1 `" T2 _/ I& C5 B5 ~
/ _' ^2 r  ^  p, L  d__________________________________________________________________________
# G$ \) {" Q+ }0 @5 W+ O# f% B
" T6 [0 _& Y3 P6 t& }2 s3 O( m" ], ^
9 m4 g3 U. }" O% A$ hMethod 14
5 ^9 D( ~" |. C=========
4 T. N" k7 L  m2 w' A; x7 i+ a
: M  \% n" y/ ^A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
& ?" n0 Z, ?& G( X5 \) g( l2 Zis to determines whether a debugger is running on your system (ring0 only).7 m" L& v$ J0 `2 a. T

/ w) I9 i0 G3 ]5 |1 f, ?2 o3 W   VMMCall Test_Debug_Installed. i6 ]$ G6 b5 `% X, J9 [" P
   je      not_installed
1 B/ Y1 N/ H( x! [
! ?- r7 X) Q  Z8 v9 LThis service just checks a flag.: N1 G/ u( ~* d  H* d9 r1 y( m: o0 W# _' Q
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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