About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
0 }3 ]8 y/ V4 @( a3 C<TBODY># Q% |9 K5 {, T1 h. u5 n6 d5 a
<TR>% c: {* I' ~5 z7 j: }5 y: z# Q
<TD><PRE>Method 01 1 r; x( @5 q+ w  ^9 S: Z
=========
# w2 g  J9 N+ g8 M3 I+ m) d+ k6 ~6 E, Y( Y
This method of detection of SoftICE (as well as the following one) is% ^8 L) Z& Y# G% n; _
used by the majority of packers/encryptors found on Internet.' X- }1 L- L2 E3 I5 A
It seeks the signature of BoundsChecker in SoftICE
3 v5 @* Y8 w: w6 N! g1 c# `) W; H
    mov     ebp, 04243484Bh        ; 'BCHK'
1 J- A, `" K: I    mov     ax, 04h
: m3 Q- l' c; c- |9 F    int     3       3 L- I' K* R# R0 G
    cmp     al,4% a/ f) ]9 L) R+ M/ _' e! r
    jnz     SoftICE_Detected
  T3 L( h; J0 D( W; S
2 ?$ ~) z4 X# ?3 Y___________________________________________________________________________
) U2 R, r! B+ J( Y- S/ T5 Q/ I
3 Z: l: N, ~8 m9 h$ B3 \% ^2 [8 iMethod 02
9 y+ D% T  a  B0 }=========. G8 |/ {: x9 ]8 B

! k7 q) C7 S4 d! U, x9 m9 p  DStill a method very much used (perhaps the most frequent one).  It is used7 E' s4 x! z8 t. p1 O2 ]
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,
# U" q  l8 p! ~! X4 r0 {or execute SoftICE commands...
2 k& f1 B" ~: Q% J& qIt is also used to crash SoftICE and to force it to execute any commands: ^. e, {* y, N" b+ s! l1 h' t' ~
(HBOOT...) :-((  
9 y6 B: D1 t4 H( i$ ~
' N& f4 W6 J/ f/ N( _5 j, O5 v* m' rHere is a quick description:; R8 H* [6 S8 w1 o( g
-AX = 0910h   (Display string in SIce windows)
* M* z: B9 G: F5 C5 F4 b" G-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
" C/ Y" y  E% z' o6 d2 y-AX = 0912h   (Get breakpoint infos)
2 ?# t  i$ }1 }, d-AX = 0913h   (Set Sice breakpoints)
4 r8 P" G  t4 K" g, }, G-AX = 0914h   (Remove SIce breakoints)& z5 L+ n8 D7 ]$ w
8 N- A0 {* \1 {, [5 S
Each time you'll meet this trick, you'll see:3 T6 A# I7 J, j" S3 n
-SI = 4647h4 V7 M) H; Z5 w) g$ Z5 h5 w
-DI = 4A4Dh8 A+ a! |! j( n1 H: F7 ^
Which are the 'magic values' used by SoftIce.
4 J! `. N: }/ i+ T6 X. N& nFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.
# n9 W* W. A% Z* u6 O( w% }7 p- t+ F+ I; m
Here is one example from the file "Haspinst.exe" which is the dongle HASP! Q) s* ]: ~; c$ p' E
Envelope utility use to protect DOS applications:
8 S+ @4 |  e; p' h
1 B; b  K* _. @- ]; l7 _
1 l, p9 E5 g3 x4 U/ X1 i; G4C19:0095   MOV    AX,0911  ; execute command." q( E& L$ e  ]; j- @7 t! v
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
* Z1 U' A8 U  p8 S8 Z9 ^4C19:009A   MOV    SI,4647  ; 1st magic value.
8 y0 }9 j, y) @, v8 d7 ?  m4C19:009D   MOV    DI,4A4D  ; 2nd magic value.6 \( ?2 p& z8 y1 A' ?7 w* p1 N* O
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
2 R! |  z, L  j9 b+ V8 K) O4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute1 O0 h/ R$ b! M( `- |
4C19:00A4   INC    CX
+ b5 v+ }* O9 B( l1 Z, U) k4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
* T0 A% ?+ N! q; ?4C19:00A8   JB     0095     ; 6 different commands.& J6 T- Q% f8 h& }  ~$ ^$ H0 c3 Z
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
5 ^6 A2 ~: L; ?% F. l4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :); d# L' h  w1 ?

: H4 F* U& J% pThe program will execute 6 different SIce commands located at ds:dx, which
+ h# P! G2 l$ ], Care: LDT, IDT, GDT, TSS, RS, and ...HBOOT.$ S9 Y7 i& g, A" ?
* P& l: Y5 j' I% h, P3 q7 Z9 A
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.! u) l: \# [5 o' M/ `
___________________________________________________________________________9 {6 f7 |) O9 O0 E' Z( D

* L1 H! b6 @' G0 y# D0 T& }
  y2 \8 ]4 ~, w$ _, Q* E7 F- bMethod 03' ^- m* {- B( r$ K
