About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
# ]7 y3 Z( q, G# q$ c<TBODY>; l$ f: C# F, }4 _
<TR>
6 p5 X+ z) \! X5 n<TD><PRE>Method 01 % U' o% N+ @; T
=========
4 \, G3 P6 \# h- m6 r1 f" N6 L6 I5 C
This method of detection of SoftICE (as well as the following one) is) B  ~! L. |! J0 g* }# e
used by the majority of packers/encryptors found on Internet.
0 G9 F7 H% r. @+ E9 gIt seeks the signature of BoundsChecker in SoftICE
: P7 e( H0 M' x! O
9 e" r) h' n. l. X. V    mov     ebp, 04243484Bh        ; 'BCHK'- I. r' n+ y, V- \% ?, l
    mov     ax, 04h- _5 E. q& d& I, f: |2 b- b
    int     3       2 X. _, E! s; a
    cmp     al,4& b- T- }( g  J* q+ L  ~
    jnz     SoftICE_Detected9 [& u& p! c; |+ b! D0 U; T

: c6 c! A7 A( y8 ]9 D" T- [___________________________________________________________________________$ l1 L( Q6 R4 ^1 i
( y2 r* q2 r( h  _2 n" p4 |
Method 02. V( {) d0 d* M* [# K: G
=========; ^$ Q' c+ U/ n2 d  U

! }; q. N8 \: SStill a method very much used (perhaps the most frequent one).  It is used3 u9 J* F0 s+ M5 q# k# {  O6 x
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,5 t7 U* Q2 l9 P% m+ v
or execute SoftICE commands...
; {) i' U% D- x$ ?% A) x0 V, h7 iIt is also used to crash SoftICE and to force it to execute any commands
! _. O3 F4 q3 ~3 L- k/ _6 f, a(HBOOT...) :-((  
1 g# e* m/ U- d- U. {0 N& P4 `, F$ n" Y# q: J5 z
Here is a quick description:" ]$ Q! G& u4 Y, F1 c' u3 {
-AX = 0910h   (Display string in SIce windows)
: q8 k& |# t! C" H( C7 u-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)9 V) u# c9 U9 h" e6 l
-AX = 0912h   (Get breakpoint infos)
0 w" D( k( @$ n0 I# T  z+ ~-AX = 0913h   (Set Sice breakpoints)4 i0 y2 l# ^  _& f6 G+ H
-AX = 0914h   (Remove SIce breakoints)' T, _' \6 I; |2 F6 w/ M

0 B9 p. n7 O1 i7 q9 REach time you'll meet this trick, you'll see:
2 M9 \) R+ x( |4 k3 A8 U6 Y" c# }-SI = 4647h
6 H: m3 E" t7 g-DI = 4A4Dh( T; n1 k: R& y6 C1 a$ w5 b% G( j8 g
Which are the 'magic values' used by SoftIce.* O# k9 d5 L) P
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.6 j0 y7 V2 H, k+ d

) @3 p8 y$ T' f! H7 PHere is one example from the file "Haspinst.exe" which is the dongle HASP/ k7 f6 Q* ?) j9 K9 o7 Y) Q; x! o
Envelope utility use to protect DOS applications:  b9 Z+ P' A# ]7 V9 Q, y

7 |( d2 r  G4 T5 ^" [
3 K. E8 i$ \0 m4C19:0095   MOV    AX,0911  ; execute command.
, A& v/ T  d, s6 J: \& J" z5 b4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
. _0 `, P% s! J$ W4C19:009A   MOV    SI,4647  ; 1st magic value.
! ?! e9 N- f0 X6 b6 T4C19:009D   MOV    DI,4A4D  ; 2nd magic value.1 |" a5 g- K4 j/ j! h2 }7 I4 e
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)+ u) W* g- W2 M
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute; b! {" Y5 a" w4 G: F/ Z2 C
4C19:00A4   INC    CX8 J% z- _7 P9 L, ~" z9 N0 x
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
3 Q$ x. a3 _. e4 Y3 w  l) [4C19:00A8   JB     0095     ; 6 different commands.
6 c- S7 ~* V" Y0 ?" Z% @  d) r7 I4C19:00AA   JMP    0002     ; Bad_Guy jmp back.+ A5 B; w7 {6 H3 P+ B
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)' M- T+ B5 v/ ]/ c0 @0 o, f* M
' v6 N  j6 f( p
The program will execute 6 different SIce commands located at ds:dx, which; R/ b2 w- z* J
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
& |: t% W( w0 w+ v+ B/ k2 G( G- k* [0 U' R( u1 @
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.) a6 f5 F4 F$ s2 M
___________________________________________________________________________
* {. G/ K' T, S: f) w6 ^( Y& U. r; L$ W9 X7 S
8 \  c5 \  _2 C& T
Method 03
5 J8 ^6 X+ \/ Z) r. Q4 ]; E5 \=========
* s5 T6 Q  u; H, y9 ]$ I, R% q, T+ X% _' c/ [
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
; m2 ?5 H: t& ]' T) S) I+ t) Z- @(API Get entry point)9 F. U: A/ m! z; G: E5 \  l- O2 q
        
1 j0 \$ O1 J; R7 X7 \! C
. ^' C  O3 H2 V0 z    xor     di,di
+ ^9 z9 ]. ]* B% H0 X% i1 U    mov     es,di
, C/ I5 x. }% R% S. s, n    mov     ax, 1684h       . F) r: o( s, D
    mov     bx, 0202h       ; VxD ID of winice0 j0 Q" j+ K# n8 _! ?  [
    int     2Fh
" c- ]: W7 `! K! r    mov     ax, es          ; ES:DI -&gt; VxD API entry point
* h8 D8 N/ \" Q- z+ T    add     ax, di- [) }6 l& g) l
    test    ax,ax
/ l' E" P; ^8 L    jnz     SoftICE_Detected; B- D! U, |" Y: _2 }8 y9 E
9 S8 h( ^4 `" ?* @# R9 p
___________________________________________________________________________( I, }' f' T) o% \
+ c* ^2 }. E2 Z9 g9 S2 n, c
Method 04
" b# i* y% R2 g' u=========
3 z) D, l! P1 S1 j5 a8 W6 O8 ]4 A  s# R- p( r+ u
Method identical to the preceding one except that it seeks the ID of SoftICE6 K. |2 l8 y1 }8 a5 ]$ }, V
GFX VxD.
$ L  G1 H6 e" R0 s$ N8 c
7 ?) H+ t4 A4 {' U    xor     di,di
% a5 t& L) F$ i" `    mov     es,di
' k- B9 L/ }3 A    mov     ax, 1684h       . |! N: H4 m) ]  i
    mov     bx, 7a5Fh       ; VxD ID of SIWVID
( e6 z/ Z7 A9 Y5 k  f# G, Q2 y    int     2fh& w4 ?. W. Q( D% l
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
+ X! b1 H2 q. N0 s9 ]: z    add     ax, di
" e# B  j# `5 F* B! F* r    test    ax,ax
& s9 _* W& [! p, v0 U1 J' d/ _    jnz     SoftICE_Detected
% {' v+ y2 o. S. q/ o8 ]" E) ^- w' \: I7 }( E
__________________________________________________________________________6 n- I/ A& b' r2 a% M6 M. Z
1 S& w) F, [9 F8 P% l  n7 e

! I# q6 K9 r4 x9 d8 [5 N9 l2 G! tMethod 05" N: \  C( j8 s6 o8 I
=========, R9 X1 n1 J5 G4 ~3 y, d5 Y
8 Y" I' J5 g$ F4 b. b; V; N
Method seeking the 'magic number' 0F386h returned (in ax) by all system
1 e$ n2 c1 @0 Y- H2 A0 p: z: Sdebugger. It calls the int 41h, function 4Fh.
& E! P8 ]: |' `: a! b( PThere are several alternatives.  , R) _# C. {2 ?, x+ D
( `! d& ~, f! E
The following one is the simplest:3 V* L7 y. I- o# c
% z( l" j' T8 p# |& w) ^2 Z- O: T- h$ ~
    mov     ax,4fh( e: N5 x/ |' \+ J' U# R. ~, k8 r
    int     41h
3 O. n: W4 h' v    cmp     ax, 0F386& O0 D  f% o( A$ i" I
    jz      SoftICE_detected- ]" s; N4 w6 O/ P
9 Z' Y  G3 y+ u/ X+ E8 X

" B9 C8 b1 E- aNext method as well as the following one are 2 examples from Stone's - F" L7 `" W; X3 b' J$ u
"stn-wid.zip" (www.cracking.net):
8 _0 y1 P% B4 M7 U$ K+ G' z' S5 p) V1 M6 |) w  \* w  ]& Q7 b2 F0 H
    mov     bx, cs
5 D4 B, O% [8 n/ L3 i) G    lea     dx, int41handler2( A- u7 D4 g/ Y7 y
    xchg    dx, es:[41h*4]
" G  Y& v/ A* @: O    xchg    bx, es:[41h*4+2]/ L0 m; {5 F2 i8 @  ]4 I
    mov     ax,4fh" j) D; K# ^4 F5 P
    int     41h
  @% x' j+ e& i$ @7 ^    xchg    dx, es:[41h*4]
# r9 r2 \/ y# I: h! U    xchg    bx, es:[41h*4+2]+ R0 k' g2 n( [2 J6 F! p  N
    cmp     ax, 0f386h
6 p" d1 k% j8 K* k5 f- ~    jz      SoftICE_detected( Z. M' d  Q: _' E% M
0 r$ P' d$ j, j( f' ~  }
int41handler2 PROC+ [) |$ t/ I- r& e, v3 k2 z
    iret1 r# H- \6 ?; h
int41handler2 ENDP% v1 p- |6 t" F, O) Q' c, D& M
0 R% z. }, i# N# x( p& E( v. G( t
( |+ _4 r) ~' C( I6 y/ m
_________________________________________________________________________
7 P4 [, X' J. b6 ~/ f* L( E! i$ x& |3 s/ V0 s& T& X6 k$ E

3 t2 p7 y* O  Z3 M% [* j' d, l+ PMethod 06
* E4 n. i9 i9 ]# l: r2 \! M=========1 c/ r/ F! i# B2 _/ ?; `* O3 v  f( W

& p; o. A2 b0 N! z4 ]+ L4 o
. B, C$ g9 u/ U2nd method similar to the preceding one but more difficult to detect:
5 p2 F2 y" \8 v% ?; L$ ]
4 [) D& R4 e% ^& v7 d1 V; }  }6 O: N& U
int41handler PROC2 f* d+ b- c# b1 [% \
    mov     cl,al& ~1 C% b* R1 P3 f; p% g3 s8 e/ V
    iret
3 u9 [& Q3 Y9 @( X+ a) M, eint41handler ENDP( r+ c, s1 O* e5 g" ^! @

% _! @: ^4 }+ K) o- I
: H% z, I) ^/ K/ n" m0 X- \    xor     ax,ax
* ^& K( x5 E# f8 y$ e1 q    mov     es,ax: z7 d* y5 a  S, G, o
    mov     bx, cs) D8 n* H6 Z# {' C; x( o' d  z: D
    lea     dx, int41handler" i- Y1 W# _/ \% I' ~
    xchg    dx, es:[41h*4]4 E- ?+ q8 j2 `- l
    xchg    bx, es:[41h*4+2]
% _( F. k4 c5 Y/ L. t5 q& m    in      al, 40h
: o( R, w- M- P- C4 B3 u! R6 m    xor     cx,cx
& p3 h0 R$ T  Y    int     41h- b9 V  f, I( s& x* w9 a
    xchg    dx, es:[41h*4]
0 T4 L+ B5 f: X: P4 A    xchg    bx, es:[41h*4+2]
1 @4 |( y+ S' p! {9 N    cmp     cl,al
0 u. ^# ?8 U$ a* [7 Q( y' S- @* W$ U    jnz     SoftICE_detected% b; T) N, X# K$ T$ _1 {

+ `0 G" }  j, P0 n6 p_________________________________________________________________________1 z# U+ n. z! M, G7 J+ n5 S
1 O0 Z1 q% C' Z: p$ g3 J
Method 07
' {" f- n2 k7 f- D) s1 b, [=========# C# Y6 Z3 S0 O5 Q0 R+ _
' Y& G+ {. n; C
Method of detection of the WinICE handler in the int68h (V86): ~) X0 Y9 b& Y# l

3 v" U' ?* m- X5 F$ x5 r    mov     ah,43h5 }% |! F4 {+ w& D: U
    int     68h# J& K/ X7 u6 P. X/ [4 m
    cmp     ax,0F386h  y1 b' T0 }' g
    jz      SoftICE_Detected
+ p. @% \; l) M  u$ V1 {% H
' @( k1 z, b* P2 y$ V7 a; _( ?( X/ P& ]- F$ Q
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit6 w0 M7 ]/ c  f
   app like this:
' G9 a- S, }. I8 `  ?* y; t
/ O! _( M7 N! o3 u" h$ [   BPX exec_int if ax==68
! v5 J4 F/ b$ b; b& \2 ]   (function called is located at byte ptr [ebp+1Dh] and client eip is7 R4 Q9 a& X& G" }* V9 C3 C! h
   located at [ebp+48h] for 32Bit apps)
) @! G9 k. S9 F' D4 T__________________________________________________________________________3 L/ ~, L6 w- W3 p& w# q

