About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>% h4 V' M$ n% S/ h( Z) Q8 x
<TBODY>; b: f9 U0 d" i* K
<TR>
% Z2 Z% E3 L# h<TD><PRE>Method 01 7 t, N$ u  H9 N4 V2 y
=========
8 C+ t8 l# ^4 @2 o1 V8 c) [# u) V0 y: d( X( h# q* Q# S
This method of detection of SoftICE (as well as the following one) is
( U2 W' Y8 ~# U* J$ t. {2 y! Dused by the majority of packers/encryptors found on Internet.
1 d2 q6 t' ~; {+ ~$ P+ FIt seeks the signature of BoundsChecker in SoftICE
8 {: S2 S, P$ j5 }# [2 }
1 G/ e/ i1 C  P1 _% Y8 m1 C    mov     ebp, 04243484Bh        ; 'BCHK'3 ^+ n5 k( g; q8 v( y
    mov     ax, 04h- i% N' m% q  _" Y2 j
    int     3       1 F. Y% }1 i5 a* ]) y1 T& T4 ^
    cmp     al,4' N, E' ^& [, m- b7 @; h) B
    jnz     SoftICE_Detected
( r% F3 I2 e2 Y6 e* e8 e. f( R6 f
___________________________________________________________________________9 u' ]0 \/ X! c' ~- ^

7 y8 }2 J0 s# N! z8 _Method 022 V! T  @6 E; I$ ], I
=========6 `% W. R( b, ?
- Q, ?0 q; w7 B+ `% R4 u& X7 P0 B
Still a method very much used (perhaps the most frequent one).  It is used/ n4 M3 T1 [% q$ v5 P+ P
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,$ L5 c* G' ]2 I+ G' P% Q& H/ z9 r' R
or execute SoftICE commands...9 G1 r. r' l5 G
It is also used to crash SoftICE and to force it to execute any commands
2 W8 s$ i& H. W) e4 A, k. \(HBOOT...) :-((  6 ?/ u; z0 ?+ p, a

* y+ m% \6 N8 u- a, cHere is a quick description:% @& u5 Z4 k0 u7 s( _) z1 c
-AX = 0910h   (Display string in SIce windows)  ~. H7 g/ |& ]& }( u, E7 W
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
5 k% l! V9 c' L! C0 \-AX = 0912h   (Get breakpoint infos)" [' C& x5 f$ k
-AX = 0913h   (Set Sice breakpoints)' W- s3 V" n" q! O2 d9 e
-AX = 0914h   (Remove SIce breakoints); @, E6 p9 a* Z1 ~9 x$ e
  S. P+ D+ Z6 \3 U. ?
Each time you'll meet this trick, you'll see:5 e( }( y7 O) @/ @2 r1 t
-SI = 4647h
8 Y0 R1 F0 p  V: r-DI = 4A4Dh
/ A  k- F' t& V# h: x, W; MWhich are the 'magic values' used by SoftIce.) X8 M7 P" W* C' j* I& d% M  \* g
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.
( D- \* P4 ?( b. c5 N/ H" K
, [/ D/ L  o5 @Here is one example from the file "Haspinst.exe" which is the dongle HASP
" d; b) E/ T7 d1 P. ZEnvelope utility use to protect DOS applications:
$ x* l5 I2 R: [( o5 M
9 f( t( s' {; N, Y& N8 k# Q
- V# ?) t' F% E7 g4C19:0095   MOV    AX,0911  ; execute command.6 V, V% O* @- U5 F/ P" P4 e
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
* J3 p  t$ @% r+ @7 ?. h% @) U4C19:009A   MOV    SI,4647  ; 1st magic value.
2 x+ V. _7 i/ Y4 ?4C19:009D   MOV    DI,4A4D  ; 2nd magic value.& ~1 J" ?8 n+ ?, l  f
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)8 x, I! l3 Y" Z7 a
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
: D1 q/ N5 g* ]  C3 N* W5 u4C19:00A4   INC    CX) Z( `0 r5 h2 Z  N1 S# \5 |/ e
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
" I/ ^4 [7 W# V+ A2 G% p4C19:00A8   JB     0095     ; 6 different commands.
" }, t7 R$ O8 C7 d" T% f1 K4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
8 [. K1 U  L. D: e( c: y5 F4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
5 n) u# \  `. U! P- ]% U1 M  Z- v
8 c; l/ h5 v; K8 j( xThe program will execute 6 different SIce commands located at ds:dx, which# w& D4 O; @9 t3 Z$ M
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
& k  _9 r0 Z) Q6 Z  J
- G$ b# `/ x5 @% u7 g* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.. g* ?" T9 {# `6 C9 g
___________________________________________________________________________
8 T! o7 q% E1 m/ u4 @" P5 e
( u9 ?$ M$ e0 m0 J/ u( I% V2 @: `; K
Method 03" n! D- C3 Q0 L8 `  U. K' l
=========
- {2 n" I* B% F$ S2 h" e. k3 t4 A5 _3 `! y' m! b; u
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h: }/ K8 g  q* f2 E/ Q  ?: O. I: C
(API Get entry point)
# x5 m+ ^2 _: e6 d# D! O3 I        
( b9 A/ z! Z! ]; s. d( p+ ~% n
4 O, v" e. Q# j: r    xor     di,di
1 j, [/ C6 [. u6 @) q    mov     es,di5 F( _6 T4 I9 j" g' L! U( W3 v. R
    mov     ax, 1684h       5 I* g4 D3 s( F7 u
    mov     bx, 0202h       ; VxD ID of winice# H9 R, J9 p; m3 f) h2 O8 o
    int     2Fh
# S/ ~1 V& T  \8 ]  U    mov     ax, es          ; ES:DI -&gt; VxD API entry point6 g. w3 X  x7 Q5 C9 ?5 J
    add     ax, di
% ]. r; ]# F! A5 k5 ?4 l    test    ax,ax
; f+ k: E0 e  T( q7 S' X    jnz     SoftICE_Detected: \; M9 B. v* \! o. r0 i& [+ A
1 \7 q3 `/ G" k$ W
___________________________________________________________________________
  p9 t' f  b5 C  `: E/ a% r8 _; X) [6 s# o9 \( o+ |
Method 04
1 v; b, R, ?3 Q=========
4 C% J. s4 q; f/ u1 ~) {; ?
% A# [7 \7 s3 N% }6 i# e6 ]3 iMethod identical to the preceding one except that it seeks the ID of SoftICE* t1 g6 Z* |+ |- z) Q) F* `
GFX VxD.
) }7 c' A- i7 m* n* V
* @4 i! ]+ q. s0 ~" W; \: N! u9 o    xor     di,di
# V% O6 B; a0 ]4 w    mov     es,di1 k5 C1 D8 _. V
    mov     ax, 1684h      
  ]/ R. n4 U. w% q7 f7 p    mov     bx, 7a5Fh       ; VxD ID of SIWVID$ _( \9 v. }; o
    int     2fh. @( b! j! Z, v# m2 l6 U/ b7 l
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
% E& c; k! _6 V: F" T, g0 @+ P    add     ax, di
3 Q+ a( z& J* W" |. K    test    ax,ax4 V5 }, S2 S+ R3 r! K
    jnz     SoftICE_Detected
3 n' v  F0 Y& W7 h( P  u8 H
$ O  `. Y" P! o4 I- Z6 _' {4 e__________________________________________________________________________
( B, o, o7 C' p4 H# x' x. ]: |* H" }
' A+ V/ j4 ?4 X; S
. ]  b& J) X; P' OMethod 05, r/ X8 q* @6 z/ q* z- X7 [' m! r
=========
0 q8 ?* q! [- N9 V# e; I" X9 I( t9 F, T- `8 `
Method seeking the 'magic number' 0F386h returned (in ax) by all system
2 O3 o6 K+ Z; m# Rdebugger. It calls the int 41h, function 4Fh.
1 n+ ]- p0 X' r. K. X6 EThere are several alternatives.  
( R# e3 Z7 k! O, z5 ?& T3 c- D8 s9 _+ X8 J. p* n
The following one is the simplest:
7 R& D: ~/ l- O9 J9 y& U& F5 C3 H+ V1 R2 \& A4 [
    mov     ax,4fh
9 q1 o# a4 T+ f( P9 \    int     41h
1 V4 K5 h9 J1 |# P6 k. @    cmp     ax, 0F3866 w5 D3 v4 h' o. V' I" f5 Q3 t
    jz      SoftICE_detected+ \$ d; x. I9 x8 i6 x, d

+ j7 W% D! n) u* D$ C/ j! m$ F
2 v2 P8 R  Y8 o. U# {. kNext method as well as the following one are 2 examples from Stone's ( y3 v% b" ~4 \) j: `) A
"stn-wid.zip" (www.cracking.net):- ~6 O, O0 W3 [, C" |% E
/ C+ O' c7 g- ~4 t( H  c
    mov     bx, cs
+ P& S4 S/ F/ D0 \0 _1 j7 B    lea     dx, int41handler22 l( ?5 F1 c1 p( E0 Z, r
    xchg    dx, es:[41h*4]
3 m' t- Y/ m+ R. U) ]# l$ \1 h    xchg    bx, es:[41h*4+2]/ X+ `9 b$ x& @
    mov     ax,4fh5 T% }/ ~: i. p# }0 O3 e* @8 A
    int     41h
' q* O. g* V/ A1 u' C2 K4 u0 h    xchg    dx, es:[41h*4]- @" _8 m8 O% a* T+ i9 V, H
    xchg    bx, es:[41h*4+2]4 @  X. G3 F, G9 D
    cmp     ax, 0f386h
% k5 ^: H6 c( U# }) t+ F2 T" P    jz      SoftICE_detected+ u/ n1 u+ W) S5 u: g7 T  g6 U

5 W8 J" I) J$ Iint41handler2 PROC) e9 V" ]- R+ C
    iret, m8 ?- r+ S4 P; m) Y4 q* s
int41handler2 ENDP
& J5 ~5 Y0 Z. Q. U% e1 Y* g! [4 K$ `
1 x1 ]- T5 g" x" V8 s; n1 E) R: {
_________________________________________________________________________
; h6 A* P' {. Z5 _7 y2 [, }) Q/ E: k; n0 b. u( D

! b# J$ F$ Q# aMethod 06! c& `$ m. P/ f3 }- j5 p
=========9 x- s% D& }8 M0 Y" C
. e  O8 i/ d' E# P$ C. o5 ?

" D7 ?4 i6 L3 z2 k7 A& C2nd method similar to the preceding one but more difficult to detect:
4 w+ s5 m. K9 P7 C4 K3 f/ s+ |  `$ A" j* Z6 R

3 U& d1 [& n2 Yint41handler PROC; S9 y) K8 a2 u8 b" f
    mov     cl,al; {' s. \0 N0 _: n$ H' h
    iret5 E+ K$ m  ]9 x5 N+ e7 |
int41handler ENDP
5 ^% b; u6 f5 k" T: Q* L; Z* H, K5 ~2 _9 p! e- E6 K  e/ r+ S

  U* s9 I; q. ]( J, O! L9 U    xor     ax,ax( M. z$ F* e  p, q2 z
    mov     es,ax. t$ f" Q4 l, n6 `; \0 q
    mov     bx, cs& B6 c; d. F% H( I; V, o2 L/ f! G
    lea     dx, int41handler, U8 S- f; v, Z( f: Z3 ], W
    xchg    dx, es:[41h*4]
! U% Z4 f3 N  ^. F    xchg    bx, es:[41h*4+2]: C/ f; W& O, A7 w4 e' O2 [
    in      al, 40h
9 d3 m: l! u/ r3 ~    xor     cx,cx
/ {+ K% a* b; J2 b    int     41h2 z. e, n* ^% a* ?# X. L* |
    xchg    dx, es:[41h*4]
# D8 |! {  E& p    xchg    bx, es:[41h*4+2]
% _( S2 y6 `, O    cmp     cl,al
7 c+ H% v3 I$ v, o% K7 S    jnz     SoftICE_detected3 ]* h2 I2 Z5 x" k, Y0 s; `

! Z9 y9 C7 o* R( h_________________________________________________________________________
8 o; c8 d( o3 b7 N# y6 C$ y' x+ D7 J$ [& P9 j
Method 07
+ }" ?0 x" `+ f3 l8 b1 {/ u& o=========' E# z; F. O0 ^8 Z# M$ B# o  M
' y) ~/ @, m' p0 r2 L7 x' B
Method of detection of the WinICE handler in the int68h (V86)
9 J3 I4 F  v* ]' Z. P+ Q
8 f8 c6 y9 r% ~5 Q# m    mov     ah,43h
: `4 f. p) Z; U4 u  @8 R1 i    int     68h8 f+ u5 V2 \- r, G  G9 _
    cmp     ax,0F386h* M" l4 ^9 f# R9 v
    jz      SoftICE_Detected- \. F7 T/ m1 C5 C) |

2 o" K$ K& v. Y4 u+ Q
  J# R0 P) z' c' m5 U. D. V' E=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
7 {2 Y! Q4 |: c, i/ s   app like this:
! I2 r' t- j' W* l9 o( K" L- ]  ?+ \( O/ u3 G- o4 a. Y! [; D
   BPX exec_int if ax==68' j! m4 e# f, j3 U+ A! S
   (function called is located at byte ptr [ebp+1Dh] and client eip is
& _/ z: A. k# Q9 b9 b; ?3 k# z   located at [ebp+48h] for 32Bit apps). {3 H& O  Z; A2 v) I1 i& r' j
__________________________________________________________________________- P9 a# p  N6 Y/ \7 t
4 t' Y4 R0 c: Z
. g; J7 w. K0 _; `
Method 08' c7 K' a% O- J. W& O
=========
6 X8 [' d8 l) p! c4 f2 V3 p5 {  G$ I) C; `# n7 f
It is not a method of detection of SoftICE but a possibility to crash the9 U0 N8 Z, ]/ V6 a; P: F8 m
system by intercepting int 01h and int 03h and redirecting them to another9 I- y% X  A& K7 G) P1 k
routine.$ Y/ O+ F1 m6 U- f
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
+ \: C9 F% o& J" [3 U' `$ pto the new routine to execute (hangs computer...)! s, W" `# k" K* O0 ~* D

1 H7 t( B- z. V    mov     ah, 25h
, n; k% \- Q+ F1 [+ D6 P1 O; h4 K    mov     al, Int_Number (01h or 03h)
, {) G  v+ I6 ~3 ?% v* d    mov     dx, offset New_Int_Routine( m0 O4 H% l0 `0 G4 y7 W1 W
    int     21h* \) i2 o, _$ H2 F; G- X" ^5 L/ [8 Q
1 g1 A5 C0 E& F* k$ G
__________________________________________________________________________
2 s1 n) n) P" V$ N# E
; w+ k; A& C& E* x, bMethod 09
5 t3 A. k, T# s& y; c" v2 Y: m=========
0 V& Q; P5 a, d3 d, X: Z9 {) J3 L/ j; I/ o, ^
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
, V2 R" D6 z) ^6 J( ]9 Y' Z/ Xperformed in ring0 (VxD or a ring3 app using the VxdCall).
9 c5 ?  q6 h# ^9 BThe Get_DDB service is used to determine whether or not a VxD is installed. Q* y  y7 S, |& n- o! r! [
for the specified device and returns a Device Description Block (in ecx) for5 c% }& T* A! d1 o, }& f
that device if it is installed.  W  m. X$ K8 J/ t& b
9 v: j& |& H  p# A" _/ A" H
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
: g2 }/ d# N; F6 |   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)) v: u* s: h0 a- t  ]
   VMMCall Get_DDB
( X4 B; u; L8 q+ R   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed3 d) X& ?8 I9 H4 a. ~0 p
, j, S" B  U) ~% K  ]6 u
Note as well that you can easily detect this method with SoftICE:
, i: @3 ^* C6 c- V& {! i6 ~   bpx Get_DDB if ax==0202 || ax==7a5fh
9 V* ^, u  o9 ~" j8 f; t- o7 b
/ @( @' v- o' P  b: O. M__________________________________________________________________________
7 l& ~# Q3 }( w) Q& W  R/ B% a; H
Method 10. a9 q5 S# b0 Y
=========
2 l  R& e8 n4 G4 k3 b: d3 Y, B  d: r* e5 r) f* V( W! h8 e
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
* T/ k) V4 V- A( `, C  SoftICE while the option is enable!!6 E3 O7 v% Z3 f; o+ h

* |4 g5 o* l9 p0 z4 UThis trick is very efficient:& ^. T# s1 F1 @5 H1 ]% C
by checking the Debug Registers, you can detect if SoftICE is loaded
* y& o. L6 f1 C3 }(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if* k% j- d/ U# F; C
there are some memory breakpoints set (dr0 to dr3) simply by reading their' h* D+ ]6 d6 E6 m0 t2 j. k
value (in ring0 only). Values can be manipulated and or changed as well
' w( ~; k. l: t7 a(clearing BPMs for instance)
. r/ S: R; n9 h" _( q: t
: B9 y5 s. r' D6 a# Q__________________________________________________________________________+ \- O. \  l' i/ n$ F  \
  U& w3 J; i2 n" y) E
Method 11* k" [9 {* J4 r8 m9 z
=========
* t( ?$ y5 T- i- t
% m* [1 X& f; RThis method is most known as 'MeltICE' because it has been freely distributed
& L* L" t7 F0 G3 pvia www.winfiles.com. However it was first used by NuMega people to allow
7 b# N- {" z* v+ A! VSymbol Loader to check if SoftICE was active or not (the code is located6 _3 Q. }/ o! I, F
inside nmtrans.dll)., e$ T6 S3 K6 B0 R. W; t& U

- ~- v/ o/ e+ Y6 N2 r  x& N5 nThe way it works is very simple:
' O* b7 I) b, W3 d8 n/ n, g. ^( MIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for2 o! W* P. z9 U" r
WinNT) with the CreateFileA API.
1 O7 @  W9 b1 }3 T1 ]+ |. K0 G7 X+ Q* l/ m  |4 V- B
Here is a sample (checking for 'SICE'):" I+ k' p" D; {$ O9 n- p# p2 F

, t0 \  V* y2 c8 \BOOL IsSoftIce95Loaded()9 `1 X8 d& S+ r7 u3 k1 E8 p4 o
{+ w' t) G0 V) s* z! V' m
   HANDLE hFile;  8 D, ~7 Y; X7 h+ g* w1 Q: |2 L& _8 d4 T
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
. R$ V5 O. p4 c; T  W                      FILE_SHARE_READ | FILE_SHARE_WRITE,' n9 `- a: q, Q2 C4 k$ F, O
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);' e- v( b$ F# w* d( r, Y6 c% F
   if( hFile != INVALID_HANDLE_VALUE )( Z) _+ C; p( y( m& \  l
   {
) l6 N5 U1 e- ^      CloseHandle(hFile);# Z1 {9 J6 u" M9 M. B1 ~
      return TRUE;! v4 ]' X; n2 ~
   }8 N1 g: V# ~. W3 @' R3 D
   return FALSE;4 P! ?0 ~3 W. g! s( m& B
}
# Q, K. [* M4 o& m7 p
( I2 b. C7 k* G& v6 bAlthough this trick calls the CreateFileA function, don't even expect to be8 D( h9 ^1 m- r
able to intercept it by installing a IFS hook: it will not work, no way!
4 A2 J: U) i6 a; y: [In fact, after the call to CreateFileA it will get through VWIN32 0x001F
8 W9 Y( w; F+ _4 a- P9 x; p7 |1 Wservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
% Q2 m0 W9 o* N6 W& Q8 G' Fand then browse the DDB list until it find the VxD and its DDB_Control_Proc5 _' M& M8 D; B1 Y7 K- a
field.
+ g% k, H2 E8 q+ v2 eIn fact, its purpose is not to load/unload VxDs but only to send a
$ o- ^/ x( a( J1 q3 o6 ?8 ZW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
* f+ J6 }& o5 y! Q9 @to the VxD Control_Dispatch proc (how the hell a shareware soft could try. i; k+ L4 a/ x* r/ K: U) s
to load/unload a non-dynamically loadable driver such as SoftICE ;-).# z8 [! z8 L' d5 Y( L& H" }' w
If the VxD is loaded, it will always clear eax and the Carry flag to allow* o) b7 {6 e5 |! O9 B
its handle to be opened and then, will be detected.! r: C/ }  l* b# n0 N& n1 u4 g
You can check that simply by hooking Winice.exe control proc entry point5 o  p/ x) r% F* F# p3 O; }/ P
while running MeltICE.
( _( y* W* v9 _& u5 w# [4 o  I% |! v* l* {
% H  t3 I  j. f& O
  00401067:  push      00402025    ; \\.\SICE
5 u- z; g4 q* k% ~; J3 _( b  0040106C:  call      CreateFileA
7 X6 p; N2 o$ p7 c) }; E1 g/ l0 `  00401071:  cmp       eax,-001
# c  s+ H; S7 H, A  00401074:  je        00401091* ^7 Y  _' b  v! U( z
1 a# O8 |/ N1 i1 H

  o4 h- a6 R/ v4 G) g' SThere could be hundreds of BPX you could use to detect this trick.
5 U" T' S% ~5 Z-The most classical one is:2 n2 T5 G  u6 c, ~! y0 t
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||1 n) f6 w  t3 H& Q7 A/ u& l
    *(esp-&gt;4+4)=='NTIC'
+ q+ K! l, u: \9 I5 v6 z5 n( x: }5 }5 |; o0 Y
-The most exotic ones (could be very slooooow :-(
3 L0 _& N0 E) _3 V% o) ~; ?8 G   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  / X5 ^1 M: b. S  K
     ;will break 3 times :-(& r, k, ~' |( F7 ?
, R  e1 d: K7 O
-or (a bit) faster:
3 a& r9 K9 P: a. M2 F4 }   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')1 p6 }2 l1 l8 y+ @4 p
5 }9 ?1 q* O* G4 S; d) t+ z
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  + N8 Q, O/ p" @
     ;will break 3 times :-(
8 V, p% U4 t3 d+ I+ Z3 r$ j4 s4 T2 n
-Much faster:
3 K4 u9 @, ^' W3 e& z# R% l   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
% H# u0 w$ T8 _# D, ~  k+ S1 u) r8 `8 w. S* J
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen2 Z1 h: L# l. N7 f1 a3 z" I
function to do the same job:- o# [+ i' ]0 Q# `' S: V
( n* }+ Y+ s- v2 E8 j7 w5 u; h
   push    00                        ; OF_READ
- @5 s0 r/ j3 j' h# |8 Q   mov     eax,[00656634]            ; '\\.\SICE',0
$ {: P0 F( I) Q* }/ v1 ^3 d   push    eax3 y5 C8 I& ^: H* O& I
   call    KERNEL32!_lopen
0 d7 n9 n4 D/ ]1 ]; x" {& m   inc     eax
* W" X* \, G' b# S% C   jnz     00650589                  ; detected
% Z+ D! y2 q4 j   push    00                        ; OF_READ
, l" D8 N, U. J/ ?5 y$ L& s. w5 s" M6 `   mov     eax,[00656638]            ; '\\.\SICE'
7 o% q+ s0 d6 c! h   push    eax
7 r9 c$ J- `1 ^   call    KERNEL32!_lopen
! i$ ]$ n% P1 e0 F   inc     eax
) C0 B5 m; |6 Q# B   jz      006505ae                  ; not detected3 q: d3 ^( z+ V" S" l2 `& q
, ^0 B8 @6 ?& M/ _" V% c9 {
, T3 ^, H% W& b, a8 F* E( g. h+ F7 C
__________________________________________________________________________; Y2 @. k: z' o  ^9 O+ C
( V$ X0 M" W$ u& |0 z
Method 12
/ K) ^. ]* U6 L( i7 j5 p9 S=========6 a/ _4 S6 g" l: m1 ]9 i2 W" W7 w
; I* `( \) K& F
This trick is similar to int41h/4fh Debugger installation check (code 05
: A! l$ R3 d0 D&amp; 06) but very limited because it's only available for Win95/98 (not NT)4 S- L5 C$ i) J; O
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.
0 z4 {/ T* y' f% h/ L& J) u
! c( D$ `" p; o+ H% F# R   push  0000004fh         ; function 4fh% G  f( m( ~7 g: [' s
   push  002a002ah         ; high word specifies which VxD (VWIN32)  s2 Q; c& y# d
                           ; low word specifies which service  H8 U! t( @* Y, H
                             (VWIN32_Int41Dispatch)$ v% K- \" E( U6 {
   call  Kernel32!ORD_001  ; VxdCall
& d: m( P8 V$ i7 e   cmp   ax, 0f386h        ; magic number returned by system debuggers
0 N( x' T1 `5 C5 y  n$ X   jz    SoftICE_detected& b  h% }- b, v4 |6 s# X5 T
) X3 r. U9 L) N( u/ e
Here again, several ways to detect it:
* g& w  i( b: ?: q
- R# U$ [4 C) H* H    BPINT 41 if ax==4f
% j6 O+ k* \$ v
* G% ~( P, ^* @. o( W    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one" f* k) w+ X, F7 v( w$ {8 Q
7 @) {: Z1 f) ?4 C
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A  E# j% i; X4 W1 A  g+ K# Z9 N4 j

' j0 m# b7 G1 E7 k5 H    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!) _% H3 n% j" y0 X

2 N+ O) P% a- p! s' U__________________________________________________________________________
9 {, t" z9 e1 q% U) N+ A- H- @, o6 |4 L9 Y% L" D
Method 13
. m: i) F. l7 L=========% w6 ^. r% Z, D+ L

/ c4 ?7 t* x, l, l6 j6 zNot a real method of detection, but a good way to know if SoftICE is8 j- W- U2 O; d( m
installed on a computer and to locate its installation directory.
. n/ D! c( Y+ [9 ?It is used by few softs which access the following registry keys (usually #2) :
, z9 ?* m2 g) D. x) `+ ]+ B
. Q) \* ]3 r+ E/ \+ e3 |- O-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
* d& r. N1 Z: c9 @. f* b$ k\Uninstall\SoftICE
# `" H( g; x" C-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE  A: G( j" S0 X3 v) Z
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
' I" t) _/ O" q, j\App Paths\Loader32.Exe" P. ^$ w$ U' v5 }" V

* r! x$ Z- U) a: x. L3 d9 r: T) E$ }. q8 w
Note that some nasty apps could then erase all files from SoftICE directory
- O& `; `# t( \1 g$ u(I faced that once :-(2 n  G5 _( Y) g% Z

( C! q" z! Y& TUseful breakpoint to detect it:' @. m0 L' l( h2 w* F2 ]9 i. i
/ w$ N# L- F1 t1 k+ a) Z1 o- w
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'/ [3 X: w) j4 n  H0 Z

) k- }; s* z) ?; z' ^3 P( Z7 U__________________________________________________________________________
2 J: E2 c; }9 s9 H4 d0 t
7 _5 p5 E5 ?" i9 T, ?7 x' a5 f6 m0 Z$ X( {/ W
Method 14 $ N% w$ u3 X+ L; w/ \. A8 I
=========
# N5 m3 e0 N5 P1 m4 p) E& \) p% g" g$ w3 p; C3 v0 \
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
) n' r& F# P) ~, z% |is to determines whether a debugger is running on your system (ring0 only).
5 I5 H8 U' S- d# R4 K
; l$ n; }6 K7 k0 U   VMMCall Test_Debug_Installed
+ L) N: Q9 F8 K. V; @   je      not_installed; G( v/ v  V3 G  p  C

7 r9 i, F" u5 J: J! KThis service just checks a flag.! w" i  h" J3 z" w: @
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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