About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
% w5 a% C* z$ j6 X: m<TBODY>
# \6 [8 L( h- T- _8 X, C. l<TR>3 i6 A- f; J! J! B4 [
<TD><PRE>Method 01
# C' z1 |( s" Y=========" ]" ?9 {" r+ E" S
5 O9 o7 }" K  _& j- u
This method of detection of SoftICE (as well as the following one) is
1 e- v/ m2 o8 c9 Z" sused by the majority of packers/encryptors found on Internet.
# E$ z( R0 K; s0 _' p8 ~It seeks the signature of BoundsChecker in SoftICE
4 r& k. F; _) J/ e" r9 H* l: z$ J& T" O. ]/ [5 ^  U) D7 n
    mov     ebp, 04243484Bh        ; 'BCHK'
  {/ q+ J" O3 s' y5 D    mov     ax, 04h4 l/ w* G) e: I  c3 _5 L
    int     3      
& ?+ d7 L9 x* |( S4 K    cmp     al,4
' c; n# v# X7 P" U2 ~: h6 f" [    jnz     SoftICE_Detected7 v6 g/ `/ u3 r+ |' s$ B
% h( i9 f7 e# p# P6 l7 [
___________________________________________________________________________" K! t7 M* `& F/ s
  j( ]' E/ [6 R, b- ^
Method 02' T8 h* q; Z: A' Z) V
=========
3 R4 X( A: d' u/ s6 l; m
3 ?9 @8 u$ S4 j: L. {% oStill a method very much used (perhaps the most frequent one).  It is used
$ G8 ^$ W0 l% w! G. U1 Nto get SoftICE 'Back Door commands' which gives infos on Breakpoints,
) p4 n+ |! C, L7 ior execute SoftICE commands...: h1 _9 @, ?1 f8 y
It is also used to crash SoftICE and to force it to execute any commands
' _) N7 M5 G* h& c- G(HBOOT...) :-((  3 \- p2 ]+ Q( U+ T1 G- P) G

9 }3 a* A( [3 RHere is a quick description:
6 I' p3 n! C3 h( T/ n' t-AX = 0910h   (Display string in SIce windows)
' E' V4 e& r3 s) g; v: I3 [-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
) i2 y0 }$ n4 Q-AX = 0912h   (Get breakpoint infos)
8 D' z( K- O6 {3 X-AX = 0913h   (Set Sice breakpoints)1 B& N- z4 F2 f+ o& l
-AX = 0914h   (Remove SIce breakoints)- g+ {& P# @: I3 x3 i& C# H0 Z
) R& [6 i+ n9 B- f- V; [, W" Q+ N
Each time you'll meet this trick, you'll see:! S: w% v: k3 N% s/ o
-SI = 4647h/ O, ~/ J7 H6 |) m/ p( J
-DI = 4A4Dh4 c% |3 O* A5 F& X
Which are the 'magic values' used by SoftIce.
* ]! q( S$ [# c0 `For more informations, see "Ralf Brown Interrupt list" chapter int 03h.6 S. d4 P6 d* f3 D
! f) l6 K" [' H1 K- ]- i
Here is one example from the file "Haspinst.exe" which is the dongle HASP
7 s! L1 ?0 d3 O0 j" N$ R0 q! fEnvelope utility use to protect DOS applications:
" _9 ?; q, B8 M2 C1 s
7 `& O6 q! z. s+ `1 C% y% z# F; b% _0 I4 _5 k( o
4C19:0095   MOV    AX,0911  ; execute command.
5 T  w; z6 s  y0 p. i% j9 k4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).5 ]6 j# x- E  P4 l5 ~6 N
4C19:009A   MOV    SI,4647  ; 1st magic value.1 v# d4 {4 v, i' D% I
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.( t3 ^+ @/ O" e" Q
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)  D& A( |$ e1 w5 X  `8 X
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
7 c3 V0 e( y5 L4C19:00A4   INC    CX& j0 s, ]5 O: |* T  D' M. n) g
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute- n+ w1 t: W$ Y' Q( m; y
4C19:00A8   JB     0095     ; 6 different commands.
& O! Q6 U3 V1 W8 O4C19:00AA   JMP    0002     ; Bad_Guy jmp back.' n3 `/ T- c! u& {+ a
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)7 s% A1 |) A5 W( u7 I

+ ?1 P+ v% b! b, i5 g& m: JThe program will execute 6 different SIce commands located at ds:dx, which
1 x& U4 U3 l7 C! Q+ W% kare: LDT, IDT, GDT, TSS, RS, and ...HBOOT., R& t% _/ i+ K9 {

9 ^7 G% x4 H4 z2 s/ b1 c* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.6 n/ ]* s; M1 A! s& _0 h
___________________________________________________________________________
. @) K+ w6 ?( v2 U0 E
# j- p9 G0 ~9 t! a. j
4 Q/ N) u) n( ]! qMethod 03, l$ o' B, E4 J. D. a8 Y
=========) o( a; Q& R' x3 H" i
  `! t; ]) O$ D5 k8 S9 O
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h) J3 A  B4 ]& p/ V
(API Get entry point)/ P/ d: E# `/ |  ?
        % ?) m& p- O* U3 o( L

! K5 N/ M% V- N& O+ l: ^    xor     di,di
' K7 G; y0 ?  ?) V' @" R1 v    mov     es,di
5 u: p/ }- i) C' f( h    mov     ax, 1684h       1 {7 ?, D" z0 J0 C) X6 M7 N
    mov     bx, 0202h       ; VxD ID of winice
