About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>  l4 u- g) V6 j5 Q9 }8 \
<TBODY># w. t8 l) X3 o) a' P
<TR>
1 z0 [0 }6 T$ h; z: H( m7 s: X% `8 l<TD><PRE>Method 01
4 u, c" P+ E. c& b$ |=========9 S5 m  y* q6 `7 Y! v
' V) y  y6 t% H+ A( V4 u, L
This method of detection of SoftICE (as well as the following one) is
2 ~2 K" I9 S' k8 B' h1 {1 @4 z' W9 y+ ^used by the majority of packers/encryptors found on Internet.7 Y4 V/ }7 r2 G7 {* q4 a* J9 y" G( I
It seeks the signature of BoundsChecker in SoftICE& ^6 M# r5 _3 q( |" a

1 q2 r2 i$ _4 g    mov     ebp, 04243484Bh        ; 'BCHK'; z7 U. A* l# ~% F. g, R0 m! Q
    mov     ax, 04h; I4 f9 @6 ]& ]7 g( l
    int     3      
- G; L" ~6 v; a1 C" j1 C( t    cmp     al,4, `; w1 ~! |8 ]: O6 \% }# U; F
    jnz     SoftICE_Detected
2 `' r- E" x6 t6 B: f# H, c9 z: c4 h7 G. Z4 X
___________________________________________________________________________. ~; W" T5 M6 R1 h8 k) c7 J

8 D; \5 B" g2 Q0 HMethod 02
' J) L/ Z* o# t+ b* y! I=========
/ Q' X2 u( U6 V; }+ S; |# \2 u; g6 f  W% _, A! t  \0 o
Still a method very much used (perhaps the most frequent one).  It is used
3 ]! y$ c* o& n8 p6 M' w% nto get SoftICE 'Back Door commands' which gives infos on Breakpoints,+ L4 ?2 \$ ]2 l% j8 ^) m* R
or execute SoftICE commands...
, {5 ?: ~! X# d& ~5 Y  QIt is also used to crash SoftICE and to force it to execute any commands% }: C# F+ s) K& |6 w
(HBOOT...) :-((  - G& a: ?5 ]0 U: O  u! b: |. B) ]9 W
: o: R' u7 }0 K2 y7 M( H
Here is a quick description:
4 d; z) [* C8 q/ l-AX = 0910h   (Display string in SIce windows)% |8 Q0 M9 N6 G7 ?7 V
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)' Q: A- b' d5 h8 N$ p) c
-AX = 0912h   (Get breakpoint infos)
- K4 |- f/ h; E; y: w+ A/ c4 ^-AX = 0913h   (Set Sice breakpoints)! P, u: P+ ~, _5 H
-AX = 0914h   (Remove SIce breakoints)
* F' z2 B3 \& y3 o& B5 x
7 a) O, {/ N7 O* @6 CEach time you'll meet this trick, you'll see:
* V1 R% |% {1 v$ D-SI = 4647h7 @( H( c" u( f4 }% Z$ V
-DI = 4A4Dh2 {, ]; B) f, u* x5 O: g& P$ T
Which are the 'magic values' used by SoftIce.# W/ C9 M/ k  b4 j* G6 \1 i, }& ~
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.
) V8 O# |: I  n/ e# n' S) I0 W; o2 P
Here is one example from the file "Haspinst.exe" which is the dongle HASP
5 J, I1 n: |( F! Q7 U* T2 ~% SEnvelope utility use to protect DOS applications:
  k6 O/ b( v7 z
: P3 x" }' M, ?0 K* y6 `" p  N
( x  i6 q9 ~' d' [6 G4C19:0095   MOV    AX,0911  ; execute command.
6 E1 S5 \8 }' P) w4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
# |+ I; k) E4 M0 N; f( t4C19:009A   MOV    SI,4647  ; 1st magic value.
  P9 S; @* K. O4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
- _" Q; @3 R1 ]% S+ l" q. P" L4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)4 m; G; {1 ]1 P7 T4 P3 B* v" ^' m! V
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute% i" |; P* G! V, Y  y3 ^
4C19:00A4   INC    CX' {# _6 i7 w: A' C
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
% J) g+ \* h  H9 C! g# ?& d" t% P4C19:00A8   JB     0095     ; 6 different commands.
2 W% B9 N9 q" f  \4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
, r, T4 D0 h. d% m  J4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
0 W" t# A0 L! I6 d0 S& |; Z; z/ I; k) V) v
The program will execute 6 different SIce commands located at ds:dx, which- K  B0 Q4 \1 T9 Y. E
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.: q2 K7 ]  s4 x  t
4 d3 D5 k- V2 j) j9 _$ Y2 }
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.1 u2 s+ R9 v$ y  q! i/ N% ]
___________________________________________________________________________2 U7 P- r" ^5 ]' A