0 Z4 o6 \5 b/ Q+ E8 t, ?7 D
& R; l- e* _2 c, e: {: ZMethod 08& _: B1 H* P  X
=========
4 X3 o; i) G; W3 e3 H0 O( r5 H  Z8 K% u8 z
It is not a method of detection of SoftICE but a possibility to crash the
4 l! n2 S* X, ]6 Psystem by intercepting int 01h and int 03h and redirecting them to another
7 e3 b) c2 e+ N/ J* zroutine.. Y6 S8 b! G/ t
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
$ O, n  t+ U; Dto the new routine to execute (hangs computer...)( W4 C* `3 i& F# e8 z

" Q' B- D; n- ?3 W    mov     ah, 25h5 v* s' d4 }- S2 R1 d
    mov     al, Int_Number (01h or 03h)6 A+ j: I! ^9 F+ J
    mov     dx, offset New_Int_Routine" e" P7 A3 |) N7 {4 K0 g
    int     21h5 c4 Z8 z% a% ?8 u9 B
/ h$ @1 z# J, X; v( J. Y
__________________________________________________________________________2 G! y; o& C8 o
# T6 R* P( P1 a( R4 A- @6 I
Method 09
/ E( u& u+ {# m/ Z/ R# e" h( d9 k) o=========/ i' ]( I  a9 O, N
) h6 L/ |% E3 o3 L4 b- u
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only% u8 I0 S4 B: \. \
performed in ring0 (VxD or a ring3 app using the VxdCall).
$ I# x2 k% I' Z2 K: kThe Get_DDB service is used to determine whether or not a VxD is installed
8 ~0 v% y1 @9 ^3 F2 Mfor the specified device and returns a Device Description Block (in ecx) for
. ?) ?: G- @9 T* }. n3 vthat device if it is installed.3 V8 G6 b- C2 ]) K( y2 @

5 m. Z$ D+ D# J' I' M+ U   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID6 g& d6 z) m( ^2 P
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-); J, J$ l1 ~5 s' h
   VMMCall Get_DDB: J5 s( `( z! }) a6 w
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
6 n0 G  i; l5 x3 o% p0 Z
" r& A) Q7 Q: X# U+ `Note as well that you can easily detect this method with SoftICE:' g  E, j; t! b0 a; M# [
   bpx Get_DDB if ax==0202 || ax==7a5fh
