About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>. a# j9 K- o3 e  F
<TBODY>" ?) Q1 H7 w* ?9 P5 h! O6 @& q
<TR>/ u7 f8 e. o: l; `+ H8 r' O3 j
<TD><PRE>Method 01 ( o7 ?0 s0 s4 i% S; F  [
=========
2 K9 V+ E+ \9 J" I0 d! F" U
1 ~, E' `* ^8 L7 sThis method of detection of SoftICE (as well as the following one) is. R3 J3 E) J8 F" }! m, I8 o
used by the majority of packers/encryptors found on Internet.
; b& H& e- W- _' H' m8 W% \" eIt seeks the signature of BoundsChecker in SoftICE' O" F% ?/ B; O
; ]$ ~) s6 S& r) u. f
    mov     ebp, 04243484Bh        ; 'BCHK'( k. [2 Y. g0 ?$ \
    mov     ax, 04h
1 K* v0 j' W: ]    int     3      
- P$ a9 P$ O/ p1 a$ p    cmp     al,48 ]( q, z  V6 W, u! v8 P
    jnz     SoftICE_Detected- S( F) u) L7 Z2 L% k
7 Q, l: v; N6 V8 s  _
___________________________________________________________________________8 V7 a: p1 w# c$ }9 n- |# P+ ?

5 K/ a  V1 n9 l' W( u. OMethod 02( ]8 I* W1 N. G. w, |, X" L* c
=========
' d! y2 ]& v1 f
# j: k* m* F( e5 K8 v9 OStill a method very much used (perhaps the most frequent one).  It is used
' V' {  _; m+ z1 U$ Z& V/ Zto get SoftICE 'Back Door commands' which gives infos on Breakpoints,  q( @1 s5 O4 D& D' Z
or execute SoftICE commands...
* c( _; d5 p# J7 y0 L7 {0 T- cIt is also used to crash SoftICE and to force it to execute any commands' w! B& s+ _9 r! T* A# H
(HBOOT...) :-((  
6 {6 x. Y$ u! s' V0 Z# u& W% M* ^. r/ X0 q- A
Here is a quick description:
: x3 _4 l3 |- a: n% D. I-AX = 0910h   (Display string in SIce windows)) ^/ u4 q, E" Z* S- w9 w9 Y$ n- V
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
$ a  ], H8 n6 E$ \( h) J-AX = 0912h   (Get breakpoint infos)
1 ^* a1 E1 M! V  R- ~-AX = 0913h   (Set Sice breakpoints)
5 |1 M: B: G9 w3 x0 J-AX = 0914h   (Remove SIce breakoints)
4 S2 }& K- z# _5 P) a9 E2 \' ^4 Z- j! v; ^0 V) y
Each time you'll meet this trick, you'll see:$ `* _$ O4 {; e2 R, K# r
-SI = 4647h
0 Y. ^, o) o: c9 Z7 L' f. Q, ^-DI = 4A4Dh. t/ A. Q1 ^* z6 t% b1 }: A& J
Which are the 'magic values' used by SoftIce.
0 h$ \) @; o0 A/ y) k8 m; QFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.
, N% o  o- ^* x  O3 A0 I( Q' n1 I6 g+ `- U2 _
Here is one example from the file "Haspinst.exe" which is the dongle HASP2 D9 O" |% i4 z" X  \) _. Y3 C
Envelope utility use to protect DOS applications:
7 ~, O1 b' b. y( J! N
  |9 w% Z" t# v; `& }; \4 e1 L5 U, w* b
4C19:0095   MOV    AX,0911  ; execute command.
9 l. D& j% e; v3 ~+ X. a$ B) l6 f4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
: z, D% H& t! H2 r  d4C19:009A   MOV    SI,4647  ; 1st magic value.. h; b1 I* n2 q% Q: D5 a
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.5 D! b' }( \% v9 a
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)+ G8 W8 B: i. w$ i5 U6 @; a
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute7 m) t5 [% [( N. o6 t/ f1 t* W* k
4C19:00A4   INC    CX
5 {' C2 z9 f9 p: u5 f4 o4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
4 {5 v0 P$ X% ]4 x0 E: L' h4C19:00A8   JB     0095     ; 6 different commands./ g  [. [' m1 w/ d; b5 ~
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
$ u6 P3 |* [3 U& }& ~3 S5 J/ H6 E4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)1 C% ]$ g) L0 [) {* N

( m1 j5 @7 ]+ [0 GThe program will execute 6 different SIce commands located at ds:dx, which& `3 P1 l( E4 x3 N: v# z8 u+ C7 ^
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
  {) a" s9 A1 E4 ^0 u
+ j5 \6 S% J# k$ Z* x* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded./ t6 Z  m3 W( Y$ O" {. Z  |5 m
___________________________________________________________________________8 q, g: N5 u, z9 E/ S6 _" A

- f+ N/ Q, `/ R4 Q7 D' ]1 j
7 ]/ Y: f4 h0 n- x. Q8 T. z) b$ vMethod 03
  T9 M' e5 X9 Q' G=========
8 M& N) ~( V2 @+ r. D6 n! \+ u6 g- \( I* o4 b
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
' N6 X6 Y8 D+ k% R) d5 |* t(API Get entry point). d2 K! A& n. ?- o
        
2 m2 i4 p" z3 |. B5 E7 D6 ^
4 p+ U  G0 P0 U' M/ c& W    xor     di,di$ Y! ^+ l0 X- c
    mov     es,di
, P( t3 k0 Y6 K$ l* q    mov     ax, 1684h      
7 S: O  V) T3 F& e& M    mov     bx, 0202h       ; VxD ID of winice
% S* i6 `1 R6 L. D; f0 _& h3 f    int     2Fh7 Y) B3 g; H7 Q3 _. ?2 O6 L1 t
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
& ?/ i4 \* Y4 a7 U* U/ h* Z    add     ax, di
* g: w  D0 `& B1 y' f  P# Y    test    ax,ax  Q! K& M9 R) }2 T
    jnz     SoftICE_Detected6 z3 F8 `8 _9 n" |" S% r) O

" }. G) v% ?1 L( V* Y___________________________________________________________________________
7 A# q" G) T  e" w* a% k$ `- R
; F$ G! z3 {* R$ U5 ?  hMethod 04, d9 c7 V( X- @& G$ n
=========
2 t6 Y7 g2 S# f+ q
% [4 z! e6 B3 O0 s, fMethod identical to the preceding one except that it seeks the ID of SoftICE7 g1 u6 o6 x+ y& ~( M1 d, I& X
GFX VxD.
/ p9 Q) A% ^6 @. O5 T$ d2 L
0 G2 z1 r3 I* K: Z    xor     di,di
) _3 i8 S- r$ ?7 H' q, }    mov     es,di1 p# p! ~! q" j9 B
    mov     ax, 1684h      
3 B9 v' L" `7 U& z$ E" ~3 t8 K    mov     bx, 7a5Fh       ; VxD ID of SIWVID
  e+ t; n4 x1 i0 q- n2 W    int     2fh9 b" n9 [+ t$ \7 {9 t2 Y  ~
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
- ^! u! d. Z6 C6 J3 g    add     ax, di8 C% F5 ]( F' e2 K, ^7 Y+ M
    test    ax,ax
; h7 Y" h( Z2 ?4 e    jnz     SoftICE_Detected  \  T" ?0 L: N9 c" s

- Y$ P; s, I+ x% q6 U) x__________________________________________________________________________/ G4 w5 p: P  |0 O% D0 Y
( i/ j. I8 r+ \/ l" U) O& J  q$ P

& t% B+ v4 O$ B) M# b3 q) TMethod 054 j  q* d' x* h& k2 F1 b2 L/ g
=========
& g& M5 D: V: A0 V
: e8 d0 D9 ~# f8 M  c9 k5 pMethod seeking the 'magic number' 0F386h returned (in ax) by all system
+ `% B# _% g2 y" T/ r% ndebugger. It calls the int 41h, function 4Fh.! H4 V5 F8 a* u
There are several alternatives.  
3 v4 g9 K3 s) X  {0 t5 h$ J
9 l3 s2 r! N& C: n0 H3 o& KThe following one is the simplest:- Q% D3 N4 s& _4 q. ?5 x+ o

2 N  n% w6 K) S1 f# B6 S+ ~. c0 ?    mov     ax,4fh3 X+ A* Q- i: _8 H; f/ T- E1 @
    int     41h
0 d& N+ V3 c$ N# a9 b7 J" @: j& @; f    cmp     ax, 0F386
, U3 l2 p* H5 f5 F- R% k$ t    jz      SoftICE_detected1 C% o3 z! `- W! R# B
2 _# e6 q) o9 e; D4 [$ U

5 Y9 _  I% o6 q: T- ~8 QNext method as well as the following one are 2 examples from Stone's ) l# j6 f1 }$ @  M4 {
"stn-wid.zip" (www.cracking.net):
/ [# x/ D' {+ |$ {$ f$ B
0 j6 N- O- |( w; W* _    mov     bx, cs
; N# ^4 U0 {9 ?    lea     dx, int41handler2# f! n$ H. U* B2 {2 v( R0 j2 b
    xchg    dx, es:[41h*4]6 V0 w- Y% g# p( }. l; d* R! L8 R  K
    xchg    bx, es:[41h*4+2]' T4 L8 {9 m+ q. Y" w# p
    mov     ax,4fh) B$ ]' b1 ~+ b( F$ _3 z
    int     41h* i- r* p4 L& J! R$ s% ?
    xchg    dx, es:[41h*4]# U0 a4 I: y- s7 z! ^! Z
    xchg    bx, es:[41h*4+2]
& H& @+ \/ K! ?; I" M3 q    cmp     ax, 0f386h
; o# f  C( \0 l  ]    jz      SoftICE_detected7 m1 w% d( @% C1 x0 @) W* G

5 _, u' i  S* N  U8 S, lint41handler2 PROC
# j9 a8 r# s( |0 j. _$ K: M8 V    iret9 T0 C/ G! @( R8 Y
int41handler2 ENDP( k$ p' q+ T) h  t: x% A4 a6 K
. R/ E" M0 ^! g

: g/ K; {# n1 o: {- n_________________________________________________________________________& O, j6 O+ F' `) r& h
0 P, P) D4 S8 g/ g
! R2 G& q9 {" {( T, i3 S
Method 069 T# u4 W4 l/ r& Z5 Q, z# c$ O
=========
! O, ~! I! p/ ~" ~( I: N6 ^' `+ j& a9 F

5 {, s, t  h- U' f0 }5 x1 R. P2nd method similar to the preceding one but more difficult to detect:
; p3 |# v9 B+ L' K0 N3 A% o4 t7 f) A6 {- Q' K( R: Q7 A

; a8 r$ h0 k# T9 b2 ?0 ^6 `int41handler PROC# H5 W  @. T8 G3 S
    mov     cl,al; @- k0 s' j5 D* W8 \
    iret
4 a2 V9 b7 X* qint41handler ENDP2 ?  j( g4 |* g/ b

' Q6 @4 @5 d7 u! p/ `7 k0 ^, i( J
    xor     ax,ax
/ m7 N# m# }7 B: i( y, e1 _    mov     es,ax
5 F2 p' M0 A0 ?% r8 Q/ j5 r    mov     bx, cs- y! G/ U' I1 G% K5 N
    lea     dx, int41handler% P2 ]2 Z8 p0 u& D+ K) U
    xchg    dx, es:[41h*4]
5 P4 m1 X1 v  _# }# o  r* f    xchg    bx, es:[41h*4+2]
$ {5 H) X2 L5 O# @    in      al, 40h+ r$ _7 Q4 _* z9 \) N# I, G$ c
    xor     cx,cx) v6 m/ h! d0 V+ \+ U, W
    int     41h/ i3 m3 Q* s/ B5 E7 ]9 I
    xchg    dx, es:[41h*4]
  E+ r( j1 u" w7 O% F4 @  d! `    xchg    bx, es:[41h*4+2]) j' s% a, B7 F- O6 J0 g5 v
    cmp     cl,al& f! D; t2 R! R* c
    jnz     SoftICE_detected
3 t6 B: g  _- `3 _* [* K4 N) _9 l2 J. ]1 h% m9 ~& H( p" m; y  r5 [
_________________________________________________________________________$ F& D( e8 Y& `" x, |7 V
& g! L0 M1 ~9 p* d
Method 07
7 K  I+ f& z+ D6 n6 x8 F=========
$ k; G8 |. U3 _& L" s  H- r0 F* Y
! K4 F9 c# F+ U0 f8 N) K+ TMethod of detection of the WinICE handler in the int68h (V86)
: a6 w" A: \) Z, L2 P: A- b" s
    mov     ah,43h  l; J4 @$ Y& U- r$ K* h+ N
    int     68h! S5 ]) C" }3 D
    cmp     ax,0F386h
: B! R& f3 F) y0 Q5 P- m    jz      SoftICE_Detected/ O2 C# }: \! u
/ u8 q1 M3 z$ F5 b5 Y# @

/ d  s0 Q# U' Q, S1 [/ c6 U=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit' @7 U4 C! u4 W: J$ X- @1 F7 Q6 M
   app like this:$ w3 y/ ^  ?; N% ]- n