% n4 E9 C3 ^% w; e* U1 V1 ]    int     2Fh
% v! t$ v" K  n. ?+ F- V5 d: O    mov     ax, es          ; ES:DI -&gt; VxD API entry point- ?- O  I8 u5 T+ h( I/ T/ c
    add     ax, di  d- Z0 B3 J, k+ t6 i: L" O
    test    ax,ax; t" t; u9 L/ M9 N" O" n; O
    jnz     SoftICE_Detected4 a4 r9 h2 ]+ F" k2 C% l
2 {1 [# g  C) x9 }5 ~
___________________________________________________________________________  d/ d7 P5 {7 G* J; s
. @& M8 z9 Z4 s6 V5 `+ e
Method 04
( H4 c8 @4 ]- @- I5 n=========
0 n7 s! B# N$ R8 f" h8 h3 Q+ P& j" @$ p5 a+ s3 x* K
Method identical to the preceding one except that it seeks the ID of SoftICE
  g* H! i# r* wGFX VxD., U; v8 l; x" ?- m

8 M% ]8 J8 l) s8 F    xor     di,di- q6 @& c$ f3 e+ D
    mov     es,di: U9 v* s( O5 I& q; v  V0 k0 N
    mov     ax, 1684h       " ?8 X$ Q, f* H) S. ^% A9 n; z5 Z* e
    mov     bx, 7a5Fh       ; VxD ID of SIWVID
1 E; K  p$ Z& l* |    int     2fh
/ B3 }# s; V* F- e, l- ?: w    mov     ax, es          ; ES:DI -&gt; VxD API entry point2 L) G4 v  P. @
    add     ax, di% \' Y4 B, _0 B
    test    ax,ax' T) t/ X2 G! f; k- e" E
    jnz     SoftICE_Detected
1 [5 R+ h& i1 n' z* T' a7 F% Q; G1 r; a: V
__________________________________________________________________________" Q) k7 ^- b- T4 x: u' A+ t2 w% M6 q8 z9 b
& `5 A! ?1 I7 k

+ C; Q2 G5 ?5 i+ O. p$ P" ?( M/ |Method 05# G3 U$ B! I: ~1 X! P
=========
+ p* u0 z2 g, r9 t, U* W
3 |$ o$ ^0 F8 J$ U, i' |3 _Method seeking the 'magic number' 0F386h returned (in ax) by all system, v5 ~8 B& @, d! U" U
debugger. It calls the int 41h, function 4Fh.
- e3 {$ E; F4 l- F1 TThere are several alternatives.  
8 o3 R: L7 j6 ]  l: R: e" ]& \( o) Z9 O1 T$ g* Y  z. n8 _' Y
The following one is the simplest:, _$ u, \1 p) ~4 }8 i

# {1 r. K) b# e' {1 Q* ]+ T    mov     ax,4fh
6 x8 R$ n4 c0 E! K4 N    int     41h
% B) F2 x. }- \7 [( i    cmp     ax, 0F386. N' C% {2 g5 P2 |; m) |6 \1 D  y
    jz      SoftICE_detected
! s2 y% R6 y  \6 A8 Y8 d+ N
3 h: Z9 l  u4 m- @( R4 I0 z
( X: M  H0 H2 Z) d" `Next method as well as the following one are 2 examples from Stone's
. |( q: B3 v/ L# F6 t"stn-wid.zip" (www.cracking.net):
. G7 }8 }! W, A2 s0 P) m# g1 s% I4 \; V' ^4 P7 \: B) G$ J2 b( C/ H
    mov     bx, cs
# x7 T* V# k. o% Z    lea     dx, int41handler2
- M( F5 }( |2 W$ K$ ]. X    xchg    dx, es:[41h*4]
+ g2 Z9 G" m" D# o# t' e/ {    xchg    bx, es:[41h*4+2]
; c3 @  p, _+ J1 ?; h: e+ V    mov     ax,4fh
' Q- S5 e& c0 b$ ~1 k# a- x    int     41h
% d' s( V0 p2 F& d6 v    xchg    dx, es:[41h*4]
( v# S* g. j: a8 L3 v) J    xchg    bx, es:[41h*4+2]
4 C3 `& b) z1 d* V3 }0 ^    cmp     ax, 0f386h
- i1 r% R: L6 U( X5 b    jz      SoftICE_detected
6 c% s; v+ D; d
* q* v# o$ N1 |. {8 E# c0 \1 h) cint41handler2 PROC0 I- J( b+ `2 z7 O$ `, N6 x
    iret4 n' j7 L3 ?9 u* j& ?% W/ I* J$ V+ K
int41handler2 ENDP5 n% `/ R6 I& {5 }3 o( J

* K4 r! Z0 l) M; z
2 B% O9 B8 p1 U% \/ @* O& k; N_________________________________________________________________________
! r. I( n+ A. [* J2 U7 S- ^
/ Z1 g3 x% Z; |9 j' r$ a: \) n* t1 {: g1 ?* m$ h" p8 J
Method 06
. Q: T, {+ m* K6 P- I=========( x) l& P$ q7 x; C/ P4 y

  A7 }2 o9 C2 Z$ Q/ m% A
1 B+ ]- }# G' R2nd method similar to the preceding one but more difficult to detect:: ^7 I4 f" A# \, Z( W- V, ?; v3 @

/ {2 J, p" r) l, u/ e; c- F: K! h" x
int41handler PROC7 ]% T2 x- Z0 t0 h; {3 e1 H
    mov     cl,al2 T: a  P" m" y& i6 b
    iret* U  n  `' N0 o% Q7 P/ ]/ q
int41handler ENDP
& B; `# ?- d* @, K. q1 |0 h% ~) z; k. y$ x9 B1 N
. H# D- ]. K8 X
    xor     ax,ax
) p6 ]+ F) o. M' p% n' L  P) u, l    mov     es,ax$ h" w; z* @4 V- J$ w/ L
    mov     bx, cs; L, }5 _6 s/ X0 g" L
    lea     dx, int41handler' q, i  _# M. [
    xchg    dx, es:[41h*4]3 |7 z& `7 I0 M) q& B: X* |
    xchg    bx, es:[41h*4+2]2 Q# J- d+ |  S' y
    in      al, 40h
0 M3 k# Y1 F( m: ~    xor     cx,cx) I3 y8 a& W3 k/ _! B
    int     41h" P. p1 i0 N0 W$ @. d' B" A. c! N
    xchg    dx, es:[41h*4]
, Z4 F, t' o! U" j. [7 _    xchg    bx, es:[41h*4+2]
+ A' `2 @# ?/ D# I5 w  z0 h    cmp     cl,al
% |  p* u; _  |2 D0 w) m    jnz     SoftICE_detected
! d% d) _$ \' ?( g" `+ ]& c( u6 Q- j- G/ B9 M; e# ^# u+ Z
_________________________________________________________________________
& i! i! d; f( ]2 v/ l0 Y+ b0 ~  C- d& ^' d5 `
Method 07
, p6 v+ H& H" u' Z6 Q+ @=========
3 j) Z5 w7 C4 N7 Q
8 w4 b5 p; A9 t7 P& |) _! j' _* EMethod of detection of the WinICE handler in the int68h (V86)
9 g' T7 ?+ x, q6 h& [* b$ F! \" U" R( s4 u
    mov     ah,43h( F8 a2 \  f/ n1 K
    int     68h$ ~" l2 _0 a- `0 Z* j$ z
    cmp     ax,0F386h2 |, A1 X8 z( I: K
    jz      SoftICE_Detected6 d+ T, J6 z2 V" M7 _& k6 m+ Q
6 q) ?  y( y+ W( g9 D
6 k" {; \$ Z( b- Q1 ]6 O/ M+ E# D+ \
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit6 D, A6 X; x$ q1 P# r
   app like this:
5 R7 T( M' e' T! W6 |; t1 W* c- w* Z3 f
   BPX exec_int if ax==68
- X% E* V7 V% U5 F5 y' a  }: P   (function called is located at byte ptr [ebp+1Dh] and client eip is
8 D1 ^9 O0 y! F. `   located at [ebp+48h] for 32Bit apps)
- b5 T4 H0 }1 k5 u& k1 X__________________________________________________________________________
: K. t) b& f- P( E5 a" n  \
+ p: M* o$ y) o  P8 {. X0 O
$ C! \- C; C8 IMethod 08
( J+ n+ b% f% A* F" |=========
, t& L6 Y. I3 z4 `
8 L6 D$ Q4 k+ T7 eIt is not a method of detection of SoftICE but a possibility to crash the
! v( N. \4 j- C: ?. p! ~% M1 J. dsystem by intercepting int 01h and int 03h and redirecting them to another' ~8 b1 i' G- d3 E% M! \
routine." P9 g9 `) u1 G" t( T1 Q* l
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points$ ]9 ^- V& {* r. k, K
to the new routine to execute (hangs computer...)
1 G5 H9 a! h: T0 G. g' n* L
8 [9 h; {) |. {  M7 z& j9 _3 I& p    mov     ah, 25h9 F. Q3 J; E+ j2 o4 y  G7 D: v
    mov     al, Int_Number (01h or 03h)
/ g. A/ @* `% C$ d    mov     dx, offset New_Int_Routine
% b7 l  L: A) B& V+ F    int     21h- R# a7 ]; }, a  d
; l- {9 @4 j8 }( `& J6 q4 p
__________________________________________________________________________
% }* J' ?; Y7 A3 l7 U& S
+ J2 q4 @* L, {& T* \Method 09
* T2 q+ G2 [6 S4 Q* u; e=========" L3 n$ y6 l4 |  @5 }' Z

! c' p1 y. {- }  X2 j( W0 A5 ]This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
( Z8 B3 z8 J7 n$ n* q- |! Kperformed in ring0 (VxD or a ring3 app using the VxdCall).
1 Q$ x( J' m2 N3 V( JThe Get_DDB service is used to determine whether or not a VxD is installed% e4 k( [' h+ X! x( \
for the specified device and returns a Device Description Block (in ecx) for/ i" i% Q% H# }  V% }
that device if it is installed.
; \7 L+ S3 u" h" e8 U7 O
7 |2 n- Z6 ^5 D1 K1 \   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
; W" g) Y9 U2 o# \8 k. K& @8 ?$ T   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
2 \0 M# g! B, w3 H3 r+ L& Q1 M   VMMCall Get_DDB
8 [4 S, }' t0 h. [   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed' @) R3 r% E6 e

5 i1 \$ |5 y, J7 q# DNote as well that you can easily detect this method with SoftICE:3 @+ S- I# n! ?- R6 [' ]7 u
   bpx Get_DDB if ax==0202 || ax==7a5fh
+ g3 s: k* l: F+ B- _1 y3 k& k+ k) u% S* |; w
__________________________________________________________________________
5 ~. f% b. l' v' Q+ B" S
+ P# Q4 d) w. J% jMethod 10- N" _) [5 \( V! v9 J, ~9 n+ `- Y
=========
4 T- u- [! P" |* I0 u: R4 w0 R" Q5 M% x+ {; S* V, n( F4 A
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
8 W0 e3 R' P( K& `  SoftICE while the option is enable!!
1 N# c9 C7 ?6 H3 C( t8 U( c1 M& I" O' G7 N. i
This trick is very efficient:
$ Y6 `5 H, U4 n% e8 T8 Y* oby checking the Debug Registers, you can detect if SoftICE is loaded! ^% [1 {- I8 x/ u, Q  l. y! W
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
- J5 R, J4 ?3 L3 e" l8 J) z2 Mthere are some memory breakpoints set (dr0 to dr3) simply by reading their% ^6 U7 l) ]* P0 \
value (in ring0 only). Values can be manipulated and or changed as well
( W( _& _9 |3 c* v& d8 n% h' @(clearing BPMs for instance)! v. T- t) l) p$ L) d

; b0 q6 C: r: d/ N; L8 }8 n5 ^__________________________________________________________________________7 q, P1 W, m. Z8 M
8 x" s% |: C6 v! |3 \
Method 119 ?: U/ Z! [. M7 b
=========$ A& n. @7 i8 K2 r/ d4 v8 W

3 l3 Q/ d3 e* o! ]2 c  }* |* h# sThis method is most known as 'MeltICE' because it has been freely distributed: b# |2 F4 T, |/ c8 c
via www.winfiles.com. However it was first used by NuMega people to allow4 f$ L2 J4 k7 ]# Q
Symbol Loader to check if SoftICE was active or not (the code is located
7 _) X0 J2 g/ a; h, b6 F$ D" }' cinside nmtrans.dll).
; T4 ^, e. w- o1 B/ P8 e) r8 Q3 \: s9 F0 @1 L$ W  J2 k
The way it works is very simple:
( i7 o! p  ^0 e' c( [5 s8 O! xIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
8 r6 p! Z/ k- s1 x. `$ o8 t- OWinNT) with the CreateFileA API.
& t3 W9 M; M" T: I$ B" \3 U. w8 B( q* A1 P; o) y
Here is a sample (checking for 'SICE'):7 Y, Q* Q& L/ [; u- L, m

, T) V* I9 T( x" ^/ u5 HBOOL IsSoftIce95Loaded(): d; p! D( Y" q% t2 y
{5 E4 C) g: ~9 d9 a
   HANDLE hFile;  
. E  o1 ]6 E# _8 a   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
# l! d3 X8 @1 U# ]; W" B* V                      FILE_SHARE_READ | FILE_SHARE_WRITE,) v% J- N1 N6 s1 q
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
+ H9 ~3 @, w! R3 q   if( hFile != INVALID_HANDLE_VALUE )
* N7 N  F! ~$ z# h   {8 R1 G! g* V: E4 f$ e8 h" U/ r5 o  j
      CloseHandle(hFile);% e; A) ]3 V: |
      return TRUE;6 |0 S9 W) E" T$ @4 P$ L/ m, o
   }
1 H9 `" \, r6 o# c# x1 k1 Q- y) ~   return FALSE;
% C. Q+ Y2 y: h- r7 h) D! N0 t( u" b}
' p2 v9 A" d1 n7 H$ i8 M2 \* t6 X+ B3 Y) |% ^% \
Although this trick calls the CreateFileA function, don't even expect to be
7 e3 q7 H2 j6 Q; B( xable to intercept it by installing a IFS hook: it will not work, no way!0 ]# q- O6 U& \( J5 j$ a
In fact, after the call to CreateFileA it will get through VWIN32 0x001F2 C8 L1 L$ N1 Z$ K% N' c' ?
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
  z$ C3 Z4 {1 j* aand then browse the DDB list until it find the VxD and its DDB_Control_Proc/ J+ n: C, V9 F2 d
field.+ ?9 @- X9 O1 Q' O6 B
In fact, its purpose is not to load/unload VxDs but only to send a 6 ?. S5 ~# W8 _$ E" D. i, E
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)( U& X  f9 @' r
to the VxD Control_Dispatch proc (how the hell a shareware soft could try( Z. e1 j8 D7 V7 E
to load/unload a non-dynamically loadable driver such as SoftICE ;-).
& c% E! i1 C" N# N5 H+ ?% V8 E1 O1 VIf the VxD is loaded, it will always clear eax and the Carry flag to allow
( R' O' l6 S1 s3 ]% o1 l9 lits handle to be opened and then, will be detected.
1 n( Q, [3 o, e. s, f! S) G0 {% vYou can check that simply by hooking Winice.exe control proc entry point
* Z) g/ n3 J) {( M* wwhile running MeltICE.
! w: L# q$ l* `1 i! d3 ~2 V
  h' d8 [1 [; I9 H9 n: ?9 {
4 ^/ q$ ?3 L8 u  00401067:  push      00402025    ; \\.\SICE
7 ]: S( T. w# E( }  0040106C:  call      CreateFileA
3 z0 ~2 m6 p3 E) l0 b  00401071:  cmp       eax,-0019 }7 _; B- _5 Y3 b3 e/ M5 ?4 ~8 v
  00401074:  je        00401091& ?- K* v, h; B+ G+ e
+ x: z' F) x% y3 w$ [, `7 Z

9 r/ j% H6 M  kThere could be hundreds of BPX you could use to detect this trick.! ~- p1 g% F5 z$ O
-The most classical one is:+ L, Z. E& Y3 J7 Y. K) E; }  C  G; h' ]
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
* ]% l) ]  G+ M) ^" ?, p5 t    *(esp-&gt;4+4)=='NTIC'5 b, q* i5 d- `7 i
8 v2 S6 R$ L2 P/ G) ]2 X& n
-The most exotic ones (could be very slooooow :-(
+ R1 X5 k1 a& G: L% U2 O   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  4 y( W- D; d" ]5 }/ o% u: `' h
     ;will break 3 times :-(- ^) b0 d; {9 n: y; t8 z9 ^
5 k9 M) D3 n# w9 O8 f3 D
-or (a bit) faster: 7 B1 ]8 S$ r: I" N3 c
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')3 G* P9 A% }. Y  k2 z! s

& y3 u- z( ^# X   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
, c. J' O% H% e! ?     ;will break 3 times :-(
( |- s% I- u* J) F9 L
9 E$ E9 u7 |, L! ^5 J6 v-Much faster:- ~8 b2 S2 ^% w: ^
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'3 `, e+ j" Z. ^( P- N% f4 w/ ~
( b0 R1 L) s( I. v+ Y. F
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen4 V1 K, V2 I) J
function to do the same job:
: r% F# F+ A) X; r; E' g
- u2 ~+ N+ M. w. ?" x   push    00                        ; OF_READ
' f  z  p" x1 o4 M: {: u# R   mov     eax,[00656634]            ; '\\.\SICE',0! x) A3 W5 j6 b8 E2 T: i
   push    eax2 X8 ~% o; @4 Z; G$ E0 H5 `% _" K$ p6 K
   call    KERNEL32!_lopen& p/ Z. |: j& N" n/ o
   inc     eax. u3 \' G+ i0 i1 x
   jnz     00650589                  ; detected
/ u; p- {) b/ Y   push    00                        ; OF_READ
0 F8 ~4 a& w2 k5 U, H% g( h5 z   mov     eax,[00656638]            ; '\\.\SICE'
& W& J/ A/ X/ _; V7 d   push    eax2 T( W/ A9 ?1 L: k: P6 Q; t
   call    KERNEL32!_lopen
2 Y4 E" ]5 |1 h' X$ W; o0 E   inc     eax
' V3 D  D! D0 }9 I   jz      006505ae                  ; not detected
) R" O' w/ S. x
  w& \( {) e9 i: J+ @; U3 k- F7 T# {9 Z' v/ W
__________________________________________________________________________
+ D7 X; Y" |6 a. Z% z( z; b9 r: Z' _1 Z5 y2 f! B( N
Method 12$ }& U9 T$ _9 ~# k
=========9 S. ^* ?2 N0 {3 X0 ^1 R2 C% k& k

3 Y/ c) O$ Q* _2 t1 r  l. JThis trick is similar to int41h/4fh Debugger installation check (code 05
" h1 d& `* s/ ?+ k' z2 I5 g' G&amp; 06) but very limited because it's only available for Win95/98 (not NT)' ^& h1 g* Y& w! r
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.& l8 j- i9 Q; L, }4 w
& I: _3 _/ z* D8 g5 c' G1 y7 [
   push  0000004fh         ; function 4fh
- l9 e) z# g, D- o   push  002a002ah         ; high word specifies which VxD (VWIN32)
5 ?- G  i2 z( J$ h% I0 g& P                           ; low word specifies which service
. A1 n" Y; G6 ^5 s5 \                             (VWIN32_Int41Dispatch)
7 [. x/ y% q3 m& D# R5 z   call  Kernel32!ORD_001  ; VxdCall
* G( V5 E% h; U# h# |8 ?   cmp   ax, 0f386h        ; magic number returned by system debuggers6 H2 S* e4 Z$ X6 t, K
   jz    SoftICE_detected1 z/ y. {7 k/ ~. ~+ q$ C1 l
/ t# @2 ~$ k" T# K  ?
Here again, several ways to detect it:- D3 f3 N" u3 W, T$ G/ W5 X' U

! M, I2 g! a% E9 ~: `, {% k    BPINT 41 if ax==4f: Z' t% ~, @2 h! l

& P3 w; B, M, B$ J/ p, j  x2 ^7 H    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
0 _5 e, e, B9 M! x$ w# S! b3 D. s
# B: b4 q+ T7 s1 M6 g( p! |    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A, T! c8 O/ p. A- K/ r

* W: C% ?7 z" n0 L    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
" a, i- G6 f/ Q) H
* E2 [+ Z, ]# o1 Y$ E& t__________________________________________________________________________
" w6 ?& m" l. @. q3 u' j7 \1 D0 C0 K7 i% q: Z" @
Method 13+ @: S- H! \: U6 W
=========
1 y9 B7 R' N# m- B, L. _: q3 F* ~; E
# X- b0 [  k6 h- ?9 h; S3 r3 V2 TNot a real method of detection, but a good way to know if SoftICE is
  ?8 y  r, Q/ B) j% `  pinstalled on a computer and to locate its installation directory.
! h, K8 u4 |  M9 h# A2 zIt is used by few softs which access the following registry keys (usually #2) :. D& q! o6 K5 Q% Q  e, A

6 \3 a# V2 y: e. ]. g-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
: O2 m2 Y% S  ^- U6 ~2 q$ d\Uninstall\SoftICE& p- G8 ~9 b5 b& ~
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
, k6 g  n+ X0 y-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
$ [# d7 {4 [: b# d+ ]' R9 y; E\App Paths\Loader32.Exe
+ |" z  P+ w9 r6 O* @+ i" q: L5 i: n1 g
: R7 X* Z1 {2 H. ], G$ ?6 ?
Note that some nasty apps could then erase all files from SoftICE directory
+ ?. }7 ^( `9 Q  ?+ K+ `(I faced that once :-($ G1 _, j: U! E/ \- U# ?9 {8 P7 j
# O; S% x- B1 [
Useful breakpoint to detect it:6 J  S3 y9 T: D7 [) b; l& F- k% V
- [+ K, B1 h9 U, t
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
5 Z/ W! @  y: B% r( g6 h+ Q' M
__________________________________________________________________________. k  ^2 r9 ?) `% A' ?' Y; `

/ g7 S3 }  r8 {. x; m. s5 v; B- N' z$ x7 U% W  M9 B! N. e; j
Method 14 1 [0 g6 e& o7 J2 c1 p' L& t
=========
9 G, K% ~1 `1 P5 _5 m& ?
) d1 V2 w' I" ~# R5 G; j% a3 k( ZA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
* Z- A, f/ ^* ]is to determines whether a debugger is running on your system (ring0 only).
8 o* W1 t, h3 b. g# H( F% R
2 h+ W. U  h, b1 U7 c5 X% Z   VMMCall Test_Debug_Installed
  u* `" A1 B% D4 r' B4 \   je      not_installed/ A, S2 U$ _* d4 H
3 o( _# {, p& E& ?
This service just checks a flag.
4 H% |; A0 ]9 x/ ~</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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