About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500># J, }* \2 l- B- t) G
<TBODY>% v4 N- Z+ e  V# r) W
<TR>7 f$ w$ L' C8 Z, w$ f$ k. Y
<TD><PRE>Method 01
1 V9 x( p) U: {2 [" \0 V5 V=========
5 }. I8 Q# [0 v* ]4 s4 k  B7 j; X* g* [8 m
This method of detection of SoftICE (as well as the following one) is9 e. F% {2 e5 d9 [
used by the majority of packers/encryptors found on Internet.
: s& D5 {$ E& H6 A' gIt seeks the signature of BoundsChecker in SoftICE1 J) b& g. T* d3 d; g9 F- O4 ]$ ^

( G+ c2 ?; s/ y8 m+ ]: n    mov     ebp, 04243484Bh        ; 'BCHK'5 {! q* e; A% `$ T. \9 U1 A
    mov     ax, 04h) F6 v' k' T6 j9 I: ?: c8 |% N
    int     3       ) {( f7 V2 e5 L3 y! z; B+ u
    cmp     al,4
! F) l6 j+ \; A1 H) b    jnz     SoftICE_Detected
9 p1 |# `  K9 C+ K! t; d' _: C2 s7 D1 a
___________________________________________________________________________
" m9 w; n: X2 \: A$ n9 ]" I( @( S* X8 {) Z
Method 02
4 K; u) V- B* @/ l% |=========; @- t6 P) o1 g4 }3 f6 w
3 q- g2 c4 G& _" _
Still a method very much used (perhaps the most frequent one).  It is used6 \* X& I+ k" K/ ^; @0 I6 S
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,
* I2 `3 U  z; P; {. Dor execute SoftICE commands...: H* d4 o; h4 @0 l
It is also used to crash SoftICE and to force it to execute any commands/ L, E2 O+ @7 O. g0 \2 m
(HBOOT...) :-((  
$ k7 E! N4 ]5 D+ ]
& h7 m0 d' W7 @9 r. w5 bHere is a quick description:
% X% Q1 A9 H+ t9 L! C: r* K-AX = 0910h   (Display string in SIce windows)
3 [$ T5 M4 i; H  `7 F-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
+ @* V! C4 h& V+ q3 |-AX = 0912h   (Get breakpoint infos)
; N9 P" m; Q7 J7 B6 U& m4 Q-AX = 0913h   (Set Sice breakpoints)9 y. U; r; |( j# v, k' k; D
-AX = 0914h   (Remove SIce breakoints)
3 ^& z) V0 {$ v* @: o# X/ S* u
3 }; d: s, A2 `: BEach time you'll meet this trick, you'll see:' d& p% L1 s" f7 h- s
-SI = 4647h
  r+ V1 p2 F& ?9 n* a7 |, r+ C-DI = 4A4Dh
7 Z( H$ l# K# L, u+ ~Which are the 'magic values' used by SoftIce.4 b5 \3 ?% R1 t. h. H
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.
' r2 b0 U: f, |) q
# R7 f* p6 j+ n) {2 lHere is one example from the file "Haspinst.exe" which is the dongle HASP/ z: T8 p! |2 U: i2 [
Envelope utility use to protect DOS applications:  h5 h  L) }, B5 K5 n

. i. t" }+ I% C5 M4 ~' U" d. @. G4 J- |$ u: Z
4C19:0095   MOV    AX,0911  ; execute command.
  _. ]: C4 \( H! v4 O9 X4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).% h0 \7 {4 ^( d7 u5 W
4C19:009A   MOV    SI,4647  ; 1st magic value.
* D: A+ T) k/ b9 H4C19:009D   MOV    DI,4A4D  ; 2nd magic value.5 M' l' l/ A1 t9 A" t1 F2 y
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)6 p& d+ ?* L! g+ P) k+ H. f. |
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute2 |9 Q3 s: P+ t# V& u
4C19:00A4   INC    CX
1 a1 u' j3 [; V: ]! N# p4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
# |1 U6 K' {  ]; w9 X4C19:00A8   JB     0095     ; 6 different commands.
) }- v7 i! ]$ V0 }% {$ d4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
: w, L' N7 C* i; p4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)/ z6 l) j' ~8 L7 l3 t
# j! I# J7 g9 y) _3 C
The program will execute 6 different SIce commands located at ds:dx, which
- V' V+ Y2 ]7 o+ y+ yare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.5 P, ~2 m# `. a# c, ?
) Q) Z0 m$ [" o0 {+ Y
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
( g; p4 V9 F& H, a, M___________________________________________________________________________0 H) i+ h9 `* T  k
5 r2 z6 X4 o' |3 D; ]
1 x6 O9 G. u! ^8 X9 s
Method 03
- @4 L, h3 j* t, B1 C" p( @% r=========
3 r( g; G! t9 @
6 f+ p% }. f1 `1 a, e$ }Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
/ E: p  s# `3 a. P3 p. G3 }9 W, f(API Get entry point)
1 e$ r1 ?3 q) @) `  z        
% M: t* k$ ?5 k7 Q8 F! |% W) d& m" `' R0 E8 z+ r& \" ^5 E
    xor     di,di
