About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
  R9 `- u' B8 k6 J& R9 e<TBODY>) c! A) }8 E- N
<TR>
3 ~6 @2 @9 Y6 W( s# g<TD><PRE>Method 01 0 x/ t" m+ V3 B- ~  u( O# k7 N! {
=========
9 X: N" U9 N  S0 O+ J4 D' H% i/ P  G9 ?
This method of detection of SoftICE (as well as the following one) is
4 k/ |- y' T  |! Lused by the majority of packers/encryptors found on Internet." M& J5 Z1 u0 ]7 L) s- U" l: }/ v
It seeks the signature of BoundsChecker in SoftICE/ x$ t" r, w" v# d& g, Q. }! }* n0 U
0 S- U9 p: J- t. ]# n( X
    mov     ebp, 04243484Bh        ; 'BCHK'+ ~3 ^' E9 {7 n9 p# U1 k: J3 W9 o
    mov     ax, 04h5 R2 K. J- u+ ?, p1 ]8 |
    int     3      
: A' N1 c. {) q- X  U' M2 Q    cmp     al,47 l: B9 `7 V7 C( {6 X
    jnz     SoftICE_Detected; k# @' k1 `6 h; E9 i& r
  i2 A" C; Q) m1 a( k8 r
___________________________________________________________________________. J3 M; p" f3 u6 u8 n4 p
' M) v  X. y' _# x- b4 ]& r
Method 02
2 T* B, k, I4 ]% E3 K2 }=========2 d' L1 \% ]' y" U+ `