9 _/ h! q# }; F: O6 h' m- M5 T
" y7 o* r, F" AMethod 038 b" J: m" w3 Q, \) E
=========; n2 i" A- O. ^% E& h2 F! B" q0 b0 H
; M' r/ g/ E5 ~$ I
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
' ^+ d1 ?# ^$ W* Q" g5 @- D(API Get entry point)
$ Q* |) J) @+ \/ m6 f. [. }        6 J. ]6 Z% o* l' P7 B0 ~
: T/ o+ A7 w. Y6 ]# ?
    xor     di,di* B4 J! A" p5 K2 u) T
    mov     es,di
/ ?1 ]9 J3 o+ B+ j" [5 {. {& p    mov     ax, 1684h      
( D: w, _2 l4 z2 _7 V    mov     bx, 0202h       ; VxD ID of winice
" m3 s' u& R- B, q% p    int     2Fh
, `9 j+ U  B# e( T/ s; ]    mov     ax, es          ; ES:DI -&gt; VxD API entry point
3 a+ `& T- `2 r( [8 E    add     ax, di4 n4 \$ a0 ~2 @% F
    test    ax,ax8 u9 x% ?1 _) B) n
    jnz     SoftICE_Detected
- p' l9 \- L; W5 A( O* j: y+ o* f- A! ?# V$ r* q- ?
___________________________________________________________________________: _: i' i, t5 t: Y0 m1 J5 d

: S" T9 k$ {& x, `% r; T6 ~- gMethod 04
) h! j6 R- a& Z=========' W" S2 J/ l; U, ~
+ A: H2 G" h' R7 y" {7 {; B
Method identical to the preceding one except that it seeks the ID of SoftICE
$ R. J: ^* |! _  ?/ ?6 }GFX VxD.! B9 e/ b* g9 }

, K1 Y( C! C  ?# E6 O2 I    xor     di,di# |+ J& }9 d/ j7 w
    mov     es,di2 ?. L' P0 t4 ~9 E
    mov     ax, 1684h       4 O8 E+ q! l! u3 b4 f( c' w: b
    mov     bx, 7a5Fh       ; VxD ID of SIWVID5 U: B* r" F: ?, \2 p. q4 _  ?! _+ K' u
    int     2fh( o% k% Y; D; p# W. w" {
    mov     ax, es          ; ES:DI -&gt; VxD API entry point1 _+ x- E/ n# T
    add     ax, di$ Q) `9 Y6 z+ R% u' A
    test    ax,ax
- W$ u7 Q& X3 A& P6 b    jnz     SoftICE_Detected6 I8 [5 w; F( C: `% \! N
4 s4 ]* L1 K1 l' y8 T- H) R
__________________________________________________________________________1 C, X% w) K" E$ X% s7 O6 m' _- j

9 k0 H. Q/ C* x/ ]& t1 ]* M# v' u- k1 O8 y5 D  A( R; y0 I* i
Method 050 k1 y8 E8 b' M  ?5 ]
=========
# t! g3 d0 z% a0 u, o% |) V/ r+ V6 L
1 t  J2 o3 t6 _+ O/ hMethod seeking the 'magic number' 0F386h returned (in ax) by all system
9 L. W: j5 w+ ?& c5 S% Xdebugger. It calls the int 41h, function 4Fh.8 ~/ T& ^7 i7 b9 v7 e
There are several alternatives.  1 k- C& y$ k# H1 s1 w& q% {% h