: G7 K* U8 J% W9 Y* @    mov     es,di
; j8 g7 a9 s2 b; [7 E    mov     ax, 1684h       . v9 T" _5 M0 p
    mov     bx, 0202h       ; VxD ID of winice
8 o2 e5 N' ~5 U5 o' k    int     2Fh
) M0 }% ?  y4 p8 h! q6 h9 P/ G/ }7 k    mov     ax, es          ; ES:DI -&gt; VxD API entry point- s# d( q0 d4 _1 m/ O+ |( Y
    add     ax, di  U0 D% ?& D. X) C; o) G8 `% z* v
    test    ax,ax
, t, N2 ?8 }* V0 \3 i  i    jnz     SoftICE_Detected' Y+ d2 n, s( q
# a7 a* v& n: u4 v( N2 \3 ~
___________________________________________________________________________
7 u+ t- N& ~. z) d) j( I. b3 o2 y( Y
Method 04
& k9 }' e. l/ j' O/ T9 d=========
( y  g' ?1 f# K2 v! j. w
. E' A; ^8 F, YMethod identical to the preceding one except that it seeks the ID of SoftICE, H" d# }) P  V  ^9 Z. t0 H9 @
GFX VxD.
9 c: I" M7 _" b) I* x
2 l; ^* O% C1 E    xor     di,di8 R9 ~6 ]* b( q  [6 m+ m/ ]8 c
    mov     es,di
! ?3 T8 e7 `+ {& o& y& y# q4 `! r    mov     ax, 1684h       * d( l& [; I8 ?% v" s
    mov     bx, 7a5Fh       ; VxD ID of SIWVID
  o4 j, ~1 K* r7 n. F. }    int     2fh) v' N2 L$ O5 {% G! b; t" \& _
    mov     ax, es          ; ES:DI -&gt; VxD API entry point2 H2 ]. v4 c' x7 I! A9 K
    add     ax, di$ D, x. M8 c% w  \( _
    test    ax,ax  }! D2 z* Z6 E0 y9 v  D9 X
    jnz     SoftICE_Detected
3 g7 h# P) O1 k! X! s* j* U! G" i( y1 V: z, K  \3 X2 k
__________________________________________________________________________
/ t8 G- l" ~" p/ m5 x4 L! k7 a, n4 L8 R, j/ @6 V" g# M9 W8 M# q$ J

( m# i" E: b$ _2 m5 c. UMethod 05
, R3 D4 ]: p( G; @) J=========6 O7 A8 X8 k) D