6 Q7 }: ^1 e7 c/ Y' N; }Still a method very much used (perhaps the most frequent one).  It is used
' H9 P% U( Y  w: K* Z5 N* C0 E+ Jto get SoftICE 'Back Door commands' which gives infos on Breakpoints,
0 l* R0 @! w6 m2 Vor execute SoftICE commands...2 O" t# u9 d3 F! ]5 F' K
It is also used to crash SoftICE and to force it to execute any commands
# b! x" I8 e8 m  p! X(HBOOT...) :-((  3 L/ d  k, p" r" ?$ ^1 F
- O+ F: D& g/ ]2 R
Here is a quick description:
; M6 m8 g1 j/ A/ c3 d4 V7 C-AX = 0910h   (Display string in SIce windows)1 ]4 R( n  H7 T2 z
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
* b+ V! K% o$ `-AX = 0912h   (Get breakpoint infos)
. W: t+ \/ H* y) n7 |-AX = 0913h   (Set Sice breakpoints)
% B' t. P5 \, ]4 p' o, h3 Q: i-AX = 0914h   (Remove SIce breakoints)
/ H! @! ?3 M  q9 N
0 a$ N$ c$ b  t: `) iEach time you'll meet this trick, you'll see:
8 N6 [% _# M4 u) U( A-SI = 4647h" d' }- c: P- k4 s5 d3 Y
-DI = 4A4Dh
' S1 F  D6 {/ ]: JWhich are the 'magic values' used by SoftIce.
' Q/ P: E- y7 z8 ZFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.
, v* M3 ~8 u. Q; o  J1 K9 q8 U( y" V& P4 H7 l
Here is one example from the file "Haspinst.exe" which is the dongle HASP) `  L: V5 A9 c3 ~) ?- y6 Q7 W
Envelope utility use to protect DOS applications:8 K0 N! G8 d2 q3 Y- C

" q- P$ w5 ^9 I) g8 v/ u! R& H/ v, Y, ]8 w4 \# t& k
4C19:0095   MOV    AX,0911  ; execute command.
( y: p2 G( Q: E/ V* E9 E4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
2 f- L+ \: [8 H8 m/ L4C19:009A   MOV    SI,4647  ; 1st magic value.
! W0 s5 z! U# X, v: S8 v) y  e4C19:009D   MOV    DI,4A4D  ; 2nd magic value.. b2 X8 T2 S0 n- \5 J5 Y( {+ p
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)  ^" y' B6 C! T3 w1 j
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
% e& ?: x, l) R+ b" C$ L6 @4C19:00A4   INC    CX
! r* f3 ~6 p# k4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
' C% n/ f& k2 _" m' p/ s5 _9 [4C19:00A8   JB     0095     ; 6 different commands.
0 z, Q1 H9 }$ ~1 Q4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
* f% J# D1 o2 f% \, Y4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
1 a/ `6 ?3 Y( ?2 J+ c
( U5 u4 C9 ]0 W# {The program will execute 6 different SIce commands located at ds:dx, which) B3 Q, h4 t2 @8 x4 I! t  k
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
3 y5 G0 F% I( `; _) n/ o: Y4 O6 `* F0 \8 B; M3 ?: a
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.1 d8 p* ?( N- k5 ]7 V; E4 p
___________________________________________________________________________
9 q  S6 J" g9 P/ I' E; Y, I$ J% I4 b' V; q7 N
3 i6 f8 G# f9 l% P/ w* T5 T
Method 03
; ^  [! z( D; Y: N2 b=========  N: [  @% C; n2 r* i( G

/ x7 Z' }! {% l  TLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
/ a  }) E2 ^1 B2 J, Z2 K(API Get entry point)
# {: C! b( J, Y5 j/ x4 z; Z9 ]: o        1 T* @. k% \) L: D
' y) z* G) R. v$ p: l3 M6 c$ @5 P
    xor     di,di# Z8 P* B) w; z! ?; ?" k1 B3 \! l$ l
    mov     es,di
( Z! k. W" w% u3 d" t    mov     ax, 1684h         w3 ]; K% C6 d$ }' _  Q2 N
    mov     bx, 0202h       ; VxD ID of winice& n: h5 I# n" @8 S! G0 s
    int     2Fh0 v  X  W5 u5 u0 N6 f
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
' `- a7 ]) i" J* Q5 `    add     ax, di
$ y& r  u  ?" z- F5 F  }    test    ax,ax: v, J7 e" n! |7 {
    jnz     SoftICE_Detected
1 N/ F4 F( W% @/ J
2 ~  R9 ?" b  a$ v2 R1 S0 s___________________________________________________________________________& K, g6 X! i& X- `+ N; E
% v- s3 H0 ~, d) l5 v% |* J
Method 04
2 {# R) d. x0 |( H=========
9 Z3 [9 [! E, e6 T9 }: G0 Q7 d5 I' W& b' H7 l& F8 p
Method identical to the preceding one except that it seeks the ID of SoftICE
. |9 ~$ g6 J) I: `% S4 ?9 F" MGFX VxD.! M7 |5 T, m% @  k: g9 C% V

# f7 [0 m2 t) }( L) u9 H! A5 B    xor     di,di
+ r5 D' C3 v7 P( g& z# X    mov     es,di
- ^# |; ?7 g  X    mov     ax, 1684h      
+ ?& g9 s& {, w- F" W( S4 o    mov     bx, 7a5Fh       ; VxD ID of SIWVID
, p3 {+ \* ?8 p% S% @- ]    int     2fh! O4 W. h2 I8 ~  r; N* G
    mov     ax, es          ; ES:DI -&gt; VxD API entry point8 Y8 E4 p4 n3 z) r3 ~8 s
    add     ax, di
9 C% b! H2 H- m& V$ R+ j    test    ax,ax& O$ c/ x( V8 T. U
    jnz     SoftICE_Detected
1 T+ n7 e' F0 ^$ d; F; c. m
3 i- |" a! j, K$ T2 a- P2 V6 \__________________________________________________________________________/ u2 [# D) W. {4 K

  F/ A- M7 d6 H( P! T% U' v, ]. O6 b2 F
Method 05
% P& ], [. Q7 j=========: B( H0 x) F, y

8 {: G. \" ]1 A- MMethod seeking the 'magic number' 0F386h returned (in ax) by all system
7 F# |, r5 U. m& h0 {1 Z0 G6 i. ?debugger. It calls the int 41h, function 4Fh., z: i1 a3 u' I! E
There are several alternatives.  
& {$ ~$ l; \# Q! g1 `9 o+ i6 m2 s$ O' g5 N( S3 W0 e
The following one is the simplest:
) e+ f7 f1 s4 Q* ]( J% F. ]& a: [4 U0 K
    mov     ax,4fh& R. V4 x, G8 V# G$ P* A' ]
    int     41h
& L, x7 s  h/ m    cmp     ax, 0F386
; |" c& E2 e& N2 I3 T' M    jz      SoftICE_detected! V; ^- Y8 P; ?" O
4 B- {  g! N, M0 F$ f

/ z# p2 H  ], v# `Next method as well as the following one are 2 examples from Stone's
; I5 C) s& G8 b/ y"stn-wid.zip" (www.cracking.net):
0 Q( y( ?, d3 F! v6 T5 ?. Z5 A8 ~& b
    mov     bx, cs
3 I! z/ K8 ]7 _" r) Q    lea     dx, int41handler21 u. G2 |% R" N) t
    xchg    dx, es:[41h*4]
$ r3 i+ a9 ~3 ^7 a* W" Y& C- _    xchg    bx, es:[41h*4+2]
4 H+ ?9 }% C/ ~; ~8 B/ J0 w    mov     ax,4fh
; f3 Q) e9 _& g. ]0 `    int     41h
$ Y+ l/ d  F0 D8 ?2 r    xchg    dx, es:[41h*4]
  g! R: N8 C# h* f# Y) R' R# U: q    xchg    bx, es:[41h*4+2]$ f/ M8 S8 i  e! r& v
    cmp     ax, 0f386h
6 C  [7 Y/ j) B& V; o    jz      SoftICE_detected. Y7 A5 h) N& c( B6 n6 j1 J9 K

, I* i5 y; a5 t: g; x) V' ^int41handler2 PROC2 j/ j. \5 E' ~
    iret
* @1 d1 y' r+ t9 {. Yint41handler2 ENDP
5 J0 V4 j" W. [4 p3 r$ R. O0 S6 u. c) ~2 B* I( s: l# o' E+ l

6 G# q" m. H8 @_________________________________________________________________________$ e, [- ]5 @* k% ], f5 D5 |/ `( U( S

+ N* E! z- O, H  z  D, ^5 J
  C8 v1 h0 O: w1 pMethod 06
6 i% Q8 N# ^: W9 A6 }=========! {, L8 G+ y% k4 c# M' X1 L
- s( p. `3 u0 P

7 T+ b0 V& H1 l2nd method similar to the preceding one but more difficult to detect:" z/ V2 M: [. B+ ]9 R5 N2 a( X& g1 ]. ]

6 S2 g% q7 w  W+ b# a! _  c5 R% A9 P1 \8 v+ T- t
int41handler PROC- L$ F% K' ?8 Y, m$ L* I+ k7 g& ?
    mov     cl,al, J  C7 W8 s( X( T! E* j
    iret! u' D" l+ `7 p, o% U, _: d6 d
int41handler ENDP
) Z% h4 M; b8 H9 T5 e% x
1 C9 z; z7 C2 ~% `" F7 z* x) T  U1 t* O( [0 L
    xor     ax,ax" f/ e" n. h9 l9 F1 y/ i4 c
    mov     es,ax
7 g7 `' @2 @. `+ L! r    mov     bx, cs
9 c& r) W2 z2 _/ B6 E9 R( E) z    lea     dx, int41handler
$ l& q7 P6 b7 a. H) T) p4 m; C    xchg    dx, es:[41h*4]
9 ]+ O/ q  B% y$ |: M/ w4 j& @    xchg    bx, es:[41h*4+2]
; @1 R6 X; T& A, g' @    in      al, 40h
3 _2 f; M3 Z5 z    xor     cx,cx7 `& T8 M( L2 \4 e: D+ N9 T- \
    int     41h2 u4 P3 C, u9 T, ~/ d% I8 F
    xchg    dx, es:[41h*4]
" i! j0 B' U' A, N    xchg    bx, es:[41h*4+2]
  s+ @# s$ b7 ], l8 O( }; T    cmp     cl,al
& ~- {: Y, G8 ~& q4 t* c* T    jnz     SoftICE_detected+ y6 o' K+ E$ ]' b5 F% W
- i( T4 v2 e5 }
_________________________________________________________________________
: f( y: Q% m  a$ ~8 Z; m# l, V+ ~' G" {6 e
Method 076 X7 b7 h. Z6 e0 x( x5 r
=========
: W  [* G' s- a, |: V' G' [- k; E7 d2 Y6 ^# |4 _- B& o
Method of detection of the WinICE handler in the int68h (V86)
: I6 k3 N0 ?1 e8 o9 P' h3 e+ O! E8 S+ i+ t% Y8 }( S: b4 K
    mov     ah,43h
, Q8 m9 C$ u2 K: I' \' F4 ?: i* J; P. j    int     68h6 N. m5 f* a5 J8 x$ N0 Q
    cmp     ax,0F386h' h  ~5 T( b. S4 u
    jz      SoftICE_Detected! c) _2 {) B# V  k8 P) U! j  A

% @/ S+ {* _* |; x4 q( V* Z, S+ q  U9 k
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit' t  n, }9 ]( K4 f$ U/ m8 V
   app like this:
: s1 n+ \7 L* O) r) _: m' }" L- W: V
   BPX exec_int if ax==68
" Z+ i7 m! b3 u   (function called is located at byte ptr [ebp+1Dh] and client eip is. ^5 {: L, V3 e+ Y
   located at [ebp+48h] for 32Bit apps)
+ o( w* g! T# K__________________________________________________________________________9 [+ y3 f. k1 @. y

$ L1 I# C0 [  @
/ V- l: k/ i# j* I2 J8 xMethod 08
! Q7 B* B" `. C=========
- P7 B* {, }- ~; ~' W& l% D2 M" b4 |4 p( v" B# n
It is not a method of detection of SoftICE but a possibility to crash the
4 p" Q! y* f9 y7 C3 usystem by intercepting int 01h and int 03h and redirecting them to another5 M! R7 Z' u3 F) x
routine.! @/ L2 x5 [3 U
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points9 L7 W$ F% U. Q! D2 Z7 u- l' ]1 M
to the new routine to execute (hangs computer...)$ q4 w+ w+ r  X5 ]5 `! v

* O+ x  `# W' [5 E! u& Y# {, E    mov     ah, 25h
6 A5 Q- W! S7 N6 b; Q  Q$ O    mov     al, Int_Number (01h or 03h)$ C2 u5 b: K* D4 T
    mov     dx, offset New_Int_Routine+ G( T. e) S' [6 X' P
    int     21h: i) w: }  i4 u6 r; I# x: Z" `
  k) D7 P. M  _$ B3 ^( R
__________________________________________________________________________5 \& _% U5 E: s  t# w" S: [

' k. v5 [$ T: n7 a3 [# |. _& H8 Q; ]0 oMethod 09
  ], K; e, T- O, w6 @" L# ?=========
