About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
# N0 y: `- E; y$ q. O<TBODY>; k, n% p/ J8 ?) T. g
<TR>
: E5 }5 H6 q/ ~4 g, t<TD><PRE>Method 01
; H, H1 ]% i0 X5 V1 L1 L. Q+ h=========
) ^1 i, F: j, I) M8 x1 g' L. u0 f# @2 V
This method of detection of SoftICE (as well as the following one) is
- d" K9 ]0 [2 v* f- ~5 wused by the majority of packers/encryptors found on Internet.
* C8 I+ N) H" p1 iIt seeks the signature of BoundsChecker in SoftICE5 A8 O! A, p2 H7 k
  \" s$ m( N) b9 K8 _
    mov     ebp, 04243484Bh        ; 'BCHK'# U: E8 G5 b0 x5 K6 M  R5 Q
    mov     ax, 04h( o! S6 X! Q$ t: J: G, Y( X7 l
    int     3       9 l  i. f: O8 |( \
    cmp     al,4
; b/ X7 K+ G' I" z    jnz     SoftICE_Detected
1 z8 S* Y9 F1 d; j
) i9 Y* r% J$ o( S___________________________________________________________________________
+ @3 P5 Y0 U$ R8 X: m% I! }% v7 }, [# W3 J: R" T( a
Method 02
( D9 d* O) |8 x( Z; Q=========
+ U$ R4 V) p9 S$ W2 U/ w
  H2 P& j9 q) j* Z1 \! s+ Z% `! pStill a method very much used (perhaps the most frequent one).  It is used! \/ f. F% k3 M, l" E& d
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,: w. f; \+ \# Q2 j1 u) \7 f
or execute SoftICE commands...+ N8 m' q; D" \  C8 z
It is also used to crash SoftICE and to force it to execute any commands- L! z3 @! P3 j2 `
(HBOOT...) :-((  
9 c3 M  ^# G7 D# V- Z6 L# \  q0 N8 U1 ~- g
) R8 n/ t) a0 n9 K4 O3 f# _+ oHere is a quick description:
7 X1 [, |) h  M/ ?5 L, d# F-AX = 0910h   (Display string in SIce windows)
' b+ D" s% u4 W& ^0 d' e0 }-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)6 t3 O4 f( {5 R3 u/ M! _  y2 F4 ^
-AX = 0912h   (Get breakpoint infos)- D$ \# y& w% m" [0 \7 E# F2 R8 b
-AX = 0913h   (Set Sice breakpoints)
. h: \) z' |) a( O1 @- k0 h-AX = 0914h   (Remove SIce breakoints)
6 ]: w  C( \/ @6 i) K& d8 f* [9 g+ u
Each time you'll meet this trick, you'll see:
' i3 r5 l# S. e" g* f6 B$ Q9 D-SI = 4647h4 |$ T/ g0 u3 j" l
-DI = 4A4Dh
+ Y2 x! @1 x! F+ k6 L7 F! ZWhich are the 'magic values' used by SoftIce.! V# ~, }% n3 E
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.7 D. _6 N' x' Z' P8 u, v5 @5 z; ?
8 T' @8 ~. {9 g2 _
Here is one example from the file "Haspinst.exe" which is the dongle HASP0 h9 i* P! G  Y9 ]
Envelope utility use to protect DOS applications:
& k* h8 Y0 c7 T
: t6 u+ O' F( u4 G- B6 L5 G& X5 r. Z" X- C: S! U
4C19:0095   MOV    AX,0911  ; execute command.
' f, [: k- `+ P% J3 V$ N$ _: @4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).% ?) c" ~: @& q9 d  @3 i
4C19:009A   MOV    SI,4647  ; 1st magic value.) z( T2 j6 M3 y1 x" G3 }
4C19:009D   MOV    DI,4A4D  ; 2nd magic value., H1 T& {* E1 w& P! _
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
' D5 X7 M! B8 L; z( y1 o3 c. X4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute  r" S; H+ X; Y; Z+ H
4C19:00A4   INC    CX
. ~2 U- I5 o& ~$ A4 Y3 m3 C% S4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
5 c5 f" u/ g2 m& E, ^5 q4C19:00A8   JB     0095     ; 6 different commands.+ D9 c- g0 r7 ^# Z) X
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
. S1 K/ d) }2 X* ?! b( E4 \" N+ G4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
( e1 I! U" Z; N) T+ a6 f0 e
/ I9 L( f5 ~3 @: @% G1 T6 |4 xThe program will execute 6 different SIce commands located at ds:dx, which" y6 W( H! K0 F9 C/ t# I9 X$ C2 R
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
- [" d9 k( i4 W5 c  v8 e% ]% p( m  \, ?, N& G( ^/ n. _
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
, q, @) @6 C8 K# k2 t0 H___________________________________________________________________________
" W+ E0 i$ o, P+ t6 V+ Y4 f3 @
* a* I: F: {$ S5 T  m8 x- G
$ g) K* N8 y1 A( ~( [1 cMethod 03
/ k9 x- D5 h7 L=========4 Q2 ]% ]) Y4 |' g( ~. h+ H; E+ T
9 i  [. C& J- J. v# D9 |. P5 G8 t
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h6 \  h; K+ c3 L5 u1 M& t6 t5 ]
(API Get entry point)
" v5 V# `4 o3 D1 m( y$ Z8 t; ^        7 O2 y( I4 M9 u( D. Q) F
% j5 N) x5 r# N" w; p
    xor     di,di
  k2 s9 F* b  ?) c4 D' r/ d& X3 c% b    mov     es,di- z+ D6 f( {6 M7 |" E# i, y) R- a
    mov     ax, 1684h       0 g0 K! `. X% K- e: c/ L
    mov     bx, 0202h       ; VxD ID of winice
* E1 b' g- Y8 m* `1 [* z. [9 v7 M4 J    int     2Fh! h7 a8 U- h, g0 H: c
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
0 X3 g3 H# ^7 \' s    add     ax, di7 g+ h% _1 S0 ^- w. G2 N9 t
    test    ax,ax
2 W2 y2 R: w  q    jnz     SoftICE_Detected+ g) y# B, ^8 U% M

$ l, K5 x, }: O0 w2 }0 J___________________________________________________________________________) v- }  o0 p6 {4 j
1 _1 A( e: e3 E
Method 04; ~* p/ ?- D5 Z) B% F
=========
- Q% B; C8 H. Q
4 o+ c, j( L3 W1 ?( B' e% F3 JMethod identical to the preceding one except that it seeks the ID of SoftICE
2 [" k" l( k  f; P0 p( [: bGFX VxD., A. p# f9 N# k% _

' ^' L; s4 W# K  U1 C2 }7 j  J    xor     di,di+ \8 X2 C7 d7 i
    mov     es,di5 _4 r7 q+ V) {4 q4 Q  f3 b3 K
    mov     ax, 1684h      
! e; p; {  E( E- g# m    mov     bx, 7a5Fh       ; VxD ID of SIWVID
1 t" `; f# J" e+ z9 U    int     2fh" e& V. _0 Y- S0 p. h
    mov     ax, es          ; ES:DI -&gt; VxD API entry point. z2 _! l" V7 B/ d! V- y
    add     ax, di5 a+ A* ?4 X8 k: ~0 T
    test    ax,ax
! t/ F- |4 V- R: Y+ S+ ?    jnz     SoftICE_Detected4 ~# |/ Y; _; T, |1 [* d1 C4 m
8 d* f4 S) I- m  a$ W
__________________________________________________________________________! m: i1 a3 K0 h, e+ Q$ R

( ]7 E# X/ x. A5 ?+ o2 m2 A$ [" G* k* D. [
Method 05" X6 F; A) O2 g5 M: A6 C
=========! }8 x/ H" o3 i! e  |) q$ H
( A$ l+ l  @6 a1 O9 ~
Method seeking the 'magic number' 0F386h returned (in ax) by all system! X9 X* a( O+ X8 g0 y/ L
debugger. It calls the int 41h, function 4Fh.
+ W$ {  Q$ R) ^, e% pThere are several alternatives.  ; N" x! A1 }% E. |

. O, w6 N/ \9 |& h; aThe following one is the simplest:
( [, l: u& k) v4 n( T* k! @; [8 S# J
    mov     ax,4fh
, K7 e* v' z9 x    int     41h. t$ T) x; T: j0 f* M5 g
    cmp     ax, 0F386
% `! U* w, y9 w, y0 `4 O+ ?" j    jz      SoftICE_detected
% i; E& X% T1 y1 C3 d; E8 K( R0 c
8 I( \' T' [9 C( n* j% F9 y; \7 l
Next method as well as the following one are 2 examples from Stone's ) v9 A, k3 u) A% Y, C- y
"stn-wid.zip" (www.cracking.net):% v; \; s% |. y- T  V" ~
: u5 p) P; o+ `$ I4 n+ ]
    mov     bx, cs
# E/ x, K" ]& }6 K    lea     dx, int41handler2- i, U. `  s; \* ~1 i8 R' `
    xchg    dx, es:[41h*4]2 Q# n0 F0 W* z: V# p( r1 g& S
    xchg    bx, es:[41h*4+2]
' Y/ b; z( M: l4 @. O6 x    mov     ax,4fh! n) q6 q' e2 j- _1 A. [9 ^* l8 r4 e
    int     41h' a# J4 o% I- o" w5 f. k
    xchg    dx, es:[41h*4]
1 m  s2 H4 _4 M/ Y: n% e    xchg    bx, es:[41h*4+2]
# A3 y' ~* l1 l* I$ R    cmp     ax, 0f386h
( n3 R5 ~0 L& C- a# \/ `    jz      SoftICE_detected4 Z9 l4 w8 B  s# k+ o2 q

$ J# S  z. _( R9 sint41handler2 PROC' ~9 {2 W( _% t/ F4 k% b: q$ F
    iret: d  a9 i2 V, t
int41handler2 ENDP
* I1 b3 c5 X$ c6 G) T+ |, d; T
7 V- P8 ]5 s; `: t. N4 x
8 R. ]/ q3 y  n_________________________________________________________________________
% r2 X& h3 S* b( p9 I9 u$ A9 n9 k) m2 s

  ?2 D7 N" x7 ^0 EMethod 06
$ A. i- F$ d7 r6 h3 P8 D- U=========) u3 b& X% R% F5 `8 g" r: \
. ]" q  k- R3 D

3 O2 g: ]8 T, [; \8 ?' O+ u$ w$ V# [2nd method similar to the preceding one but more difficult to detect:0 W1 V. E0 `' [5 z! t1 \( C  G
( G) h1 E4 Z4 D3 Z6 X

& o7 @, I- \9 L6 p1 w2 o8 m0 i& kint41handler PROC
" o3 k7 `4 K0 S: h- X- ?) C    mov     cl,al( o0 C! D3 Y7 y& G
    iret
* t( E  K; V5 r3 Sint41handler ENDP( c7 c: j* A# h9 B1 S" x

/ h. F: q  g- U* h! _+ N. R- c( u& K' A; q0 K. l! A
    xor     ax,ax6 q8 w& Y4 N$ L+ j
    mov     es,ax" G, M1 I# f# ?$ [/ Z6 v
    mov     bx, cs
- T% ]7 g# }$ O+ W, q    lea     dx, int41handler
; h0 |' I: b* k3 r/ w6 E    xchg    dx, es:[41h*4]9 k) [; S- P5 G3 @: X
    xchg    bx, es:[41h*4+2]9 a' D5 r% r8 f: P1 V9 k: n6 w
    in      al, 40h
6 a  J5 o8 R/ o6 l- q0 \. H# s6 q1 o    xor     cx,cx! L2 l# n3 U' b- L1 d
    int     41h  Z0 Q9 o" Q4 R* L: ?
    xchg    dx, es:[41h*4]/ B) @3 c4 c& Z' K$ X- W1 n+ V: S3 O
    xchg    bx, es:[41h*4+2]$ {: c# U! |9 ~5 p
    cmp     cl,al! B3 O' x/ h8 j% n  w6 ~
    jnz     SoftICE_detected: E  W1 d3 }! ]+ d. f! [
* A+ e! |" k+ `
_________________________________________________________________________; A3 }& N3 x7 r- S: L3 P. D, P1 w' C
+ v; [" ?0 c9 J2 @3 c
Method 074 i0 g' L5 {, y' c
=========
, F4 ?1 j. v4 U7 d$ q
: A* ]- `. G& j' Y. P& aMethod of detection of the WinICE handler in the int68h (V86)8 i5 i( \( Z. {9 G

: `7 [& Z* d& y    mov     ah,43h" O: B, G5 V5 \( b* X  X
    int     68h: @* c5 l6 i# f$ s( w
    cmp     ax,0F386h. O: A0 M: U$ D  c7 {
    jz      SoftICE_Detected: E1 J5 O" F6 _: t% A

; M  k: X" I% k1 O" r9 e# }6 T( U$ ~0 o" }
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit3 t. \1 C* G1 S5 e( a
   app like this:6 I5 U3 b; _. m& {: u
+ C: d5 g+ c: Y6 B7 {% N
   BPX exec_int if ax==68
* ~- H* F6 ^2 [1 R! k   (function called is located at byte ptr [ebp+1Dh] and client eip is- G+ L5 f! k! n1 x& g) s: `
   located at [ebp+48h] for 32Bit apps)- z' a4 ^7 Z! d/ b7 \( |
__________________________________________________________________________  N  G, e( {' r2 i: I* h- J1 g* k

$ _7 @2 L) H9 p; T* C
5 _1 C0 O5 p/ h0 H( [: yMethod 087 [$ u0 U' N0 ^- j! I/ E8 ?2 g
=========
/ N" I) r7 l& n8 R, t; }2 y% T( [4 u4 o7 [' w
It is not a method of detection of SoftICE but a possibility to crash the
' u/ m, b+ z0 k) \system by intercepting int 01h and int 03h and redirecting them to another- |% z2 l) H& b& @$ l% P
routine.
0 z; V/ _6 R4 ~0 s2 xIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points, w+ `, N$ R$ l  X2 V, a6 M
to the new routine to execute (hangs computer...)
! H) E2 ~" V6 I, K+ z7 L. f9 q5 i1 k& c; U/ a* G2 {! O
    mov     ah, 25h
0 h7 ^8 K/ m3 z' E' k    mov     al, Int_Number (01h or 03h)
: Q( h7 b# w! _2 P    mov     dx, offset New_Int_Routine( L: ]- u+ I9 e3 @
    int     21h) u  V$ ]# w. P1 \2 H
* t# `2 X" U" l: H
__________________________________________________________________________2 {) J* }  E& v! R) N
) y) ^8 f! l$ z  Y  }( }
Method 09( R2 M4 I0 l. e* [. r6 r
=========0 P, S/ I. r! ~- s( T+ s2 a6 R

% }! a7 `1 k9 @* ^0 l* D! y1 H" O/ cThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only0 q1 n$ ]4 [: I8 @1 N
performed in ring0 (VxD or a ring3 app using the VxdCall).
6 `: E# U% p0 E3 u2 JThe Get_DDB service is used to determine whether or not a VxD is installed
% l4 W/ r# \1 w3 r8 l' Dfor the specified device and returns a Device Description Block (in ecx) for
, n. }/ A: R/ M1 U4 s; r/ w- [that device if it is installed.
( u' M4 @+ B9 Z4 B
: i0 Q; _) n4 Y   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID8 _# u- G; [/ W2 w" P! d
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
- N) i% R; m* Z" ]: C# e   VMMCall Get_DDB
* m/ T0 u; ]3 H1 A   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed# U" z" k/ ~8 _/ |
( k/ b: F& A9 ^3 {, C3 S4 Q: a
Note as well that you can easily detect this method with SoftICE:
# b0 l0 h! ?5 A0 }- P   bpx Get_DDB if ax==0202 || ax==7a5fh: h; w% Y( P* {" ?1 j
! r: q4 q+ ~+ [
__________________________________________________________________________
5 o0 n' z8 b+ e$ _) L* `
. ]1 \5 D/ Y& WMethod 10
/ ~" r7 ?- _* l=========7 t/ ^! D  q; h8 S. P% r5 b
! J+ o: z2 g' \5 Y6 e. q$ I- J' H+ r
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
& d- G' s: P0 Q* r; c8 F  SoftICE while the option is enable!!
1 H( g0 U# b/ g( [0 p
+ Y* v( {2 z$ y5 m' Z1 UThis trick is very efficient:
( c3 G$ j5 N* P( B# R$ m; Z  G0 Dby checking the Debug Registers, you can detect if SoftICE is loaded
, \- R0 Y0 R' U/ N/ l! `(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if* E) S' n: z9 V3 o5 h% O& a
there are some memory breakpoints set (dr0 to dr3) simply by reading their
# [& A" N( M8 A: b2 R  dvalue (in ring0 only). Values can be manipulated and or changed as well5 q( g4 q. O. P! z- u# `: b* Y& N1 s
(clearing BPMs for instance)
$ w6 m/ S% S7 W: w( m1 e! A" [7 o1 J& R% b9 N( K
__________________________________________________________________________
" D; T7 m6 _7 G( _- n$ K1 b
3 u6 Z$ K9 ^- tMethod 11
+ L; b- p; S' m/ {8 J8 E=========# f2 r) K8 N5 |. v
& S8 z  E$ s+ C0 A1 U
This method is most known as 'MeltICE' because it has been freely distributed
3 q: ~5 O" P7 X% A6 Z  bvia www.winfiles.com. However it was first used by NuMega people to allow/ x( Q) h" r- S: U1 |- Z
Symbol Loader to check if SoftICE was active or not (the code is located
# d. [  x" t' B+ hinside nmtrans.dll).
) [' a" C: B" z+ Z/ @; v& X6 H1 E
& ?7 V1 \' k! w' nThe way it works is very simple:' d, Z! Z" u1 N* G" D8 X$ @" j$ @5 M" i
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for2 S8 S* A$ {3 H
WinNT) with the CreateFileA API., f1 P7 R9 `4 b1 X- g
7 f% k3 S  ]5 j" U2 Z
Here is a sample (checking for 'SICE'):
5 B# {9 h) i" S! E8 u6 K; t! j' N* x2 y
BOOL IsSoftIce95Loaded()  y3 S) O; ]5 G# c  O1 l2 \. O
{
3 E/ Y# y" A% a! @   HANDLE hFile;  
" A8 v9 E; W3 `# h/ G; Y   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,) u0 J0 t3 O6 p: u5 M" t  U
                      FILE_SHARE_READ | FILE_SHARE_WRITE,
) ^: D8 h' E, C( s" W& U, Q                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
5 e' c3 q" \9 t; b' W   if( hFile != INVALID_HANDLE_VALUE )
: E2 {1 A# W. e8 g! P' P   {, s- F& m: Z) D6 z- ?$ z$ K& P
      CloseHandle(hFile);
: k. N' ~1 J8 _! W% E      return TRUE;
& L+ Q- M' G$ Z/ I8 Z. j* E   }3 Z2 j3 n% H$ `8 T, ~% x
   return FALSE;
0 s: |6 b0 k& e. A}
, t8 C4 \) u/ k$ C- I& s: k6 e/ y$ J- y2 S% ^
Although this trick calls the CreateFileA function, don't even expect to be
, ]- a8 n) c# s$ _7 ]able to intercept it by installing a IFS hook: it will not work, no way!
. N1 s- n2 G9 {/ c8 Z3 G4 Z& E0 r5 u1 Z! LIn fact, after the call to CreateFileA it will get through VWIN32 0x001F" b: Q% R  J9 o& D2 H
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)3 E: R! q# g" n1 h8 a4 {
and then browse the DDB list until it find the VxD and its DDB_Control_Proc
0 o& v: o. F) Q9 {6 t3 t" h8 \% L( Nfield.
4 U0 B0 U' M) Y) _+ M5 N+ EIn fact, its purpose is not to load/unload VxDs but only to send a
5 h' z! |1 T6 l( P! x6 M; F  Y, oW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
3 \8 w; o  j! W4 O: }- \) Vto the VxD Control_Dispatch proc (how the hell a shareware soft could try
$ x4 H) Q1 H' E" O* D/ Jto load/unload a non-dynamically loadable driver such as SoftICE ;-).
" @2 j- ?% `% A3 ~$ qIf the VxD is loaded, it will always clear eax and the Carry flag to allow
3 ]- j4 n+ b; z0 b8 oits handle to be opened and then, will be detected.
. k- N. j  E3 \0 U- o. U" H! YYou can check that simply by hooking Winice.exe control proc entry point
" G1 X5 {) U( K6 Awhile running MeltICE.
2 y+ e6 \  N: L) J: H6 J
3 q* Q! [9 v$ F% F) K3 a! p$ ?" q5 \- F& J2 R' c: ?5 r
  00401067:  push      00402025    ; \\.\SICE2 S+ f& m2 Z4 Q: X2 [) |* s+ L7 X
  0040106C:  call      CreateFileA
. l/ y( w2 q1 H  ?  00401071:  cmp       eax,-001% ]9 `$ O- E- O% K% Z
  00401074:  je        00401091
' I: G. Y" V8 d( ?" p7 q1 z! L7 l& q' L. F

* \2 k1 r$ j. N3 k6 f5 V/ w$ L8 l# GThere could be hundreds of BPX you could use to detect this trick.
* U+ f4 A3 t$ x* o0 @% h6 `-The most classical one is:
/ j' v. J! |! b7 z  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
- O5 b! K2 a; h    *(esp-&gt;4+4)=='NTIC'% F( L& W( X& e0 l" U0 r% Q
+ X& S5 A5 C: r2 O
-The most exotic ones (could be very slooooow :-(
7 X4 O, |* }" U- G+ H3 M   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
* R: ?# T) e1 L     ;will break 3 times :-(
7 d' I1 v) j$ Y+ x. q
& {* Q9 \  c, s-or (a bit) faster:
) u& D; R  S, f   BPINT 30 if (*edi=='SICE' || *edi=='SIWV'): M( y( u6 r- g  ?  d+ E

) f. \" q% P% R5 m; A$ t6 @% t   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  . B2 `# {- C  S1 M$ {7 R7 `' n
     ;will break 3 times :-(
! H. \. b1 W1 B, z% l; M5 N
# C( t5 T+ O7 Z4 d' b! v" D-Much faster:5 F" N" M& Y3 q( ?$ r& O5 R. g, R
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
$ X6 R  t2 }2 L. ?% D) k6 j4 H2 k" n5 }0 q
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen% g9 p# m% x$ n% T' s) Y+ H
function to do the same job:1 D! ~( q' k9 c0 T7 z
" L  h8 g6 k$ ?- s; p$ c$ O$ [
   push    00                        ; OF_READ
- @5 B! W8 f+ z) L' P1 U  T   mov     eax,[00656634]            ; '\\.\SICE',0
0 t! A5 @" n$ C+ [; \. T   push    eax" W7 z4 C, O4 @% a( S
   call    KERNEL32!_lopen
( ~4 x' `8 H" \: l   inc     eax9 ?3 ]+ H9 F( z" O
   jnz     00650589                  ; detected6 N0 O+ t/ b; m+ i4 _$ h
   push    00                        ; OF_READ
; v: ~: W2 N. q" o4 I   mov     eax,[00656638]            ; '\\.\SICE'. _1 ~/ a7 {4 g* m# m
   push    eax2 T' V5 z! w" S7 m7 p/ T/ v5 C
   call    KERNEL32!_lopen
* i( Q1 Y; B. r3 E$ e   inc     eax
! {7 P' g/ L) D1 E( \6 O7 h   jz      006505ae                  ; not detected) i1 A! D1 m9 h- t- {

' _% s* C7 l) S! A  j7 m8 Y  S7 D% ?
__________________________________________________________________________
0 u/ [5 |' _: `( ]$ j
: g4 D  H& ^8 ^+ n/ ?- K% d4 X+ TMethod 12) j5 _; i3 u' Q& S% l0 X
=========
" V% B8 @  \1 K- m) ~2 ^( n. x1 A8 {' E
This trick is similar to int41h/4fh Debugger installation check (code 053 {0 L7 i  d$ r* z/ y
&amp; 06) but very limited because it's only available for Win95/98 (not NT). E$ P  k$ m; k4 A2 Y9 R1 B% H
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.! R1 g' y9 ~- |5 W6 b! g$ ]. o! N

* v" @' S1 A9 ^   push  0000004fh         ; function 4fh; L; i/ ?. r. s- D) L; r
   push  002a002ah         ; high word specifies which VxD (VWIN32): n$ p& k3 w- a5 i. K
                           ; low word specifies which service1 H/ o1 F8 T) _' A
                             (VWIN32_Int41Dispatch)$ t+ P* g8 {. ~% f" N$ B: x
   call  Kernel32!ORD_001  ; VxdCall# H/ ]. q& W' ~
   cmp   ax, 0f386h        ; magic number returned by system debuggers
6 i  h9 _$ e! W  |" B* {- e- L$ A   jz    SoftICE_detected
$ Q- t% ?7 S' ~5 U& D6 g0 k6 f9 c9 |% M6 k+ V/ V  G9 Y
Here again, several ways to detect it:* c. p& S! i3 Z2 C+ {- H/ k2 V/ \
& |! W5 q5 t: O* U
    BPINT 41 if ax==4f$ K" b( I( o% i) ?% i- {' ^

" V1 @% a) `" Y6 N+ B- |6 a    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
4 q2 K% o9 _; `0 ?; Z! F9 f, A  L, g
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A- ?: ]/ x/ [1 Q  h. j
! P+ z3 u8 |! a2 w1 y
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
# d' H  c. v8 G5 t2 U. `! R; P# q2 x, c) p- ^3 D+ A5 c
__________________________________________________________________________
2 q* U; b) m/ D
' [+ r0 y* c2 D8 n$ XMethod 13! `' J! ^+ q, z! B
=========8 C: L) r8 n3 [2 j0 w' g/ I
8 s* X+ y- `0 o8 `6 g
Not a real method of detection, but a good way to know if SoftICE is  O; {% f) w" q
installed on a computer and to locate its installation directory.) j$ v# }2 N# X, a$ E, g
It is used by few softs which access the following registry keys (usually #2) :
" w5 V- C. {/ o" e' U* u7 V- _' k' g8 i
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
3 T% t" T+ x* f\Uninstall\SoftICE3 y( f4 M5 F: {" E0 e( W
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
7 T" ]0 m1 H, `/ m. M/ ]-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
7 h8 b* W! R6 G# p; o6 ]\App Paths\Loader32.Exe
8 g9 a5 H0 C+ U6 m2 C
6 J  d3 \# X* z8 A  j$ Y, a
" Y) n  \! Y) ZNote that some nasty apps could then erase all files from SoftICE directory1 `! N  w6 O$ g3 c4 }
(I faced that once :-(
( G$ @1 W( h6 J! C0 Y# E
. T( ^7 R8 f% \3 D3 q* j4 Z5 X% sUseful breakpoint to detect it:
! I$ I" w/ p; Y5 Z
! S  I  S8 v. }0 F     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'4 @  P2 l) h: r0 I
; t! h! W! Z% k) O6 ~) z
__________________________________________________________________________
0 Q) \8 J" `3 E& z+ f% L, Q
- |  s- ?9 R" b% b/ _8 K, B
! I5 L( I( S1 o& cMethod 14
( e! ?! Q4 D8 a6 D5 ]/ ?% f5 ?=========
4 M1 k. m  n+ p+ V4 Y$ }" {! M1 k: S, ?# F& s2 D+ f
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose! {! O. |, f9 F& O# J
is to determines whether a debugger is running on your system (ring0 only).5 [! g$ O' G# e" Q
/ i0 e/ t* I' z4 H! @2 c
   VMMCall Test_Debug_Installed, |/ N6 P, d) b/ V3 J
   je      not_installed
, Y, A1 F+ U: v4 S9 U
( I& y, X' C& _4 ~3 m! dThis service just checks a flag.' x* y" e+ a+ d0 C) a* }
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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