=========3 h9 m, e& F& g  z* W9 R. ?

2 Z6 ~4 ~9 \3 H8 p" HLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h! f7 T) Q2 F* |4 t+ o* M3 j
(API Get entry point)
( |7 K* K# s$ V- Z        & y9 Y/ S; ?6 A# C$ T, h1 G% a( {

3 x. {( v$ n. R    xor     di,di
, L% G. @2 c6 w6 o    mov     es,di: \4 T3 \, d5 L, p* n& _" ^
    mov     ax, 1684h      
8 }5 u3 R6 F- C' d    mov     bx, 0202h       ; VxD ID of winice% E( E4 x+ @2 _5 X3 ~
    int     2Fh' ~% u8 J. J* `6 p
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
4 J: D  _! N, O5 @: {: _6 h9 V    add     ax, di
2 Q2 i4 Z7 j2 ^; G& u    test    ax,ax
8 G0 h  R( ~3 Z    jnz     SoftICE_Detected
- \4 k6 B4 R; z, u) J: g( T5 L# D# P, Q* P
___________________________________________________________________________( T3 _* Q1 Q6 k8 n6 Z8 O8 M1 d
7 A& a# r' S1 R. @# u: j
Method 047 `- o% s/ e# U+ ?# D. A
=========
  O6 I$ j& E7 F+ t  j) n3 ^1 O' h+ X- U! E6 a* N2 E' j
Method identical to the preceding one except that it seeks the ID of SoftICE
& D$ p! U4 x. A* E1 c8 H* o# o7 KGFX VxD.
7 Q. p' j  Z( ~+ G0 }# S$ k" s; D8 }& }6 z
    xor     di,di% v0 J6 x8 B* _( l5 i# U
    mov     es,di
" D/ u! S6 e- I; r) d! G    mov     ax, 1684h       : }1 H: e, m, \1 R- S/ N% }$ t; A
    mov     bx, 7a5Fh       ; VxD ID of SIWVID
" e5 N" u' ?" o    int     2fh: u5 _2 i1 |- [" G' C
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
" y+ k, G, ^, v$ @. A    add     ax, di
8 ]% Y3 s) B# \  P* o$ I    test    ax,ax
( D) {! b  {1 P4 H7 \    jnz     SoftICE_Detected
! H9 e$ G9 I1 M  p/ H7 L5 K8 x8 a+ m2 \- o8 V0 N  ]* |
__________________________________________________________________________
: h; z5 b/ A( z5 @% h/ R( z7 j6 B3 N- c( W
; h2 A, _3 Q" u6 R& U4 W
Method 05( E4 G" ^& C1 z) O* V) z; A/ a. t/ |% f
=========
6 x/ H) V% m4 k, ^! t0 E' x3 l9 I+ @8 A$ M! W3 V9 O& B
Method seeking the 'magic number' 0F386h returned (in ax) by all system& f/ O( s0 x* y: ~) g+ l
debugger. It calls the int 41h, function 4Fh.
1 m2 i! P  i# X0 |; w( ^( z8 ~' DThere are several alternatives.  $ ~; F' Z1 S! M6 ~8 D
. C& i4 o5 v0 W6 t
The following one is the simplest:
* b5 ]7 x5 ^/ c- X+ J+ @
  V( O) v! F* q' o+ Q& M3 J9 B    mov     ax,4fh
. ]' ^1 M/ d( C& @: A: `! K, u. H9 L    int     41h0 O& |3 Z) `, ?1 O
    cmp     ax, 0F386  }5 v/ @$ ?/ H  ^
    jz      SoftICE_detected1 I7 Y7 A" e  T( Y9 C

1 o$ x% Y% ?; V/ Z" m4 G2 }
& b% Q0 S! E9 {, SNext method as well as the following one are 2 examples from Stone's
0 L# \. r' M& B) m2 ]7 A"stn-wid.zip" (www.cracking.net):$ v% y0 }! A: d! ^, Q
) o4 b3 h# y! c2 e; B4 i: _! ^
    mov     bx, cs
7 [/ D0 [9 [" m2 W1 _4 n    lea     dx, int41handler2
% W5 ]: {) V! }5 F    xchg    dx, es:[41h*4]* o- b/ H& X% ^* R
    xchg    bx, es:[41h*4+2]  O+ r. L% A( f- t
    mov     ax,4fh
4 u5 O: f! c# _  P2 g/ l% L$ S4 m    int     41h
7 r- V6 f: u: q/ m" ?    xchg    dx, es:[41h*4]$ C; y7 P4 H( t0 s
    xchg    bx, es:[41h*4+2]0 Q6 J2 l9 C  Q8 l0 c1 U
    cmp     ax, 0f386h
2 P0 ?* v) V. m1 ]* b  Y    jz      SoftICE_detected- a% w1 j4 F. ~( U% V* x: @

" N/ c9 _$ `- s0 u$ b0 Uint41handler2 PROC" M. ?) ^4 W3 H! }+ n
    iret
5 w4 i, f' B6 g4 H! j/ V& V: n# [; zint41handler2 ENDP
0 b) s) E& U+ K8 H& l1 ]
- s& w; w5 P4 X4 b9 j+ a. w
. ?% J& r+ B: r. f1 g+ }_________________________________________________________________________0 \% |2 E' ^; I* T/ h
. `8 A6 o2 O0 W0 U
* T1 D! ~+ o% Y  O8 K1 h3 k
Method 06  [9 b. H. B" Y0 e( \2 R4 N
=========1 w" U3 c5 X8 ~$ _4 Z2 F

* k7 b# ?8 M" _, J8 C6 k# Q
( W  c6 S6 U" I& G5 M% h) ~2nd method similar to the preceding one but more difficult to detect:4 |7 {7 ~  h9 U* B9 D

' n' D; [3 k5 Z$ L0 {* H  J  l! C  q
int41handler PROC/ K3 B$ }  j1 C, ]5 E
    mov     cl,al- |6 `, ^% E) `# S, J& F" i4 f
    iret3 ?! s: l6 }) w, e# e7 c
int41handler ENDP
2 W& n2 E" j. p9 ^! G& U" e" T. M5 f* M) @
: Z9 a" M6 |0 x# E- Z7 {  C
    xor     ax,ax
' m' s8 K# ]8 L+ |- f+ b% e1 @    mov     es,ax
/ N( x. K4 H# q. y    mov     bx, cs
0 m/ ^% S% }* l2 ?    lea     dx, int41handler! c3 y* l% @1 p& U* F0 r6 E
    xchg    dx, es:[41h*4]
( y5 p* k) o: ^7 D    xchg    bx, es:[41h*4+2]
7 [. A( _" K2 ^    in      al, 40h
8 ?, V* V& w. b    xor     cx,cx
$ `$ Q9 j' ]: n+ H& N. E    int     41h
, |7 w& V* n& f4 g# O    xchg    dx, es:[41h*4]
% B7 y1 \7 |3 A* j) i* d    xchg    bx, es:[41h*4+2]# @# {4 U  L: w7 V$ Y/ D
    cmp     cl,al