, }; r: f; H* Z4 J3 ?3 F- f5 b1 U3 `, B! L* B
__________________________________________________________________________) x. k1 {. D2 L+ g$ {) U! ]2 v
' L" H' J, F7 p9 A3 \- B
Method 10
$ I4 Z" ^' Z/ B' W! ^' v=========
- P9 B( S2 E0 [) l) ~
" q2 i( D  z- |3 B=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
* N2 k% X  Y/ b$ H4 ]) F* Y: ^0 h4 D  SoftICE while the option is enable!!
8 ]" G' Z& y1 e+ m; o& `9 \* o5 q$ d3 Z
This trick is very efficient:3 n( Y4 y( }! O: R3 l5 F. Z
by checking the Debug Registers, you can detect if SoftICE is loaded
, t5 a$ h; _) j; y0 `(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if/ X6 y% t9 V4 v7 Y1 j# K
there are some memory breakpoints set (dr0 to dr3) simply by reading their
7 s! l0 G/ s- _7 e6 \value (in ring0 only). Values can be manipulated and or changed as well( z; a4 l2 W  O( H
(clearing BPMs for instance). s; u4 T5 _" ^6 R% ~1 ]% }

, W1 p9 k5 i' d__________________________________________________________________________
! \! m5 v4 d  R/ J
: c* W% H) ^: DMethod 117 O$ G- d$ d8 O1 v% r
=========
+ J2 k$ p/ c' B7 E0 s" x0 S( V# l) A; R3 Z8 |$ `
This method is most known as 'MeltICE' because it has been freely distributed2 B! M8 w0 E3 F  O% _0 i
via www.winfiles.com. However it was first used by NuMega people to allow  x1 E$ {2 m, `9 t9 b& m, A
Symbol Loader to check if SoftICE was active or not (the code is located
5 L$ G) D2 e5 m' ?, Ninside nmtrans.dll).
$ ?4 C$ M: o/ Z  W2 \
3 y  d. Y: t1 G  g2 QThe way it works is very simple:
& g0 b, \$ d. oIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for; K( {8 f+ y: W+ B
WinNT) with the CreateFileA API.
) g$ L8 F- Y- n9 q* y) d
. ?' t- l4 T5 _2 \Here is a sample (checking for 'SICE'):  z: x: K3 l$ ]$ w0 M0 E

* g( u& P6 z$ o$ S/ Q4 TBOOL IsSoftIce95Loaded()
8 G+ B. V5 x" o% v5 V& J{) t: c1 y# Y! P; X7 V. A- U5 j
   HANDLE hFile;  ' {$ q$ M3 A; `5 g* r
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
! j& F5 h2 l% v4 O1 S% G2 I1 |7 N                      FILE_SHARE_READ | FILE_SHARE_WRITE,
% g, H) F# i8 \  u  y) E4 @8 ^$ N                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);. O, k8 E* c% o. X
   if( hFile != INVALID_HANDLE_VALUE )$ M% e+ Q+ J- w2 U
   {3 A* v8 `  o5 ~' Y6 E$ t# m
      CloseHandle(hFile);
$ q4 m3 B$ k- }( }  n* c, h      return TRUE;
1 _+ y& l- P! r7 U) k% p/ k% @: @   }9 l1 M7 u' o+ L& g: P0 A/ ^$ C
   return FALSE;; O7 b/ ]9 ~9 o# m
}- w' B7 R6 Z$ O1 J3 B
3 y" D. P) p' R, y2 i/ ~) J8 [
Although this trick calls the CreateFileA function, don't even expect to be
# p7 G6 {6 ]8 a" h& n' uable to intercept it by installing a IFS hook: it will not work, no way!
( t; T, t3 Q; R3 CIn fact, after the call to CreateFileA it will get through VWIN32 0x001F7 K/ n; A1 E, E& r
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
5 `$ [  v8 A" z- @5 |: Yand then browse the DDB list until it find the VxD and its DDB_Control_Proc) v! b% l% Q% e& H& H: @* p
field.
/ ~$ @# X$ e+ Y% f& uIn fact, its purpose is not to load/unload VxDs but only to send a & u8 u+ \2 }. x/ d" G
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE), H7 J# s. V6 B0 e/ Q# F; p1 g$ g6 ?
to the VxD Control_Dispatch proc (how the hell a shareware soft could try
+ b. |# `; |( ?; U. Bto load/unload a non-dynamically loadable driver such as SoftICE ;-).
: Y( v+ u; ^8 ]. O9 UIf the VxD is loaded, it will always clear eax and the Carry flag to allow
9 X, _- x& d# Q2 r4 qits handle to be opened and then, will be detected.
' x! ]% k9 c- X" L5 zYou can check that simply by hooking Winice.exe control proc entry point
5 E* A# j  d: Z, `( ?, t& |) \8 G; iwhile running MeltICE.
- I1 s7 j" ]: ~$ ^+ e; ^: S6 l8 v* _' s1 \: E: ^

- W  O9 ^# k, t6 `" N& g7 w; h- v  00401067:  push      00402025    ; \\.\SICE
) B6 D' l- D4 f: y/ n+ n  0040106C:  call      CreateFileA
7 G/ J" L" q8 S2 M  00401071:  cmp       eax,-001
/ F4 J4 _+ x, t) {$ C  00401074:  je        00401091
* b& C! G2 P4 R: k$ c) q
  }2 }' V- H9 c9 |4 q# E5 Q0 }. [4 C. t