$ L6 u4 b% Q; g; j1 R
. D5 h- |$ f8 mThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only" j! f  n4 s( c5 ?
performed in ring0 (VxD or a ring3 app using the VxdCall).
6 j2 L! z% g! A8 z+ _The Get_DDB service is used to determine whether or not a VxD is installed
! H5 @+ [# g$ Q" S& Dfor the specified device and returns a Device Description Block (in ecx) for
* {( m% E5 H% y7 H& Rthat device if it is installed.
; K2 m% `  k5 ?( w2 N& W/ w5 }; |5 @$ u9 m3 Y. F
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
1 ^" i: R0 H& ]& i% e. v   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)6 R" \! i% J# M% U7 g0 g
   VMMCall Get_DDB
0 l3 A+ l6 z, a7 [8 P  z+ d. O   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
4 M8 U0 L5 V+ ]* m' V. E5 v! D0 ]0 H7 P, S8 A5 A- e
Note as well that you can easily detect this method with SoftICE:& W4 g! q1 H) P3 C* ]7 ~' W( o
   bpx Get_DDB if ax==0202 || ax==7a5fh+ L; D7 s/ D  @; Y0 g
7 `& s! {! F- ]8 }$ N
__________________________________________________________________________
3 f5 ~( s' k9 I: ]8 d8 _& o- ?! s+ s9 {' ?' k: `
Method 10
4 g1 w) O/ o0 t8 F0 x: _=========
0 g! b: w! l) F1 z0 W' p! Q) A# H' K
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with3 v9 ~7 ?- C/ D
  SoftICE while the option is enable!!) H( p7 s' O  d, }, f( M
( `# t* `+ G6 S# C  ?8 G
This trick is very efficient:8 f* C9 k2 l7 v, ^; M. B
by checking the Debug Registers, you can detect if SoftICE is loaded# Q; c7 `+ r! B
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
2 M- F/ X4 ?- f6 p+ vthere are some memory breakpoints set (dr0 to dr3) simply by reading their
' @* E- K. I( w( V1 b8 c9 A2 X1 Pvalue (in ring0 only). Values can be manipulated and or changed as well1 s4 s9 h7 r6 O1 z+ e& n
(clearing BPMs for instance)
/ }1 {0 K0 s5 g; O! P4 x+ d3 l- [5 K7 [5 o
__________________________________________________________________________
7 ]8 ]" K  u7 [& K/ U1 v
  l; `& B9 t8 h2 Q2 xMethod 11
5 B" C5 `5 L/ X) ]" s6 B' _% q' t) p9 k$ t=========
3 h0 ^# j* W+ i* b0 \$ M- ~, u. S4 z
( H# I( `: M- \3 V, |This method is most known as 'MeltICE' because it has been freely distributed
  o+ A2 ^: x1 m( L2 m' Cvia www.winfiles.com. However it was first used by NuMega people to allow
8 s5 n8 k# I) O& l2 O! oSymbol Loader to check if SoftICE was active or not (the code is located$ Z6 D7 L6 N5 B) a. @. v8 }
inside nmtrans.dll).
+ N7 \1 c7 Y$ [0 @5 G8 r3 \
. p* v* B0 L+ F3 z" ?/ Z% I& oThe way it works is very simple:& F7 J: d+ p) f2 x1 _: ^2 q
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
8 a4 b$ K9 c+ g; |1 o) z4 eWinNT) with the CreateFileA API.* v$ A$ O( ]5 [0 M/ T8 C" W
: K: A* r* l" l7 w; ?4 }) p6 {
Here is a sample (checking for 'SICE'):5 E7 _2 s# g5 n0 h% F" L
8 e; a" }( T! y! k- Q, [
BOOL IsSoftIce95Loaded()
5 \% o: L5 Z. M4 O$ s: l{& ^0 r0 E# u' z( a4 Z5 x. j
   HANDLE hFile;  
  {( a+ s5 T+ s, e" `8 g2 [/ ^   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE," z6 f  O8 X6 F) @8 H/ U- T1 N
                      FILE_SHARE_READ | FILE_SHARE_WRITE,
9 P8 o8 n7 l& p( m) Y                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);* [/ Q- [5 m0 V( \8 \2 k& N
   if( hFile != INVALID_HANDLE_VALUE )
3 n+ H& t# L/ l1 R8 X   {
  a: ]3 R8 l; a      CloseHandle(hFile);
% S/ G1 w$ d; }2 H: y      return TRUE;
3 _+ g' j( i8 W; k1 y! v   }
1 }# P1 O) Q* W   return FALSE;
6 }% Y/ `: n; F" [6 F9 W}
5 ~& v- ], }+ p( |0 C: {$ ]% L0 }- D( w7 N
Although this trick calls the CreateFileA function, don't even expect to be! k- {" I4 O. \) d3 {( @
able to intercept it by installing a IFS hook: it will not work, no way!
" o) F" g' `$ |8 N7 Z+ IIn fact, after the call to CreateFileA it will get through VWIN32 0x001F
8 N" S6 }5 [* h: `9 Q8 c, J& |1 Fservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function); u; t& B$ M& |) P- j" m% R
and then browse the DDB list until it find the VxD and its DDB_Control_Proc$ i1 z  G0 Z  Q# d# a7 r4 C
field.
" |+ a; v( [; Q0 E3 t3 x% _2 oIn fact, its purpose is not to load/unload VxDs but only to send a
6 x2 l7 }5 I5 y1 QW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)6 A" f2 U6 P- R- f) j4 n1 `; d1 F
to the VxD Control_Dispatch proc (how the hell a shareware soft could try/ g2 {3 Z! e' h6 A0 a$ ?
to load/unload a non-dynamically loadable driver such as SoftICE ;-).
# L% L8 P, u- U5 [* D: O9 OIf the VxD is loaded, it will always clear eax and the Carry flag to allow
& W: }3 N- J6 R5 U3 mits handle to be opened and then, will be detected.+ h5 t2 @' m! D5 K" f2 K
You can check that simply by hooking Winice.exe control proc entry point
7 L; `+ _6 _5 R+ x5 [8 G% twhile running MeltICE.
  n" L6 D8 ~2 `3 Y- Y6 h% F9 w