' h4 @2 j" C& XThe following one is the simplest:
: c1 \# n6 B7 z
/ |! j0 v' [, c    mov     ax,4fh( `+ o. ^; d* [; d
    int     41h4 A3 R- r9 @- q  J3 C! u! y1 T$ L
    cmp     ax, 0F386
' T0 b! t" e# o" a; b2 @    jz      SoftICE_detected8 r, X/ q, J5 @4 k* l2 x; _0 `, R

& [, K6 Y) u! U+ _$ H2 J) |
( ]- D+ p: @9 K& J! q! ENext method as well as the following one are 2 examples from Stone's
) V. `- c) c: G"stn-wid.zip" (www.cracking.net):
  x/ _7 A+ I9 |8 l, z; I: `; ?' A7 c- k/ \! _
    mov     bx, cs
9 b, U4 B, q+ h& s( P" [    lea     dx, int41handler2
0 |5 T  y: f2 u4 W* Y2 F    xchg    dx, es:[41h*4]
$ Y/ e! F* V( `6 L/ D( s+ s. f    xchg    bx, es:[41h*4+2]0 c4 r! F6 E, S3 }# w, C* U6 X
    mov     ax,4fh5 q$ T& o, s1 A- ~- p5 b8 k" e
    int     41h+ W9 Z2 }1 x* E  a
    xchg    dx, es:[41h*4]3 R$ F+ H1 `7 L$ S. x  f3 p
    xchg    bx, es:[41h*4+2]
7 T$ L( Y; [. E) Q    cmp     ax, 0f386h/ I2 J& z% k9 Z5 a! U, V" F
    jz      SoftICE_detected
6 U* t9 K& Q7 O" B5 _" B8 o- V6 K1 j9 |6 C0 l  R2 w
int41handler2 PROC* A6 H6 a! A3 n4 l0 K& t8 v
    iret  Z8 b1 g' I4 G' j. x
int41handler2 ENDP
0 Q$ R/ Q: O* F& z) j( c" j$ z' E& i- I: I% t

0 ]* R2 o4 g9 T_________________________________________________________________________
% C; }/ H/ _  Z, z: n1 j2 g) w( u; W1 s/ b$ K7 M0 H
6 X" N* R8 H6 @1 N0 A
Method 06: o! T7 \' w1 s% `" q3 B- [
=========- ^- j1 ~% y) p/ q6 s  C# x* V6 t

5 Y7 [: E1 L4 y' ^: u3 `
: ?. h' a3 {0 P' ]2nd method similar to the preceding one but more difficult to detect:
; }$ I8 A; v2 m! Y) W4 X
& s  N4 F( j: V$ m; I  R3 w
) M: g% P1 A" ^: m( v  c% w$ d4 ^" wint41handler PROC; M3 ^! D( S9 r! f+ x
    mov     cl,al
/ D- ?1 Q* Z) x% ?) ^    iret
, Z5 V' j* c. I  D8 Kint41handler ENDP5 E- |. [7 s/ z: O5 W! m
" m7 W( W; r! v+ s6 K
8 ?+ R9 R2 T4 ^  d2 E! r
    xor     ax,ax$ ^- ~; O. o5 d1 C; g( e! U
    mov     es,ax- r4 L" o4 l  f  r, s) m$ l
    mov     bx, cs
6 y$ `% h& W# q3 W/ F    lea     dx, int41handler
+ G9 x% q9 l2 s% R" d8 S- E    xchg    dx, es:[41h*4]
4 R; V4 s: N2 L% x    xchg    bx, es:[41h*4+2]
- g& I9 Y+ C3 r  B4 k    in      al, 40h; R& C; i; U/ i$ ]1 d" c; h! F
    xor     cx,cx
: {, H4 A( L8 O( y; W) y    int     41h
( }( p" _) I# x& s: n    xchg    dx, es:[41h*4]
5 A( U& s: `! z    xchg    bx, es:[41h*4+2]5 Y  `1 }  b3 z0 r" `* R( y) b, p
    cmp     cl,al4 r8 q% E1 o+ s
    jnz     SoftICE_detected) P3 `% [' j4 @5 m% l" [; l2 Q

# B' J. X2 l' V. p4 v, y_________________________________________________________________________6 e" k0 h* [# c6 _! [9 U

1 Y) N. D( `0 ]; i! k1 qMethod 07
* o1 I* O  ~6 R/ o1 x; a* C=========# V& u0 ?% @6 P3 }2 I