( S* Y5 N3 x. T. I/ l: t- hMethod seeking the 'magic number' 0F386h returned (in ax) by all system. ?) `1 k) s9 C4 A5 B
debugger. It calls the int 41h, function 4Fh., g5 h! ^# W5 q( K
There are several alternatives.  
9 \3 a3 U! {- _0 A% n( M* t
8 ]0 ]; e: S! B. |7 n- h1 g$ H5 sThe following one is the simplest:( j! a1 Y& S( L& X4 j

$ P- Z+ [% A6 r: A- m$ [- {2 N    mov     ax,4fh2 a3 m, F$ Z1 p( _$ Y4 P) O6 u) I
    int     41h7 s5 K; y% ~# Q7 F' v4 m
    cmp     ax, 0F386' l) o6 q" O  u% R1 H7 K( J+ _' s
    jz      SoftICE_detected" n6 F: }) F' G& ]* _! Q- L

7 }! f( @) u% d/ |- w- T  q+ D& o5 ]5 a8 |/ r
Next method as well as the following one are 2 examples from Stone's
# u. f( O) ~/ h) S& G7 w; F0 D7 ^0 v"stn-wid.zip" (www.cracking.net):
9 }+ r/ ?" L4 C8 F% `1 o' X! U
- C- s1 V2 P7 P# C    mov     bx, cs
; Z) s6 V  V; W# _$ R: s9 G0 `    lea     dx, int41handler2/ t+ Q- f* F/ ?5 }  S
    xchg    dx, es:[41h*4]
) J) O$ K! q2 |7 R* o5 q    xchg    bx, es:[41h*4+2]
7 r* w- @2 T. N0 C- d! |; R    mov     ax,4fh4 [" B, @' ]4 v9 n
    int     41h1 J9 |; {. \: \8 P# @, ]
    xchg    dx, es:[41h*4]
2 d& p/ t9 i  E    xchg    bx, es:[41h*4+2]
/ r. I# f# V9 m) B2 i% K7 c7 I; n    cmp     ax, 0f386h. ^/ c+ k+ A& u- Q$ ?- a# p
    jz      SoftICE_detected
. C5 ~. J3 K6 v! C8 s1 f8 P
" Q- l2 Q$ Z0 D9 U" z$ jint41handler2 PROC
- w2 j4 P2 _: T& {( _    iret
6 C6 f1 ~9 }! ]+ ?  Q# _! D; Yint41handler2 ENDP
& c, U, `, @  M8 M. K, l; f
) U9 f: X! B% S7 [  j0 p* v" `2 o3 Y- m6 [. y
_________________________________________________________________________9 h/ V6 d5 G5 C

4 N. _# F* O4 n2 }) n" f& N$ m- T- T
Method 06  H" m! L) Y/ B' j
=========
8 D% D; f0 k0 C( j9 ^9 A# f( o) i# Y2 X1 I
+ A$ D  Y2 X" N/ g* V% F9 c
2nd method similar to the preceding one but more difficult to detect:% m( X4 i% \5 t, M% v7 l

0 o3 l( \) l8 Q9 f4 x3 h
3 f5 d/ A. w' @; j* nint41handler PROC3 [5 D9 Z* C) G  l
    mov     cl,al% ^, H' ~- P  j
    iret
: H) M! _. V8 ^int41handler ENDP1 h' P+ V& }$ ^9 h9 e
7 t* T% _2 N0 ]' T+ Y3 f
. d8 x; w+ |! G3 v+ y2 F  }
    xor     ax,ax
; D: Z' g* D. {- c    mov     es,ax* E) a7 P! M+ x6 H
    mov     bx, cs: O: Q% C+ @& Y! A
    lea     dx, int41handler
7 i2 y  a7 m  B2 i& v3 c2 `# F4 _6 D' j    xchg    dx, es:[41h*4]2 I. H* t; c- ^# b1 Z; d& [, ~; A
    xchg    bx, es:[41h*4+2]3 s+ f. {# B. C* n! I
    in      al, 40h
# f0 s3 t4 {# q8 c& I$ k) ?. P    xor     cx,cx5 ^$ L8 X$ y; ]3 K4 N* @4 ?) N  l
    int     41h
& B/ q4 \" }, G0 M    xchg    dx, es:[41h*4]( o' i& Z) d9 j% @, ~
    xchg    bx, es:[41h*4+2]
8 [4 p5 x& K, d- s    cmp     cl,al
% O( o5 |) _' X. |/ H9 h( _+ [) h    jnz     SoftICE_detected' v% t. H- @; U5 J

( h" v7 F, J5 {* E/ i_________________________________________________________________________
0 Y3 ~1 T9 h, w0 {$ k
; ~9 f3 R$ d6 x2 w; cMethod 070 ~2 I  W2 D5 c1 ~9 N# o6 y8 Q
=========
& s8 W4 Y- r5 B* J# ]
4 w) a. f8 K# c8 M  `) aMethod of detection of the WinICE handler in the int68h (V86)
) x' {7 B6 S- g! z1 g/ W
; D! D$ O9 S' _. J4 m    mov     ah,43h2 e9 z, U- S# a& i. U6 l
    int     68h# D+ d" m4 N7 r, j; \
    cmp     ax,0F386h