There could be hundreds of BPX you could use to detect this trick.+ W9 N& y; [0 G" R" w
-The most classical one is:
" p1 R0 }3 ?' ~1 k4 p) O  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
$ f9 h0 U5 H. m# D8 q0 I    *(esp-&gt;4+4)=='NTIC'
" m+ u: m% Y3 Y, f
" w8 P# f  k1 w  ^; |6 T-The most exotic ones (could be very slooooow :-(
0 E  M6 E: M1 T   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
, B5 L- Y0 H7 A0 g% _) \3 F- k0 ^- ~     ;will break 3 times :-(
0 U# Y" B+ O% |/ ~
$ y7 f2 J0 d+ N" c4 k& ]& }% s-or (a bit) faster:
- J. o( d2 n. ]  _, @   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')1 k1 u6 U3 S, q# i% m7 V  O
, k# Y( d9 k8 {1 h( o
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  3 i+ r. z7 _% w4 T( q, O
     ;will break 3 times :-(4 R/ t( Y& ~( @
2 |8 c# |- K' V  q4 h1 m
-Much faster:
/ b4 j: h$ l! i9 o% h   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'$ u* A/ P  C- G# p: z& o

! A) |1 N0 B# [: B; V1 {Note also that some programs (like AZPR3.00) use de old 16-bit _lopen
* ~+ k/ s& [% n4 d- L3 h' wfunction to do the same job:6 y2 C7 o* W3 v% M0 a8 g5 @2 m$ ?6 Z
  p1 @0 B& p* w* i
   push    00                        ; OF_READ  P5 |7 A' P/ q
   mov     eax,[00656634]            ; '\\.\SICE',0
/ U# E" i6 _2 B, K1 s7 D+ }   push    eax2 F% A+ W' r4 K( R% L' }* l6 L
   call    KERNEL32!_lopen1 |$ h$ t4 o+ _+ _/ I9 s
   inc     eax
7 o; _" h  d" b5 `  g   jnz     00650589                  ; detected
2 Q, B0 v6 |" Z) [) g   push    00                        ; OF_READ
9 W9 R# Q3 I7 s8 ?( |* N   mov     eax,[00656638]            ; '\\.\SICE'
/ m* d: B% k3 O6 x( ]   push    eax
0 _8 h" w8 g  ^" S' R   call    KERNEL32!_lopen" q" y2 F" m5 {& J/ \$ ~# Z
   inc     eax5 W7 k$ `! b- ~9 t
   jz      006505ae                  ; not detected# }) a3 i0 f+ `. U% m( h
. l1 u& y6 f0 B) W  [% T+ T

# e8 x. ?4 a8 ~1 \8 o5 i__________________________________________________________________________. V" T2 B+ s& G+ P9 N& [
! \. o3 M9 F2 ^3 u, H
Method 12& _: [0 J0 o' C' `( J
=========
4 P+ w- ?4 o. n) t( b" i$ g3 `" a0 S' P
; s8 `) ?* M+ C1 ^) s# x5 MThis trick is similar to int41h/4fh Debugger installation check (code 05
% W6 C1 v! ?. |* q0 Q+ @7 B7 P. j&amp; 06) but very limited because it's only available for Win95/98 (not NT)+ [: d6 }/ f$ S, d7 Z$ }- c
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.
8 A) Y! t& _6 K, j# ^; q( K9 t5 n6 n# w# ~, p& M
   push  0000004fh         ; function 4fh: M+ x0 K6 K" u% k
   push  002a002ah         ; high word specifies which VxD (VWIN32)) S; z( S) [6 D4 N
                           ; low word specifies which service
: i3 `1 \& c9 o* w* _, v& `6 l                             (VWIN32_Int41Dispatch)& i5 d$ u' q: m$ a9 a6 r
   call  Kernel32!ORD_001  ; VxdCall
9 M! T  I5 R& u0 {% F" R% Z3 n   cmp   ax, 0f386h        ; magic number returned by system debuggers" @- w; y* g& n$ }
   jz    SoftICE_detected0 t# B6 b' c# q- q2 f

: M; O, O2 D+ IHere again, several ways to detect it:; D+ C  X7 a& `$ T6 [' {
# Y( r* Q( _0 D' v- ?+ A
    BPINT 41 if ax==4f
! n9 L' O2 }4 k, s( L& s
; {% d% V% j- ?. E6 ^- f3 x! k1 a    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one/ T2 _8 ~+ l1 B: P  l4 Z# i$ R& F
+ Y! B; l$ W) d( t9 ]  V- D
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A# n, m& N7 Z7 i9 X" v6 p
$ U% J3 ~$ a# N3 j' f7 W
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!: f7 s7 Z  k8 u' L) ~
7 V3 V- \2 Z- W0 T
__________________________________________________________________________/ z# O- ]* q5 [# m9 H4 F5 I' |

% x* Y# D$ N- `" w8 _Method 13* J  G/ w& W* Q7 M" `0 f2 d
=========, ?& H* e, b$ _( h" g5 j5 ~" C
; J- X, ]# @  D
Not a real method of detection, but a good way to know if SoftICE is* w5 @0 z7 a3 d% ]
installed on a computer and to locate its installation directory.' s! b# S/ q" {5 H+ H
It is used by few softs which access the following registry keys (usually #2) :0 e' |  S: g5 R0 P! b8 K

7 C) F% `& K1 H/ F6 f6 o-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion, ~7 E* P' h- \! J3 d9 S
\Uninstall\SoftICE4 R9 T/ ?! d( v- i7 P
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE( c! Z2 c1 F1 q9 X# i, z, X
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
- m% C8 A# v5 _6 X" H1 N7 b0 _) Z: L$ P\App Paths\Loader32.Exe
. c5 ^$ l% ~5 b7 t1 E
" T( f0 e3 v. P2 V8 z2 S1 p. D, b0 k1 w3 P) O9 k; h( T6 V
Note that some nasty apps could then erase all files from SoftICE directory
1 S' U+ r+ f+ R" N(I faced that once :-(7 J" Q) v# o. ?+ d% g' E# p  M4 Z
' z6 S2 C: b" t# @2 ]: a4 {7 i
Useful breakpoint to detect it:5 K' b! G0 B( }4 v

0 V2 y2 k$ p7 `! C% `2 |" u     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
# ~2 J( M$ {3 }# g6 I0 Y
% y1 p" y7 R4 _& f: @! M; x__________________________________________________________________________6 y& ]- k9 W% c9 y* d

2 f) X4 \- M/ e$ j, F9 f6 k; c# p( R8 X
Method 14 4 `: h# n+ q- U2 E: N7 E
=========
) _4 t2 ^8 G/ {5 h
2 _- {' c( o* H! A$ ?: b: TA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
: W! |' u+ v3 |( t1 Ais to determines whether a debugger is running on your system (ring0 only).! v5 `: Y, w$ d; W# o- }6 I: ?2 \
2 x8 P  v9 b3 B9 Z
   VMMCall Test_Debug_Installed
5 A) A; H1 `# B& k   je      not_installed0 Y7 b6 v  ~7 I
6 d6 i- A  j$ q/ J: ~
This service just checks a flag.
' l- U4 p! y8 a7 K" h9 h$ ?</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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