( ~5 G4 S# a5 Y8 V$ aMethod of detection of the WinICE handler in the int68h (V86)& k9 o5 }* e! O3 m/ u

0 K* F. S3 h) @    mov     ah,43h/ ~, e1 }3 y- v" t3 q8 ^: q
    int     68h3 ?+ [4 T0 U8 f- A* G
    cmp     ax,0F386h, g+ e: m0 {- @4 Q
    jz      SoftICE_Detected
) K0 t% ~5 Z# \% o) f7 ?0 g
7 c+ G& d) \3 b3 h1 U# A% f  @0 r/ a
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
# o- y; {  i0 N1 s) y# w& j) H* `3 O5 j   app like this:
1 X' d3 ^( _. g! d, G- i: Z% ~" T) v
   BPX exec_int if ax==68( a. z( G6 o! z; ?
   (function called is located at byte ptr [ebp+1Dh] and client eip is0 x. i9 D) E. Q# D3 R0 d* O; Z9 {1 x
   located at [ebp+48h] for 32Bit apps)2 N4 w0 J. J8 z
__________________________________________________________________________& H+ S* b( k9 i& h0 l

+ _2 G& J- I5 `/ [* E. Z
1 V2 m/ G3 l9 q8 M* ^4 g* N, QMethod 08
6 I& B: E  b7 n. }! c=========
+ f7 e% u! H/ K* Y2 P% U' g; ?9 I
0 @! ~$ B" F( AIt is not a method of detection of SoftICE but a possibility to crash the
3 J7 M4 f8 \* G: k# ^0 [2 }- nsystem by intercepting int 01h and int 03h and redirecting them to another
0 q/ q0 ?: h! z% c% v" Z0 yroutine.- m6 \3 G$ ], |. j% x; C
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points9 D+ J4 d7 |& w0 D7 K
to the new routine to execute (hangs computer...)% \0 q+ J$ ?' m

; C# Q# u9 l: B0 c, H( U1 ]+ ^    mov     ah, 25h
( A% d5 x. y' D; O    mov     al, Int_Number (01h or 03h)
  X( A0 R- w1 _: z6 |6 a: q6 {    mov     dx, offset New_Int_Routine
* V- j" E$ w9 e/ @3 v    int     21h, e. Z& o; s# _8 O

) x$ U$ h3 J6 C3 {4 i__________________________________________________________________________: x; z- Z3 M. u  T6 z$ S' }
: P% g0 @' [6 [) L: N8 [
Method 099 l, H4 I8 M9 R: v
=========4 C: r% k  d5 U. m6 }) H

7 F) Z; D0 K. J! |  O1 b0 pThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only8 ?6 I1 C% R4 |5 E
performed in ring0 (VxD or a ring3 app using the VxdCall).
/ S) L* Z# N& N: X# `The Get_DDB service is used to determine whether or not a VxD is installed
2 q1 Q& a- r" z2 Pfor the specified device and returns a Device Description Block (in ecx) for8 Z8 W! b; N( Z: r6 N
that device if it is installed.+ f' t3 g$ e3 g' J" D
0 H4 `$ M: [7 w
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
3 e% D) [- `/ l   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)6 I. ]5 ]! ?3 s  v( w1 U# B& L
   VMMCall Get_DDB# p0 G. U0 x) L, Q9 i
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed/ r% J& _. i; o) R- ]
  Y) c! T. P) {, c) f1 v$ g0 a