8 G, |* a/ G. }* a3 \    jz      SoftICE_Detected" B# N6 H0 {' q9 y9 O

7 E  @; v' ]& j% h. `9 P1 o/ _' K7 ]7 d8 r* B+ c% ^4 f1 G6 T
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
# a  i6 }; H% K" I& g. G0 Q' f/ f, b   app like this:
. F$ ^0 H8 D8 Y2 l7 b+ R0 E" c' N* @2 w+ W, W4 n
   BPX exec_int if ax==68
. O7 S- [4 m' i! x/ Q& V* p. Z   (function called is located at byte ptr [ebp+1Dh] and client eip is- i4 V/ M. Z4 u5 n, z' j8 |* v  I
   located at [ebp+48h] for 32Bit apps)1 o  }  [% m' G$ V
__________________________________________________________________________# G3 o  V; \$ T: i

' O8 j. t. @7 a2 m. x, T. n3 r- ]. T4 I; p1 U
Method 088 ^* l3 v# Y  V/ |& m  r' L. w
=========0 b& E% `6 n! |
! H( s* @0 }5 Z! d" A) e5 c
It is not a method of detection of SoftICE but a possibility to crash the
$ Q  G  r/ g" H; y+ e# Ysystem by intercepting int 01h and int 03h and redirecting them to another
/ z+ C7 P3 m& C8 s2 Proutine.( A$ x  F' U5 \' |! ~! Y
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
0 Q2 `5 l+ n: t6 m5 E  Oto the new routine to execute (hangs computer...)5 {6 [5 f# L: ]; Y# d' ~

& k  T9 j% M1 Z! [% G& S5 h    mov     ah, 25h
$ A5 o* b+ i. F0 ~$ O3 N3 o    mov     al, Int_Number (01h or 03h)! V0 S& n, ]9 u. |6 \% H
    mov     dx, offset New_Int_Routine
: ]- }$ S) T3 A: I& r8 d9 S* U$ K    int     21h
$ @8 b+ M( \1 x; U# q  f
. t! H! M$ R) v/ J__________________________________________________________________________; t6 c7 D0 y6 A# }

" _2 }4 g% E  M( UMethod 09
) P8 _4 T7 X( ~; K0 Z8 e/ B=========
( v4 ~' `+ A/ u* }, T$ ~) A
; h2 X! J) j; S* N: |6 ~- X% V" CThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
: M0 d; f' L+ E) pperformed in ring0 (VxD or a ring3 app using the VxdCall).
& Q$ S% C' K: \8 J  c8 }The Get_DDB service is used to determine whether or not a VxD is installed
: R) D9 f; I* m# b+ _0 R6 P3 Wfor the specified device and returns a Device Description Block (in ecx) for# q5 S3 O, b9 f
that device if it is installed.
2 E% f7 \1 e9 n- N0 d' j4 M5 b# k% t% d
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
0 F! t- e8 T; N; j- n   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)+ i8 l0 R) Q  w
   VMMCall Get_DDB
; h/ Z" K: q# _) N: E   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed' W) p/ L1 N9 t) O
5 ~$ t( U1 ^- q) ^
Note as well that you can easily detect this method with SoftICE:4 i/ y9 z) e4 T' y
   bpx Get_DDB if ax==0202 || ax==7a5fh
/ o. C& z: E! G" }0 n( X* b
- f) q% d/ f# v* }__________________________________________________________________________( H1 T1 c3 K+ K8 k! c
: Q: D8 e2 p8 l1 J
Method 10& F# i4 _3 y: B" c* g7 j, I) k
=========
$ R, b6 Z  T3 u5 k$ r/ w1 [( m3 F/ u" s% e& o9 U
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with7 ^1 V4 Y& x+ l3 U$ W# F
  SoftICE while the option is enable!!) d/ p  \* v& W2 @) R/ t