! w- |4 ~' i: c' z9 u7 J6 [    jnz     SoftICE_detected2 V/ H" @$ O" U) @/ y7 E% H$ v
1 H$ R' `8 E& Y7 ]; p+ G/ c; e
_________________________________________________________________________
" j( F9 K& {6 D" ~' K( S" f/ g0 [7 @  X8 x' ?, x) F
Method 07) F5 @" f* I2 D# A$ f. x5 t  L( @+ a
=========$ `* c, O4 e8 }/ _- s2 e/ j

. Y' l- {2 Y+ h- ^6 B* aMethod of detection of the WinICE handler in the int68h (V86)4 v( E! Q) S: P4 Y

3 I  U- l: b9 p, r    mov     ah,43h6 ~* L1 x  D* j+ @3 D
    int     68h
& P  y* @* P* l! T% n    cmp     ax,0F386h$ o; }. A1 C5 q  r1 _4 O; G( q  a
    jz      SoftICE_Detected) U+ s8 r. i1 M, W0 o
0 Z8 q! q: V1 u7 k+ G/ U7 r! Y  B
2 s  Y6 S- T+ V1 W8 B2 e% k- q
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit% L( x5 k( r9 G( |. {, \
   app like this:9 ?1 t5 ]+ I' ^( r

/ P, ~: |! t9 [) N- W   BPX exec_int if ax==68
2 A/ ~8 h$ K/ S" T' p   (function called is located at byte ptr [ebp+1Dh] and client eip is2 z: B: c4 [' A9 |. B
   located at [ebp+48h] for 32Bit apps)
& C8 K$ s: {1 f! f* h" T4 A__________________________________________________________________________  ~2 t  Q- }$ b! @2 R( Z

  q  T+ o7 D- A7 k" ~0 Y" I6 u
. ?8 {5 E# q* t$ c9 ~+ p$ j3 h5 n0 qMethod 08
  z# F3 |- K& Q# [8 S=========
) z3 v; S1 R, A0 K. P  ~) u' {  t
) R) A2 t$ O" @; P, lIt is not a method of detection of SoftICE but a possibility to crash the
. ^) h' ~. @; @, ~% E! \  f1 C; a# b$ Usystem by intercepting int 01h and int 03h and redirecting them to another
9 N# t0 f- K1 l) W% qroutine./ J6 c1 r8 o. x
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points) S# ^$ n; q6 C, _
to the new routine to execute (hangs computer...)
; N* S! {) S) ]0 i2 {" W- b0 B/ h3 V  z
    mov     ah, 25h
1 d/ t" g  c, g: |% V7 G    mov     al, Int_Number (01h or 03h)
7 R) R! ?( Y. R2 H' l    mov     dx, offset New_Int_Routine
& a8 y- M: m; }    int     21h
- y# G3 E  b4 Z0 K$ t) A; l+ [* v9 w6 a" W  p9 n
__________________________________________________________________________7 a; p8 b, [! _' d% ~

; S) Y- N0 ^* L/ H5 Z- zMethod 09
, B# m9 I  ^  M=========% j+ H/ [7 r6 ~0 ]9 B* R2 n# F
" `/ t0 ~/ o: N! P  Y" s( s4 D
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only( A! F! L* p! n3 R; @1 {
performed in ring0 (VxD or a ring3 app using the VxdCall).+ I# [2 q1 ^. [: H9 a
The Get_DDB service is used to determine whether or not a VxD is installed' Q. U- ?: k0 \- b  k9 j
for the specified device and returns a Device Description Block (in ecx) for$ ?4 j1 U. e4 h$ O6 y
that device if it is installed.
7 w/ ~4 ^, j( U" I5 A; k
$ k# m; B4 Z  f% I- X$ y   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID0 Q% J5 k- v0 @/ ^/ P% U
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
; T9 |' |( T# l4 b8 |; u   VMMCall Get_DDB
& C$ O  X. B! l   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed/ t8 Q! `0 J$ c# O7 ]
9 Y; h3 L& X+ J9 u& W, V/ ?+ q( c
Note as well that you can easily detect this method with SoftICE:" _- r; D% U4 a9 z/ [
   bpx Get_DDB if ax==0202 || ax==7a5fh& B; j% N- v; e9 U
# M* ?# j% u6 D* j
__________________________________________________________________________7 X  |' j; ]$ w- h

7 X1 U7 p: J3 p2 a5 vMethod 106 h4 `  [* f1 x: r5 o: |6 ~+ Z
=========
& ?- w" Z' ~  W, M& E) ^4 m9 Q
: i/ r$ Q9 K) x- Y=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
" k" u+ c0 c: D7 \  t# S  SoftICE while the option is enable!!
, [. C9 N, q5 L$ g
4 c3 ^7 C6 i# J6 q4 z  E- OThis trick is very efficient:
. M) b9 Y6 W4 ^0 @9 @5 pby checking the Debug Registers, you can detect if SoftICE is loaded
/ D6 D7 N& q8 Q$ f6 E' J+ @3 y(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
2 P# x. q# P. @there are some memory breakpoints set (dr0 to dr3) simply by reading their. m5 [: \" `6 W$ n! L3 T3 ^7 l' E
value (in ring0 only). Values can be manipulated and or changed as well
' v! Z- |) {2 o! e0 w  i(clearing BPMs for instance)7 O7 _+ p% g+ q

- r2 z: I; p4 G2 s8 [__________________________________________________________________________
( M0 u/ c  Z, F8 v) [! V% g) l) q- e3 Y7 B! m3 a" ^) M4 P$ a6 I
Method 11
3 Y) g6 K, e% l& ^4 o4 @=========1 b: S' Z) J' H% ^

5 V8 y7 Y& m$ _- k, J) W5 Y3 QThis method is most known as 'MeltICE' because it has been freely distributed
8 d& R$ L( I8 @via www.winfiles.com. However it was first used by NuMega people to allow
; O; M) x+ R; o2 v# y" k. z7 dSymbol Loader to check if SoftICE was active or not (the code is located' x- b( S* T2 v9 n, F4 A
inside nmtrans.dll).* z! ]% L' f/ Q$ y- @: l& m
" d7 U- H! I7 S( S
The way it works is very simple:/ `4 S2 A7 ?1 u7 M
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
; x$ Y3 u0 n" @6 R# }WinNT) with the CreateFileA API.
2 M5 d) l6 k( C9 T3 r! h4 l3 u  [# N1 O  u
Here is a sample (checking for 'SICE'):
' \9 c1 Y$ @( w2 i0 M  a: l. @; [1 x# U3 q+ m+ ]
BOOL IsSoftIce95Loaded()
/ J, g2 p5 G: L' i6 D4 U{
- b3 e4 `% U( j  r$ K' J" i6 Z1 ^3 E   HANDLE hFile;  . A; Q2 z" X4 P" H) C
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
" j& w! [2 q) h9 @                      FILE_SHARE_READ | FILE_SHARE_WRITE,$ k6 c$ `$ @! \1 r
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);2 t: o  Y4 z9 r) S6 `! Z* w
   if( hFile != INVALID_HANDLE_VALUE )
6 h  O1 X" w9 u8 ^) b   {
! F: z' }! r( o' v+ U      CloseHandle(hFile);3 z; G3 r& H2 C5 p  c$ n
      return TRUE;
: f0 N/ v; D9 _% d; l   }2 p% K  J  f0 K+ i1 `# _
   return FALSE;