Note as well that you can easily detect this method with SoftICE:
8 [$ p. [0 z* s0 ]   bpx Get_DDB if ax==0202 || ax==7a5fh
9 q& P2 c! u; n3 q
' f* S0 g1 G) s+ Z9 p4 X0 y. j6 e__________________________________________________________________________
# f* [! U; o6 S" T7 h) u3 I8 U" v
1 c4 y, G6 {! i- F; GMethod 10! D" k/ m& c' q2 ?/ D! G
=========
% ^! T# d. J4 ]! l4 g
7 F( f9 d: d1 ^1 X3 t. I=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with' v: e2 s$ x% m# ~! ~& i: b
  SoftICE while the option is enable!!
9 ]$ _& i7 _) h0 A2 G2 G9 W( K: M
This trick is very efficient:
- L' {: H+ R0 Z" T0 l( t8 C, uby checking the Debug Registers, you can detect if SoftICE is loaded
) [% X4 O/ K; `) u4 Z9 Y+ e(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if& J/ Q- e! g7 y- {
there are some memory breakpoints set (dr0 to dr3) simply by reading their
7 a* y7 q* K6 t2 \5 j0 u4 {value (in ring0 only). Values can be manipulated and or changed as well
6 y: }0 y  Q$ G' b* h  b& K. w4 S(clearing BPMs for instance)) m/ g' I% i* S" o! p
. ^0 @0 F' \2 d# D+ |8 T
__________________________________________________________________________
% e0 W; s* H1 `9 B- b. V6 {5 i
* `% a: ^! ]: g' bMethod 110 F9 h. q& b( {9 n' L
=========3 a/ J# ^$ i/ n1 r- C: L

. n" g6 O3 P* y) ^% @This method is most known as 'MeltICE' because it has been freely distributed3 Y& Y% o: N9 ]; v
via www.winfiles.com. However it was first used by NuMega people to allow) w! z) D. U0 Y+ w  F2 R
Symbol Loader to check if SoftICE was active or not (the code is located. `  o' D5 M3 P( Z9 \
inside nmtrans.dll).2 k9 e* A8 l' Q; a/ w$ k

7 N# k, f! l4 i' y  DThe way it works is very simple:
8 m( H3 l% f2 L* b$ n3 v) Y: u/ UIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for: Y, M7 l0 {9 w3 }5 f% g: y
WinNT) with the CreateFileA API.$ b3 O, _' z) r8 K6 E& O: @0 z, Y
& X% H/ r; x- z8 j  M* K7 q
Here is a sample (checking for 'SICE'):
7 X2 C5 n2 ], Y, i% Z( B6 U' C5 V' o5 H1 H9 n5 O
BOOL IsSoftIce95Loaded()5 N$ F# K" c5 R+ J( R9 y+ {
{; D+ `' R5 {2 B: ]1 @
   HANDLE hFile;  
9 d6 o! L# _4 ?   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
  g$ ^5 u4 }- `2 [* E                      FILE_SHARE_READ | FILE_SHARE_WRITE,
0 `. u0 m: O7 h                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);/ `8 _( X) c3 H- u5 G6 F% u7 D/ i( `
   if( hFile != INVALID_HANDLE_VALUE )
$ @' z  l: N/ B- o, l9 s2 n# T  N4 d   {; l- \7 h6 \  B) ^5 X
      CloseHandle(hFile);
4 B- ?( s: }+ d" f2 ~1 l0 s  K      return TRUE;
" Q% U/ O) {% @& ^9 ~- ]+ i   }
6 M9 o, K/ w$ B0 L' z: \   return FALSE;+ u4 F% U8 T$ v
}
! W# y3 u9 b! M3 A+ h, @
; A! i/ d: k7 N8 G  O  PAlthough this trick calls the CreateFileA function, don't even expect to be
- @5 A, R  D( O9 W& t9 rable to intercept it by installing a IFS hook: it will not work, no way!9 G' W9 p. C) g- V
In fact, after the call to CreateFileA it will get through VWIN32 0x001F
4 @8 L' ^' ]2 U7 K. s$ Bservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)' B8 H! K+ x$ I) b
and then browse the DDB list until it find the VxD and its DDB_Control_Proc
( x. }# V7 ~  ^" `3 u+ m8 ffield.
, c, c% g8 I* sIn fact, its purpose is not to load/unload VxDs but only to send a
! m9 {/ H- i1 U4 mW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)8 F2 n- {1 P# i$ D$ S$ s: x6 ?
to the VxD Control_Dispatch proc (how the hell a shareware soft could try
! y1 q- q7 `7 e/ |2 R8 s+ n( V$ _to load/unload a non-dynamically loadable driver such as SoftICE ;-).
9 h  G! C" ?% ?/ [) l8 O% V' GIf the VxD is loaded, it will always clear eax and the Carry flag to allow
9 j& U: i6 F( z! c3 eits handle to be opened and then, will be detected.! N: O9 x7 G4 |- `; n) O+ u: m. ~% Q/ @
You can check that simply by hooking Winice.exe control proc entry point
& m9 N9 y1 f% k$ @2 J, m  _while running MeltICE.
0 D1 a7 Y  G# L. D7 |7 g# r
- G0 G3 |* D& f: r# C$ K
" [5 ]: c' q5 J  00401067:  push      00402025    ; \\.\SICE- }0 n- J5 @# s& M5 Q
  0040106C:  call      CreateFileA9 n" j% l2 V5 Y! x
  00401071:  cmp       eax,-001* R! S6 g* C9 n, U; G
  00401074:  je        00401091
; N1 b9 B" C4 n3 q9 Q* n( c. P3 o& y0 s2 K1 W8 ?% D
' |  ?  W- o$ Q" m8 T! b: S
There could be hundreds of BPX you could use to detect this trick.
3 C4 T0 l: j7 B) r-The most classical one is:/ J' H! U1 n8 x. |
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
% t# O2 i* j" R# E. |    *(esp-&gt;4+4)=='NTIC'" G4 Q' B& N# `& p- D! R+ |/ |5 f

# y" t9 A" d( c, q. ]-The most exotic ones (could be very slooooow :-(
8 x8 j) e9 D! _- t) @" U   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  . v3 D* t' T/ v" W* u& u
     ;will break 3 times :-(
; N/ K3 j" Y1 m
1 g% @, _& Q* |$ P0 H/ J-or (a bit) faster:
4 H' I1 |, d* Y, |   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
, U+ h: g. j, y( c! Y# z6 s( U
) y) S) Q9 R: o8 |& a5 m   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  : i( b: Q3 J. _9 F& W$ a; B
     ;will break 3 times :-(
7 A- q, I  j1 G8 I: _5 V- x' I' H3 z( l* e/ D
-Much faster:. [, a" ]7 |5 h8 e
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
/ D% o6 z$ T/ O
6 n! \5 t; x- k( F% }, X# DNote also that some programs (like AZPR3.00) use de old 16-bit _lopen
2 v5 t6 D3 g3 \1 L( l4 Efunction to do the same job:/ C) a* a# J& A( h9 Z2 `
7 z6 y3 z9 G5 M. U3 O
   push    00                        ; OF_READ' M* u8 k( l9 r* j9 _. v+ S
   mov     eax,[00656634]            ; '\\.\SICE',0* l  E$ F' d! v3 m( n+ J
   push    eax
7 R# K' I, M0 q' I! Y   call    KERNEL32!_lopen
; j' F0 {9 Q, u/ _+ u   inc     eax
8 B+ c3 X  R5 D6 B( g! n* x$ y   jnz     00650589                  ; detected
, F6 ]( I0 J% X   push    00                        ; OF_READ- k- X. c& M0 `7 d$ ?$ {
   mov     eax,[00656638]            ; '\\.\SICE'# k) c0 \9 `+ b! _
   push    eax6 R7 B' }/ ?% j: ?4 u
   call    KERNEL32!_lopen* m) C- Z, \) }. e2 ]9 @: Y
   inc     eax, @4 ]; O" G# d( C6 e4 t0 T- }
   jz      006505ae                  ; not detected! }5 m& _7 ]! R4 G* j8 Y