$ s: Y- J1 Q' Y# s7 G5 V) ?This trick is very efficient:
! D0 T: S" [. I# x; |  u$ S8 Qby checking the Debug Registers, you can detect if SoftICE is loaded
' Z7 d. ?+ a4 P- ?* g1 ^(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if$ G. w/ j7 \7 \$ m) P
there are some memory breakpoints set (dr0 to dr3) simply by reading their, f' K# v0 ^- [/ t
value (in ring0 only). Values can be manipulated and or changed as well
5 i5 X1 `6 U1 a, A8 I& B7 n# }(clearing BPMs for instance)6 Y& v: a9 q, `9 o- [# L+ H

5 m' v/ |3 }& l6 f3 H__________________________________________________________________________
" p1 q* F3 w) D9 N$ p* L& e" y/ W5 J+ P) R$ ^
Method 11
4 |0 H; P' ?6 ?- B+ W=========
1 C+ i% T6 i- L; M) `
# B! @! A  U4 L# l8 q% h$ d6 VThis method is most known as 'MeltICE' because it has been freely distributed8 y( a. T4 s, k) _
via www.winfiles.com. However it was first used by NuMega people to allow
0 l% d( _9 D! _: O: kSymbol Loader to check if SoftICE was active or not (the code is located
3 g4 T1 x, V! t* H$ m0 i3 w6 finside nmtrans.dll).
+ ~; r, I7 f; m. O2 X* n. k1 K1 ?( m* C# z6 ^/ `
The way it works is very simple:; j- ^, o3 L* x* z+ n/ }
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
$ j# {! ~7 s' ?% d! N! ^WinNT) with the CreateFileA API.
' V5 Q0 ?+ I2 \& h, }/ B% J6 y: v1 G3 D
Here is a sample (checking for 'SICE'):
4 d$ _/ B- G4 I" k' |# B9 ]0 B3 E8 z
BOOL IsSoftIce95Loaded()0 A  b$ f- ^6 t8 [% q3 F/ {
{+ g  G; t9 N+ r) I& E
   HANDLE hFile;  1 A; L0 e8 f+ }$ r
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
0 {8 M- H+ [0 Y/ p% Y7 z                      FILE_SHARE_READ | FILE_SHARE_WRITE,
8 W- s2 d+ a- p5 N, Z$ i+ N% I0 \                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);  X* ~" J; o+ g
   if( hFile != INVALID_HANDLE_VALUE )8 \# ?5 c& {, A$ D
   {
& s; n5 f- G( i" ^- b      CloseHandle(hFile);: f% z* J+ R9 g5 S3 I/ g; Y6 o6 }, o" W
      return TRUE;' C% E. e% N& Y, v) U% d3 U) g$ o
   }
% Z+ h; Y1 U& W; z" |+ y2 M   return FALSE;
! J' u( F" t% [; i- m/ x0 {. E}' q( ~0 M9 E1 a0 t

' E% d) D3 _1 R/ e- n" f: E! O# pAlthough this trick calls the CreateFileA function, don't even expect to be
: }. f. z" T1 o; R9 fable to intercept it by installing a IFS hook: it will not work, no way!
: i. J5 N6 J8 C6 R- EIn fact, after the call to CreateFileA it will get through VWIN32 0x001F. {) X7 ^& B2 a! ~- J( V
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
; `4 @5 I& R/ E0 G+ \% P6 a& f9 m% u3 _and then browse the DDB list until it find the VxD and its DDB_Control_Proc
7 X! g. q# L9 }& Yfield.
0 W% h" M; H8 O+ C' i) o5 JIn fact, its purpose is not to load/unload VxDs but only to send a
# v8 p( `! t5 }9 p* BW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
! a  `7 ~: ^2 _. G. S7 {2 I1 Jto the VxD Control_Dispatch proc (how the hell a shareware soft could try
, s) L" x) Q' X  S# Xto load/unload a non-dynamically loadable driver such as SoftICE ;-).
2 P6 K# N: A1 @& Z4 Z& ]If the VxD is loaded, it will always clear eax and the Carry flag to allow
7 }2 P& q9 O; z. I8 G( ^& X! q2 c- E4 Qits handle to be opened and then, will be detected.
( d8 v9 \. h$ p4 g: d, tYou can check that simply by hooking Winice.exe control proc entry point$ L6 @+ E" i, t5 t
while running MeltICE.
$ R* p: ~1 z1 S' r
( e% f  `) p* K0 e  Q
* k" D/ z( I% S4 r; @  00401067:  push      00402025    ; \\.\SICE$ {( e- F7 M. s2 a, P
  0040106C:  call      CreateFileA
6 _) ]1 M2 Y  a  00401071:  cmp       eax,-0011 t& q/ U& G2 V# @) C
  00401074:  je        00401091