1 Y8 q  }: B. D. P" Q% W1 R3 p, O6 z9 I& F6 n
  00401067:  push      00402025    ; \\.\SICE5 }- ]( q8 e6 ?. U7 ]) t
  0040106C:  call      CreateFileA6 U2 y1 ~1 b: _) l% i
  00401071:  cmp       eax,-0012 U( i! y# ]+ O1 M  ^
  00401074:  je        00401091* F$ z$ k1 |2 o; k

, v  b# `2 Y+ P7 e5 v6 i; q+ u( s: j, n9 x! I
There could be hundreds of BPX you could use to detect this trick.
  c- c7 ~9 H2 X/ G+ k  P1 e$ W% z/ B-The most classical one is:7 V. E4 y) l' }. j2 i9 a4 K8 t& u
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
8 a5 x8 {1 T/ u, I* ^    *(esp-&gt;4+4)=='NTIC'. l( O+ U3 Q1 E/ U

2 D( f1 O5 e% {-The most exotic ones (could be very slooooow :-(
8 i* W" Q+ X1 J+ N  ]   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  % Z9 e4 _4 q! J, x& N1 F
     ;will break 3 times :-() \8 H: _# @( ~

5 _/ e7 H8 @) R2 Q1 v-or (a bit) faster:
9 E( z+ p+ Z' m   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
. e  K# P7 ?9 t2 |2 p; K6 n( W# I9 c6 Y" K
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
  A- o) Y+ A' f! y: A     ;will break 3 times :-(
. `) a; `# Q# }1 ~- f: B
4 z, P8 P3 K6 _* _6 s: R-Much faster:
* F5 d, y, D9 Z: ^$ U   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
' j0 ]. g# Q4 H" f9 y, f" O8 o. k" u( R6 H7 f8 a
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen$ S2 e/ n0 D" e: ]- a* Z
function to do the same job:
4 G) [1 e8 e' Z/ L$ C1 n: l' V$ u" d
- Z. x& P( C# q3 i3 f   push    00                        ; OF_READ# I) J# f  P  B8 k# a' x; ]
   mov     eax,[00656634]            ; '\\.\SICE',0
, y8 Z& h1 E- s5 X- j. q. W   push    eax; S$ R  Y7 K3 L- n5 T% i3 v
   call    KERNEL32!_lopen
. E! ?9 C: D& u7 ?) C   inc     eax
" r. X9 G6 h6 Z5 M1 W& w) i   jnz     00650589                  ; detected
0 U8 }& J- Y1 H  H+ g& \2 n% c/ G   push    00                        ; OF_READ
7 z- j/ j% V: v  Y5 ~# y- F1 s   mov     eax,[00656638]            ; '\\.\SICE'
2 u, w9 W* ?/ S; U   push    eax
4 I# M9 D' q1 H   call    KERNEL32!_lopen
5 j- D7 H/ ]4 o' n/ K  W   inc     eax
& J5 s% `2 M- r( p) b; E   jz      006505ae                  ; not detected( C1 C3 G7 X  J+ t
- t# u: ?/ }+ ?- n( H0 {2 w1 L
* \- y7 c6 ~' q) a( v
__________________________________________________________________________
0 U& c2 e6 B$ [, n  Y
0 C& r5 Y! d( G. V, Q, f* L! ^" e! WMethod 12
' D9 P( l- F6 t0 v' v4 i=========
8 u; }& D0 R5 q! C1 R3 U" Q. i- u  I2 y/ w
This trick is similar to int41h/4fh Debugger installation check (code 05
! S! U: O4 \( s7 O&amp; 06) but very limited because it's only available for Win95/98 (not NT)- e1 t0 T6 d1 F* \
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.$ z9 M! i8 q. Y+ o. v
  T" H2 K4 g2 z4 g/ E" B* K
   push  0000004fh         ; function 4fh) m' K9 `1 @' v. K/ v* F! R! |
   push  002a002ah         ; high word specifies which VxD (VWIN32)
$ a5 z. Y) m! [3 g# o3 c& w$ W& l                           ; low word specifies which service
( D* B& Y4 p/ ?, q9 N                             (VWIN32_Int41Dispatch)- Z4 C5 l' Z) t& |) U4 v& |
   call  Kernel32!ORD_001  ; VxdCall) k- A' s) f1 W; e8 S( u
   cmp   ax, 0f386h        ; magic number returned by system debuggers
% w& e7 l% |; A0 D7 A   jz    SoftICE_detected" l9 R, ]) R6 `# G+ H

4 ]; f" D* d  n3 p: n/ r8 Q; MHere again, several ways to detect it:8 ~2 x8 O* \2 \/ x* \2 L

6 H; C' i  Z. j+ C7 y; t    BPINT 41 if ax==4f9 s* _. Q2 v3 A6 S( K
6 j" w9 C& _+ ]1 X! D
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
2 w/ l: E7 R" s' X; B( v- W3 f% d" e
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
- V  V1 ?# Z( N+ W/ o! U+ T: `" q3 r4 u, y& q& Y( ^0 T  M( U# X8 G
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
0 i" K: [% U" Q$ m$ z* a8 D
6 w7 h. V4 c4 [, R, C__________________________________________________________________________/ p) a) S" S0 a  o) Q

% K& f: ?7 A- \' o" K% E3 L# k. sMethod 13" U1 F! E, ^" |: j" Z. A* t
=========
  y! p4 R8 d( T6 J+ F2 E! m. L8 \
2 q. s& L! ^8 q# O4 ?0 [Not a real method of detection, but a good way to know if SoftICE is) ]9 f) s1 r4 e* Q4 a( X! H6 A
installed on a computer and to locate its installation directory.
/ b/ T6 S2 s$ m$ F8 m/ KIt is used by few softs which access the following registry keys (usually #2) :
/ A9 X6 r, W. P# I
8 J0 k* R" a# h6 U& g# K. `; Z' Z! z-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion7 J4 b8 `+ v7 }1 N6 t
\Uninstall\SoftICE% _- M& X6 i6 f& r5 L* ]
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE% j) ?7 ^$ e9 P
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
. o: H  Y/ h" _: u\App Paths\Loader32.Exe
& B7 Z6 ^% i0 \' A8 _. y& q
! V9 S2 l9 v& A) D
0 Z; G. j6 X- d; ?7 y5 c3 N3 m1 INote that some nasty apps could then erase all files from SoftICE directory
% z7 m3 {% N- j) [(I faced that once :-(, Y$ x& }0 g6 }5 J- K
  L# x) g; ^2 S8 W& C# ~' n
Useful breakpoint to detect it:5 P, I2 {; c7 p6 K/ j. z) a; R! L

) w( Q* @* {* |  J: A     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'% B$ _+ B3 |% u( Z& W3 h4 @

' o1 S, G, g" |- y; K' F__________________________________________________________________________
* Q. N6 N  O2 B) q: R0 i
+ j- T6 m% e, q$ i9 L, i" L7 O: N( X1 X0 f; B
Method 14
9 H% @3 f6 W8 v: K& [& \=========
) I2 J7 }; Z) b7 N; q& A  ~! K" ], ?' p4 R4 S9 b
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
  Y4 c/ \# d3 z8 @, dis to determines whether a debugger is running on your system (ring0 only).9 o* |0 U$ T5 N, S
6 p# u+ K3 ]$ O9 @1 H
   VMMCall Test_Debug_Installed
! F% G8 F7 V7 {. c: s" h2 t8 W   je      not_installed
0 k* ~& A7 J) w7 O( X# C0 \5 h& b' S
This service just checks a flag.
# H/ y( M& P/ ^  I0 v</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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