5 M5 {: G7 E' `% F* y( a}$ m# I+ Z, z3 R& ^$ F

$ [' x4 M" Q9 Q5 [6 ^Although this trick calls the CreateFileA function, don't even expect to be% W  W5 \/ ~0 v1 k2 Q7 f
able to intercept it by installing a IFS hook: it will not work, no way!
" V4 Y9 f% e3 K. B) yIn fact, after the call to CreateFileA it will get through VWIN32 0x001F
) S2 w0 c  N2 o/ {7 O1 S3 T* }& `9 J8 Pservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)! L% O& c! u& i7 [
and then browse the DDB list until it find the VxD and its DDB_Control_Proc
4 [3 p7 T2 U; b. rfield.8 Q' w0 f( t( V1 s) C2 P! s  ?
In fact, its purpose is not to load/unload VxDs but only to send a ( I* L9 q; x  y# L* U2 _
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)8 u; \2 U6 m/ C- ]
to the VxD Control_Dispatch proc (how the hell a shareware soft could try
; ]  o4 i$ q; R7 m6 Xto load/unload a non-dynamically loadable driver such as SoftICE ;-).  H" D2 p$ P1 \, f4 M- s& k
If the VxD is loaded, it will always clear eax and the Carry flag to allow
" [) m: \/ A+ x/ Oits handle to be opened and then, will be detected.
& ^# f* @/ y1 }8 cYou can check that simply by hooking Winice.exe control proc entry point5 y4 d1 d" x0 A# E! u
while running MeltICE.
8 k0 G  v% C4 R8 n# N- l1 C+ }# Z( d6 d: g" }
* ?- R5 n) f/ b4 i
  00401067:  push      00402025    ; \\.\SICE
& A" T' _9 J  b; C& [: L) p  0040106C:  call      CreateFileA3 @# ?! p) ^' i3 r4 i- c/ H& w( l
  00401071:  cmp       eax,-001
/ M6 F7 {# E0 o7 P- _$ X  00401074:  je        004010918 @" ^: M$ ~6 r& j
0 g- u5 q) o3 }+ G
: Y; p' I& G5 E9 l2 q2 }
There could be hundreds of BPX you could use to detect this trick.
* O: t# e. Z9 A9 K( }+ x& Z8 n5 X-The most classical one is:
8 S7 }! a- s: M  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
8 S' b0 ]3 C+ `    *(esp-&gt;4+4)=='NTIC'  f8 I/ ~! i' V3 o

. [2 r/ O7 [8 v8 [: a$ u2 @% i-The most exotic ones (could be very slooooow :-(. R" q, p! \( [9 T4 E2 F; Z- u$ [
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
$ u* q$ G  {# i* U1 N     ;will break 3 times :-(
3 [0 Q' U+ C8 v0 Q- F( e3 n5 R+ W5 B5 `0 B# {- W; ]7 Q: {
-or (a bit) faster:
* l8 q. X! ?- ^0 o5 y% B0 l  @7 c   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')" f/ S; o. n+ ]5 D$ _' M/ h  j
, ^, V/ r& C: K, i! ]
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  ; a, V' n. C9 G) o/ n- T+ C
     ;will break 3 times :-(
- H: G$ m# V: @  \- o
; ~2 N/ ~# H; S" A# P$ W% w" R9 ?-Much faster:
9 k7 g+ z3 Z+ i  H* X" f   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
  m) H1 f( x# v' X! @* T: ]0 p- D' }9 ]  ^% I4 Y0 m% s4 m$ i7 N; C' `
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen$ |% F: a2 U% `+ }
function to do the same job:  c( g* c* v$ H7 L6 n1 R3 T

4 M  c  g, s% N/ z$ x1 L9 `  S   push    00                        ; OF_READ4 E! N. i3 S' o3 ]
   mov     eax,[00656634]            ; '\\.\SICE',0- |; a7 |$ Z; G$ |
   push    eax+ m( n/ q5 x, q, }3 Z
   call    KERNEL32!_lopen
1 N6 ~( Y& B- g   inc     eax/ J1 b) N7 N2 m9 w
   jnz     00650589                  ; detected( C, k& Y# U8 {: Y7 f
   push    00                        ; OF_READ
# b* X' {8 \6 x5 V& y5 x   mov     eax,[00656638]            ; '\\.\SICE'
1 @0 f+ U& x( j; W9 k" [   push    eax
0 p- q* f% v# ~1 E0 U7 U7 ~! j   call    KERNEL32!_lopen
* I7 B6 M! k' _* y% E6 V   inc     eax
7 k! {% |) I5 m" S  U; v   jz      006505ae                  ; not detected6 g8 b4 {5 b7 ]7 X, L3 N0 d' s

" [3 ?5 b, z0 a, W1 t0 F" m
$ O7 J0 C; e% g* o! }, W__________________________________________________________________________
$ l! [: Y$ n6 R9 u6 w( |# ^" Y1 \7 u
Method 124 A5 h' o, {. ~( r& u2 Y
=========
. t, q7 l/ M8 O! @0 i4 W# @+ }! P. U6 ]9 D5 \( O1 H6 j
This trick is similar to int41h/4fh Debugger installation check (code 05
4 ~' g/ J# |9 l$ i/ q# U. a&amp; 06) but very limited because it's only available for Win95/98 (not NT)
5 j' G1 T" p& H% x- l% r2 T2 kas it uses the VxDCall backdoor. This detection was found in Bleem Demo.
' i4 i% I6 u' P! z- V* q& E) O, x, @! a" X
   push  0000004fh         ; function 4fh& p: G( `' w" Y! F7 l
   push  002a002ah         ; high word specifies which VxD (VWIN32)/ b9 Q2 ~3 H7 W# w
                           ; low word specifies which service: s% a1 h* f  k1 x, z+ P( g
                             (VWIN32_Int41Dispatch)
- |% }$ v" |2 q" B$ p   call  Kernel32!ORD_001  ; VxdCall
* M* q+ S( d" [: ^1 C  v   cmp   ax, 0f386h        ; magic number returned by system debuggers  M1 R- F: B5 e/ E. ^
   jz    SoftICE_detected
4 m9 \3 K$ C* P
- N2 x9 V7 ]0 u( xHere again, several ways to detect it:7 g7 g1 ]9 `9 Z' i- L1 _

  y/ C9 \: z$ Q    BPINT 41 if ax==4f
( e2 c, c, k% S6 ~# M2 P9 t) ]( ]  y& U3 U
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
3 X0 |1 T/ B. t9 [! Q% [- _3 R
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
6 _  t7 b: K/ E+ ]8 C3 J8 V4 }* |7 D9 r7 A5 M) U! v) y$ n
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!7 E8 q1 \7 a8 f& Q
9 i" U0 Z& J8 a, j: A5 B; v
__________________________________________________________________________
+ y: f( R$ a$ ~! Z% K: D! [
% ^# H. I  Z* _8 V7 jMethod 13
/ g: F' [/ ]6 A# i=========
' f4 D( {& G( W+ N; L, y. H' w6 E9 a7 A( d: r% ]) w
Not a real method of detection, but a good way to know if SoftICE is
; @: Y8 J  l: B# R& D! Y8 ?installed on a computer and to locate its installation directory.
5 o8 V* E9 U2 T9 _) _It is used by few softs which access the following registry keys (usually #2) :! `- }$ r/ [0 \" V) J
$ H0 T( B5 m9 n' e3 I
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion! b! j6 B8 i  g9 G. R6 R, l1 F
\Uninstall\SoftICE
0 E" O+ ?$ G6 ^5 Y-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE& M9 U) M6 T1 G' {, ~* `3 g& j
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion6 T( C9 O+ Z/ d+ f  L
\App Paths\Loader32.Exe" s$ z% W/ R0 X& N: q: ?% d1 R

5 |( g3 N1 h0 W0 |# y5 W# \4 ?# B, F% k- y, R- p
Note that some nasty apps could then erase all files from SoftICE directory6 }) [) C! r9 z, `, N/ |1 f: M
(I faced that once :-(4 Y9 Y' M. P1 m# K

$ e% W. m2 P3 I! x6 l* ^Useful breakpoint to detect it:
7 t1 e0 w- ^4 Z/ D4 O* O3 q1 @- X/ Q- O
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'+ F: P, G% h* y2 T- b

3 K5 R3 ?( J6 d( ?% {6 w) [__________________________________________________________________________
6 A- w$ C8 w+ X+ o. f$ r% F) n, b
5 t% ^9 p( z* t, G2 m  a& B
( ~$ _) T8 x/ D9 H; n) ^Method 14 , t, D" E, C, D7 Y
=========* I" R" Z+ U1 x# f

/ k, a1 K4 b" c9 T+ HA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
: @/ A& U; ^3 Z& Mis to determines whether a debugger is running on your system (ring0 only).
9 y5 j. S  F0 l3 b) x6 _7 C& U. q3 D6 ]9 E7 I1 o7 O
   VMMCall Test_Debug_Installed
5 L0 Q! l# A+ `) K- q' H2 f2 |   je      not_installed" o2 F. t. H+ X6 F, h, W8 ^

" n+ H1 c( C# G' yThis service just checks a flag.
3 Y% o8 F# _; m! R</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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