4 ^* O- @, O4 b: }
   BPX exec_int if ax==68
! p3 A6 c8 M( o  a   (function called is located at byte ptr [ebp+1Dh] and client eip is& W9 }2 b6 l! p4 Z
   located at [ebp+48h] for 32Bit apps)
1 h8 x- a' w2 k% f8 ~__________________________________________________________________________
# a' V5 I5 W  B/ y; `0 F* {& }7 l. ]1 o3 v" e+ B

0 M& b! _0 p2 ]* ?Method 08
4 ~8 ?: @( o5 D9 Z=========( k3 r1 y4 }3 u3 A

) d) N% J/ _5 ]9 x8 w5 eIt is not a method of detection of SoftICE but a possibility to crash the1 r5 B% L' w+ ?( X, l/ ~- _( J
system by intercepting int 01h and int 03h and redirecting them to another0 g3 w* w' k' F
routine.
) {. b3 K; ~( W, ~( C" AIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
2 v1 W4 k5 _- S( g5 X1 O2 v; b2 U+ n8 Lto the new routine to execute (hangs computer...). R* ~8 t4 r8 l7 a
% R7 u/ ^5 J) S% l
    mov     ah, 25h
, @# w: v. X5 @    mov     al, Int_Number (01h or 03h)
6 d# P$ N7 b' k3 f5 p2 ~    mov     dx, offset New_Int_Routine8 ]) U# m0 u( [1 H# i; H5 U
    int     21h& s1 E0 ]$ {  |# s. G/ p7 j

  d% k. h4 a( S3 v+ I. U__________________________________________________________________________' P2 \9 Q( O+ K7 w$ {$ I

9 D0 v5 h: D4 |9 |Method 09. x- y5 d, Y% l6 P
=========
4 N. ]1 J- \3 J4 R9 n& r" y7 E% o7 M; m& n
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only& {" L! n7 h+ j+ _' ?
performed in ring0 (VxD or a ring3 app using the VxdCall).% E* F: s, [& `/ x& N: T( \8 `
The Get_DDB service is used to determine whether or not a VxD is installed
8 B8 A; Z+ [4 k2 N! yfor the specified device and returns a Device Description Block (in ecx) for  l& i$ s& R5 N0 }* d; S* ?% @
that device if it is installed.$ D8 H7 S, T" F/ v5 O7 J
: x' b5 l) r0 `6 d
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID! f5 \/ _$ [* {4 p8 q# e& k4 m
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-); H; ~6 C; o5 g
   VMMCall Get_DDB
+ S4 B6 F- B8 X  S) O4 p   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed# p6 h. f( T  W2 h8 U+ Z7 [

8 P- e, B& t! ANote as well that you can easily detect this method with SoftICE:
! L. V; _, a" h0 O# G. g: n   bpx Get_DDB if ax==0202 || ax==7a5fh
" |2 Y9 T8 X. v9 I6 r
! u0 J4 m+ r4 ?6 L; x__________________________________________________________________________
2 w  \8 r, E' K$ y
; A5 F$ E% m- }, a: \Method 10& w3 k7 [9 a2 w6 R# ?' Y
=========
7 ]  g3 p5 @$ S7 t, h' _' c4 V
* |3 F6 M1 \8 P6 Q7 w=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
) F. `; ^! P+ V+ U+ p, F  SoftICE while the option is enable!!" Y" W' k& Z! |% y& D) p( q2 |: `
" S3 e: t$ V' h" p2 ~4 q
This trick is very efficient:2 ~! R: B5 G- C% W8 k+ [1 K. t
by checking the Debug Registers, you can detect if SoftICE is loaded/ Q+ T" P/ I) q3 I  u
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
5 ]# n) e0 h+ g# H+ Hthere are some memory breakpoints set (dr0 to dr3) simply by reading their2 g! \5 y. r" I$ {. D
value (in ring0 only). Values can be manipulated and or changed as well
+ Z1 m4 t6 s7 u(clearing BPMs for instance)/ H9 I9 I. y8 P4 |! _/ V. j+ C
* H  D3 |% k1 E# j. I( ?# X2 Z
__________________________________________________________________________
' X8 b% P7 |& y9 Q4 f% m/ J, E7 R8 r
Method 11% X) z' m) i2 f5 [. x
=========
$ R( z- U2 w2 ~9 ]6 ~  ~$ A  W! D& `+ e! o- M' u% M+ ]
This method is most known as 'MeltICE' because it has been freely distributed5 m% E& p3 L8 l4 F, k- G
via www.winfiles.com. However it was first used by NuMega people to allow
; L6 M& a& v& Q# x) f% L. KSymbol Loader to check if SoftICE was active or not (the code is located, P# `; {: |0 V2 e& a4 U
inside nmtrans.dll).7 k4 `; @& d9 G  F4 @! T  S! T8 Y" H
) ]( M3 N& g! f6 d; {) G
The way it works is very simple:
2 ^6 z: F3 f- T" e# SIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for8 H, a6 d: U1 ?, d
WinNT) with the CreateFileA API.
" g( R: h1 K9 w8 K1 ]2 B5 _, e' v
Here is a sample (checking for 'SICE'):. Y# B; I0 y0 {0 F

. q; E3 V8 `0 R1 K/ jBOOL IsSoftIce95Loaded()
- f3 J1 ^1 y  ]! w" r{: Z* |% b3 @. p+ p5 c/ \& X
   HANDLE hFile;  
; F( n6 ^% T1 b9 S   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,- f' X' F) a7 x8 m" B* m
                      FILE_SHARE_READ | FILE_SHARE_WRITE,* G6 \- f  b( P3 q3 d. i
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
7 [( e4 Z4 q! a5 u   if( hFile != INVALID_HANDLE_VALUE )
! N& X- W1 V) i1 _' Y   {
7 L1 Q: b* @0 S- h      CloseHandle(hFile);
% ^' A6 H" B; u4 ^      return TRUE;' R/ X% s* X# [4 b( O, ~) _( }
   }9 n5 p, K! H( p8 \, _
   return FALSE;
: P7 v2 C& G( p" R; k: P& x6 C}
7 M( R3 \8 B7 m; @$ y$ {9 n
- y" _1 L! Z; B& j+ l7 PAlthough this trick calls the CreateFileA function, don't even expect to be
$ I/ B  Q! d8 m" {7 t0 y+ [5 Oable to intercept it by installing a IFS hook: it will not work, no way!
+ b$ M5 h( u; y! {, OIn fact, after the call to CreateFileA it will get through VWIN32 0x001F
% E3 x$ e% W4 w' ?4 l3 D/ L! S4 A( m6 mservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
/ I0 I5 ~3 r9 |8 W9 qand then browse the DDB list until it find the VxD and its DDB_Control_Proc# o4 N- J4 |' H/ x7 K
field.6 R0 _* r* z1 o+ ^9 b4 K
In fact, its purpose is not to load/unload VxDs but only to send a ; |' J" L2 P% \9 d8 x
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)" [- m9 }0 x0 k" X* g4 W
to the VxD Control_Dispatch proc (how the hell a shareware soft could try
8 j* K& J4 \7 m3 g  y8 Gto load/unload a non-dynamically loadable driver such as SoftICE ;-).  M5 L0 @( |+ J
If the VxD is loaded, it will always clear eax and the Carry flag to allow! V7 D+ Y" E: l1 m
its handle to be opened and then, will be detected.
$ ^4 S9 O4 ^- T6 |You can check that simply by hooking Winice.exe control proc entry point
8 s# i' i; Z4 v1 e, n% Jwhile running MeltICE.
5 E1 a" M/ v  b2 g9 N$ U
3 i' {! N! W+ W1 {4 @5 G# q
( A( n1 j% W' {- e! S! R  00401067:  push      00402025    ; \\.\SICE$ e5 E. a' F+ [3 O& d5 s! q& k% Z
  0040106C:  call      CreateFileA
2 ]& t7 J, ~' W. T5 l" J9 U( L$ d& T  00401071:  cmp       eax,-001
) v% x" j) R1 O8 u5 V: m  00401074:  je        004010910 }; D/ M+ A# u

& K+ {. H5 X6 v, F  A+ Q7 ~$ k7 h- `5 _$ {& H: Y
There could be hundreds of BPX you could use to detect this trick.
  t3 ]/ n. O/ x-The most classical one is:" D2 T. O1 f  m0 e# Q: F. L
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||) ]3 [4 C9 ?: {/ [
    *(esp-&gt;4+4)=='NTIC'
& ?* b1 p& @/ I4 u6 e  X* y) V' V8 M' o8 w& F% \/ P
-The most exotic ones (could be very slooooow :-(
$ K' F& z1 F1 v- z! o" t. H   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
! `2 V: y& Y6 j     ;will break 3 times :-(
' {9 z" h3 G, N) I+ O5 C0 e; F) S! ~% [  {3 H; f
-or (a bit) faster: 7 v, |5 t9 i. a5 o/ K. T
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')( y& ~& W" ~! n
9 W0 _+ u  M5 T
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  1 o) |$ r( w8 X* `* P9 G3 b& n
     ;will break 3 times :-(* t$ e; @, F+ K1 @$ E" `

3 h4 {0 ^  o+ P, K+ W3 @, l2 V. }-Much faster:, L7 o/ U/ D4 D- X4 q2 V7 j# a
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'% t  H" {+ I; e  L, o; K/ L/ f
$ ~  }& h' }! J) v8 W. e+ Y( {
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen6 \/ I7 a4 U! U
function to do the same job:
5 N- C0 Y4 G% y0 n, c" |, y- _6 S/ T( X; B- h
   push    00                        ; OF_READ( T, d3 P# b' o$ Q. U
   mov     eax,[00656634]            ; '\\.\SICE',0
- B( z: G9 m# G2 B* U3 B   push    eax
% a: @% U0 @6 I! A: ]+ {   call    KERNEL32!_lopen
9 h; ]% s( `5 P$ z$ {) Z0 K   inc     eax, b$ |9 ~# f/ y% Q
   jnz     00650589                  ; detected% \3 f9 X3 k4 w$ E0 }) v% _4 T
   push    00                        ; OF_READ' j, i, R1 q/ {) u8 p* b+ q! H
   mov     eax,[00656638]            ; '\\.\SICE'
1 E$ ]+ {6 m9 u4 x/ `) q  P   push    eax% m4 `6 R$ D% v
   call    KERNEL32!_lopen1 |' q. o: \! C% U
   inc     eax
" t1 J) {  P1 b0 Z# Z   jz      006505ae                  ; not detected1 R: I+ B+ P$ I' M0 [2 o- U0 T* U4 v

/ f9 A2 y8 x( Z# \. n' c' Z& H
" b; c% Y0 {: l' z0 A) S4 [$ z/ n; q. D__________________________________________________________________________
  j* d0 v9 q; ~* ?
' J  I! A" g; \; ]+ SMethod 12& R1 X3 K4 F/ y$ T8 ~
=========: l" l0 n- L# I3 V" |+ Q! f
+ P( u1 i- c# z2 _( P
This trick is similar to int41h/4fh Debugger installation check (code 05
& ~( S: g% r7 L4 P. n&amp; 06) but very limited because it's only available for Win95/98 (not NT)
: P5 c2 U$ H$ p4 q1 v# K$ qas it uses the VxDCall backdoor. This detection was found in Bleem Demo.
$ @1 K( e8 D4 C3 N# X( P
. Z; I3 r5 m8 P/ y4 Z   push  0000004fh         ; function 4fh
1 n8 x; M0 G* [* @0 ?3 ]   push  002a002ah         ; high word specifies which VxD (VWIN32)) y% D8 a+ T6 c
                           ; low word specifies which service4 Z  a4 b, H& D: m6 r
                             (VWIN32_Int41Dispatch)
% T' N7 D' x# z8 \   call  Kernel32!ORD_001  ; VxdCall
. d: K/ X6 q5 s   cmp   ax, 0f386h        ; magic number returned by system debuggers3 p. D7 Z# A( e6 J; r% j
   jz    SoftICE_detected
# d" |, O0 x5 ~* Q- K! H
% c7 \; A* w& c1 J5 \" zHere again, several ways to detect it:
+ _' o  w* Z; U$ n& u3 w* {( L
+ D9 z8 l! I7 r: A    BPINT 41 if ax==4f( A9 y, R8 h2 o1 M. n+ a* }

$ ]4 |) G) ?9 S3 B( C; P+ v. |5 u    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one. P# L' B. q) A6 f& X

4 {$ C9 F, z, {6 r+ X. P    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
$ {$ l! c; t2 z& {, D6 }0 G# x% p3 I7 m4 d, d
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!) Y2 b! Q, @" s( U) m! ~
5 ?2 }! \* D1 |  G8 `
__________________________________________________________________________- V4 x% E; W6 d# [
0 @& e) G1 \( s4 d( r* t) Z
Method 13
2 `+ F6 \$ K9 o0 Z2 n. d=========
9 @6 i1 c' @6 G2 @7 `6 m2 Z9 D3 `) n8 I" S+ o
Not a real method of detection, but a good way to know if SoftICE is
4 I$ E& R4 ?' ?. B: e3 pinstalled on a computer and to locate its installation directory.. ]4 n+ X# S; p" l
It is used by few softs which access the following registry keys (usually #2) :3 m- }8 o. G6 _; a
; e+ _4 k8 a  f2 c+ U7 P3 y
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion& q' [+ \: u3 K7 f9 E
\Uninstall\SoftICE
0 l) ^, [, H; {* q6 c3 ^-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE  K. ^+ O1 O' ~6 u, f( Q: q* a4 N
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
0 ^2 o  [- \: E) r. }+ Z\App Paths\Loader32.Exe
0 B; v; Z5 W; ]3 d4 F$ H- P, \7 H: R# g6 L* p) u

& o) ]5 C: I4 q  nNote that some nasty apps could then erase all files from SoftICE directory9 `" i/ `5 k) q3 o" v
(I faced that once :-(
' X2 w- \& q% {! f5 Y0 J* m+ R& Q: K7 w5 ~9 Y9 ?
Useful breakpoint to detect it:; V& H1 V9 S5 \* ?5 O! D; v6 {7 l1 y

8 I: E9 _3 A+ O+ |4 t( }     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
# O% E' @. |3 ]( N/ [0 Z5 Y% W) |+ e) x
__________________________________________________________________________
/ Z  r! f/ _0 M) c( V* {; p8 W2 \

9 D2 @* s* X5 K; h! Z! G& q$ s& ?Method 14
* G$ V+ Y/ W/ k$ J1 f1 {1 D=========. @, z3 H  D+ A# x4 |" P0 A
1 B. z9 J) p5 _- w$ |
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
8 K# u: D6 D- u& o3 m5 V8 F# G' wis to determines whether a debugger is running on your system (ring0 only).
& W3 c8 Z9 M$ b2 c/ Z, C
% h, R( x) d- w- H6 Q! O   VMMCall Test_Debug_Installed
6 ]0 X% ]- [1 r) o7 F8 z# F   je      not_installed
3 g3 B- z9 u& [8 d7 {  @: _7 A: r) M( ~
This service just checks a flag.
' a( M: O! v) U</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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