2 f: i9 l6 E% x9 F0 c' r
; Z, a& ^+ @4 T( @: {4 e! @, m$ z  \7 s
There could be hundreds of BPX you could use to detect this trick.2 Y, \. v$ P4 q( S7 P$ h  V3 ~* R
-The most classical one is:
+ o# g- b( {- N& q9 w) }/ }  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||$ q1 ^' Y# E4 s7 R1 Q6 j
    *(esp-&gt;4+4)=='NTIC': b/ Z  I; S! G. Z. r

* ~, I, Q  q1 a0 a-The most exotic ones (could be very slooooow :-(
' L, X, O5 g! B% H% ?   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  * y- }& f1 w4 H( g8 M$ {
     ;will break 3 times :-(6 F" O8 g' ]: h' _' z2 Q/ X" |* `8 m

0 g2 ^" R3 t) O" E1 X9 \, `3 n9 a+ g-or (a bit) faster:
6 }6 k' t" |9 p6 S, S& _   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')3 G  y+ B3 d  K; E- f+ ^' s
; p% I( Z. L9 K$ c/ [
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  7 m: W, F& ~% Z5 h2 I9 m& g
     ;will break 3 times :-(' ?5 o: m& x: |8 }) E1 A

/ f/ M+ W8 f" k! P# l  h. `+ @8 V-Much faster:5 u" @, P  _7 |, G7 U
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
' V8 j0 G; K' D9 I1 e$ y. y
) m+ V# B, R+ c$ I* mNote also that some programs (like AZPR3.00) use de old 16-bit _lopen
* b8 S2 A, g$ u. g. P6 D/ R# `function to do the same job:
* A% _; ^7 @- [9 W! m2 l# Z  Y+ |3 Y7 C3 z9 Q3 G1 j6 l
   push    00                        ; OF_READ
2 m3 U0 ^# ?8 }2 y4 j   mov     eax,[00656634]            ; '\\.\SICE',0. s2 @- f' S4 ?" E/ a
   push    eax
; |4 ]% ?# h0 [* s3 s9 l5 U0 v0 D   call    KERNEL32!_lopen( w* A! P+ g" e# f9 I( h9 C4 T) _; T
   inc     eax" _2 {: b$ T4 b: ^
   jnz     00650589                  ; detected( Q( w& X. l3 C# X' O6 F. E' z2 e
   push    00                        ; OF_READ- @3 c9 i7 o8 n- s  [5 ?
   mov     eax,[00656638]            ; '\\.\SICE'
: P$ E  Q5 X. w4 c: I* f   push    eax* u! W. k( J: f# x, q% ]
   call    KERNEL32!_lopen
8 L$ |1 E' |; c! P/ Y9 U8 f  R   inc     eax
: Z6 Y& v4 J$ T   jz      006505ae                  ; not detected
# A) p) T2 D. S; U" v, K0 C: m" i
0 a5 h: J1 H7 E! ~0 @
! q, E, m0 @* @5 }5 E, w7 J2 O/ K__________________________________________________________________________- v) {  v5 K% K% w
- L8 x. ^# P' s$ \" N& _2 S
Method 12+ K( u8 B1 U1 f( {" V5 G& |) ]
=========
' l) T5 ~# U/ z
+ j# V+ Z3 {$ FThis trick is similar to int41h/4fh Debugger installation check (code 05/ d# }0 B. ^; F% z0 g: J9 m
&amp; 06) but very limited because it's only available for Win95/98 (not NT)
. n. _0 g3 \9 \+ Q+ @as it uses the VxDCall backdoor. This detection was found in Bleem Demo.7 @/ C* L& I" `! a: }# U+ r

+ v- a; ~, E( V# z3 p   push  0000004fh         ; function 4fh
9 c/ W% D1 O& J  ~. G9 u! j   push  002a002ah         ; high word specifies which VxD (VWIN32)+ }( k0 g5 C- Z9 U0 B& r
                           ; low word specifies which service
  E2 i. f3 P* m; ?& g. T% i                             (VWIN32_Int41Dispatch)9 `1 Y, `% a8 _9 O( r( l, i: r& Y
   call  Kernel32!ORD_001  ; VxdCall+ y- O  n6 w8 E$ o: s' v
   cmp   ax, 0f386h        ; magic number returned by system debuggers
, |- B6 W! m# ~! {3 ~" T1 H* M' X   jz    SoftICE_detected8 W) o( H7 g9 {6 M  ]9 M8 r
& w# l2 C7 i1 N  ?
Here again, several ways to detect it:/ l% A2 {! t8 b$ F7 V+ F
# I+ C* z) t! N6 G4 F, T
    BPINT 41 if ax==4f* [9 c1 t5 i6 b* Y

% H& D% R1 c3 l2 q; s4 }    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one0 w8 |' J$ o" Z9 q8 x! j, N( A
/ R0 W* U/ Z$ n4 c9 q
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
  \& ~, s) B) x. o: t, B
! F- E6 S! }; r0 k! n. a7 S    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!6 G: n0 u; `9 U9 K  f7 b

7 t# U$ B2 T9 e! @8 g6 m7 q__________________________________________________________________________
6 _6 k9 O& I& V4 N& @( i
; m3 d* J! h- u3 [Method 132 `# ~' W" A( k: ^; D
=========
2 S: @8 X2 F' g1 ~' U1 Y
4 X- G4 S- S) s, Y+ Q  C3 nNot a real method of detection, but a good way to know if SoftICE is% ?3 |- ^0 J; w; _
installed on a computer and to locate its installation directory.
2 X! }$ U, ~- U( }: VIt is used by few softs which access the following registry keys (usually #2) :
9 q* W* m7 f" J9 R  o# ^. t1 E7 [+ v% M2 M. f
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
) r. C3 {7 r5 ?! [2 v\Uninstall\SoftICE5 o; K6 |' n) }4 b4 j
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE  U1 D/ `0 T! R# q" U7 \  H; z
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion8 G& u# z8 p) C6 }% {
\App Paths\Loader32.Exe8 P# \4 G3 l) o
, M: U. S. p) y
- o+ d# F9 P! r
Note that some nasty apps could then erase all files from SoftICE directory: [& J' |0 l' X' E2 t* f* W
(I faced that once :-(
! _0 H1 I! S% K- t  |
, Q# T! ]9 o" `& fUseful breakpoint to detect it:
& M5 J) Z& N# {/ n" l9 h5 d. M9 w2 G8 _  f3 Q
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'- L% S8 ]: e$ I0 F9 Z! _9 h
' s0 x+ ]6 |8 y
__________________________________________________________________________9 ?5 N5 W1 \' D
/ x, N2 r1 ^- U. q4 I
% f5 Z$ E4 f$ q; p3 |
Method 14 , ^6 H% N2 e! }
=========
% Z2 p  u6 M& K- ?+ M2 t: Z. K" O- n# _) [4 l
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose, e# M/ s3 s4 b8 t0 |) q
is to determines whether a debugger is running on your system (ring0 only).
2 B# `5 Z/ J! ^1 p* n9 k4 w& ?% n
   VMMCall Test_Debug_Installed
9 |# X) i' D. U; ]$ f; x   je      not_installed# I0 H' \; u/ ~4 D# F

8 l$ n" r# W& W3 ~: q& Q, X) _This service just checks a flag.
/ [8 [7 c$ }" q</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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