$ }# J8 i2 b7 D- D6 g. d9 Z- W$ G' e9 _1 ^5 d
__________________________________________________________________________; a+ o% x6 C# e" d2 v9 q
  A: a2 A$ C; D  \$ x
Method 12' o- ?0 T8 |- f1 N
=========
5 c" z! ^& v, i5 s7 I- ]  e# |& V& ~
This trick is similar to int41h/4fh Debugger installation check (code 05: e; L0 y  Z' a4 q$ H4 J( h8 e- H; [% {
&amp; 06) but very limited because it's only available for Win95/98 (not NT)
- Z$ B# `# n, g9 z# J, A. r2 ^as it uses the VxDCall backdoor. This detection was found in Bleem Demo.5 K8 ?3 o$ v  r9 [9 q& J
' R1 ?0 R8 u' P5 `& h) P
   push  0000004fh         ; function 4fh/ A# D' Q( z, {2 p
   push  002a002ah         ; high word specifies which VxD (VWIN32)
+ y& }0 b& T0 G4 m/ ^, K                           ; low word specifies which service1 F6 m% r6 G, [
                             (VWIN32_Int41Dispatch)) t% ^6 t7 R5 v$ I% X9 w, `3 U
   call  Kernel32!ORD_001  ; VxdCall
$ U4 f& p/ Y8 W9 X, R* i   cmp   ax, 0f386h        ; magic number returned by system debuggers
# L/ v+ L$ C$ c9 F: r6 w   jz    SoftICE_detected. w9 \# \1 w' d) H3 w
1 ]$ l4 f0 d3 @3 A
Here again, several ways to detect it:
+ r4 y9 e) r* }2 v
1 P. ^' h8 }1 ^0 l4 U' C. i    BPINT 41 if ax==4f
7 q! N( |7 C! x: c" D
) s3 c1 _$ k5 |    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one8 q& e% j4 A% u, @7 Q% K& y" I4 j
7 P8 Q. K/ a  T3 F4 n* K! E/ c
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A( _; z% D7 k( Z5 W2 |/ c
% }9 a$ m1 o7 t  K
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
" n. a5 e% j: W  X
" g; T& j4 k$ |__________________________________________________________________________8 v; ]) \: c; i+ N* H

; z1 R1 q6 l& |6 n' OMethod 13
2 i" V5 D& F: p  t% L2 V=========9 R1 y+ {* B5 ?1 f6 _( e1 f" a
* ?4 Z+ n, y2 u. Y+ @: \" A
Not a real method of detection, but a good way to know if SoftICE is
7 N, _; W; A8 D" [. xinstalled on a computer and to locate its installation directory.
- V, J. h) R+ |9 d% _( CIt is used by few softs which access the following registry keys (usually #2) :
- P. Q1 a1 d# \8 V; x! s7 l
; s* p4 i. q% ^1 [1 A; i5 P-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
4 T+ o5 b6 X3 l. i4 }2 \\Uninstall\SoftICE. o4 ?$ x4 Z5 T! s+ w/ ^
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE$ K9 f2 F7 k% H. s& M/ B, Z
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
4 ^: Z5 ^* i0 J\App Paths\Loader32.Exe
! ]' f1 }% h% Z1 R9 D9 s4 i: w5 _0 u8 u& E) u* q

$ E" i: ]+ r6 B9 h+ b0 Z' BNote that some nasty apps could then erase all files from SoftICE directory
# g2 K0 _7 r* E+ W" t0 d% O(I faced that once :-(/ ?- h9 G0 a; g

2 ~4 W+ E( @& H5 g9 {Useful breakpoint to detect it:
) J$ @3 r- o. f+ i+ _6 I
/ U; {4 l* B0 j0 b1 e' e     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'  y8 n4 T; }- a2 x- b8 }4 k
, z# I3 Y) [% F: p4 H" ^: h7 D* K/ p
__________________________________________________________________________
5 g4 O" `. ~+ ?! C9 n* T  u. A% R% `: G! U5 [1 L
, F! o, K* d. U" ~$ V
Method 14
  p$ H- _) i" _4 @0 ~=========$ j) R9 O- R# ~/ H
& G9 \+ [7 |- L( N
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
5 k3 x$ ]; \3 f- W2 a& q" fis to determines whether a debugger is running on your system (ring0 only).
; _- w5 _* W+ ~4 }5 \
7 }2 G" U! {0 U4 u! M0 f9 {# o   VMMCall Test_Debug_Installed
. ?0 s$ g2 |2 c$ x, h# ]- U5 [   je      not_installed) Y+ A. H* F6 [. Q- t0 `
/ U3 l" j/ A, k# b" f
This service just checks a flag.4 D% I0 t" g# v4 Q4 {, t) Z& U& [1 U
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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