About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
0 Y; ~; m& {) Q1 b0 E! ]<TBODY>
, X; v+ ?  z0 C. H9 w7 S9 X<TR>3 T; C7 u( s8 W3 h+ A% p# j
<TD><PRE>Method 01
8 Z9 s9 M6 \1 N2 Z, ?=========
' o) ]+ N6 r$ w& _% f0 G  N. p
  A1 d$ w5 A% ~4 W( gThis method of detection of SoftICE (as well as the following one) is
4 S! k1 T" e- \3 i9 m( Wused by the majority of packers/encryptors found on Internet.) _5 b/ M( P  b9 _) }
It seeks the signature of BoundsChecker in SoftICE
$ D% W) b6 ^# S4 c9 R3 p
* h: X0 r3 m/ s7 S  P) I    mov     ebp, 04243484Bh        ; 'BCHK'% n/ |. b% f4 x' M$ X& j  W
    mov     ax, 04h2 |, K1 \3 T# b: F: m2 {! S
    int     3      
: R% `; e& ?4 U% j8 M( }/ p8 F8 F    cmp     al,4: P" g% |% Q& L3 W
    jnz     SoftICE_Detected
3 R0 `! `! k, x' V) s
9 V$ b2 Q0 C6 S0 u: s- a___________________________________________________________________________
+ v# u* j" g9 t1 P' _+ e8 B* s7 }) i( E1 ^% l. s7 F0 u
Method 02
- `" o' y2 s" g# o=========
- Y, t8 |9 s+ h1 M+ A- M( b+ _
. l/ W9 c, r+ GStill a method very much used (perhaps the most frequent one).  It is used
0 A. \7 j6 ~$ |3 u3 ^to get SoftICE 'Back Door commands' which gives infos on Breakpoints,
2 G. U. `- q5 N+ L8 qor execute SoftICE commands...5 j# T# @$ }) g# x) v8 ?
It is also used to crash SoftICE and to force it to execute any commands/ o! R7 A3 P" q
(HBOOT...) :-((  % ]5 v& m7 Q& T' E2 K3 C5 ~

. j8 c" E* {1 ^. K/ l/ XHere is a quick description:8 K. \" r+ F5 Q- z
-AX = 0910h   (Display string in SIce windows)* W: q) Z  o) [4 X
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
2 o+ y) @1 `* r: a/ z5 T/ G-AX = 0912h   (Get breakpoint infos)
& M0 `/ _; [, C) ~6 I" h/ J% w-AX = 0913h   (Set Sice breakpoints)
  T( V; p7 k5 ^! b( @-AX = 0914h   (Remove SIce breakoints)
( N6 Y) _  b- Y* A" o8 }* B+ l% J0 P4 E4 R6 l- J) s0 E' E
Each time you'll meet this trick, you'll see:
; ]4 l+ g) I/ U6 `% ]-SI = 4647h/ q9 J- e4 a- I2 Q
-DI = 4A4Dh
) ?! w& l3 _& z% {$ d6 `2 pWhich are the 'magic values' used by SoftIce.
+ L, @" z( E/ ?5 ~8 {# K5 \For more informations, see "Ralf Brown Interrupt list" chapter int 03h.
, s, I% F& q* q) b1 S- Z- b1 M; T8 w, V; A( w) P
Here is one example from the file "Haspinst.exe" which is the dongle HASP. M/ q( a  u0 s) C* {
Envelope utility use to protect DOS applications:
: ~+ X6 V8 [5 U9 \5 b1 j2 H. ^3 q

- `7 d7 D0 X) _. O1 w4C19:0095   MOV    AX,0911  ; execute command.
  u7 s9 N9 u3 n4 \4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).( }% ^( n7 y- K$ R
4C19:009A   MOV    SI,4647  ; 1st magic value.4 j0 N* w) z4 h7 [
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
0 Q4 r7 m! W- l1 [- \* B7 H4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)# `4 w$ \2 w0 Y( |1 P& v  z
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute/ E: g3 v" G3 b, |1 B
4C19:00A4   INC    CX
5 l3 k( w7 k2 y" A3 }* H4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute) G. v- f8 M7 E0 \' `' S
4C19:00A8   JB     0095     ; 6 different commands." t( P* H# t8 H' I5 N
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
" v, W& L9 d* G- Q* v6 T4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)" M3 Z% s( G9 H8 |! C; n

: z2 v+ @/ c! G0 r  jThe program will execute 6 different SIce commands located at ds:dx, which
* V- X- t* x* k8 \  T! W4 oare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
$ w* _" @; g9 q' G3 D0 [0 [* G3 T- z$ X& ?
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
' D7 u3 a! @& u7 w0 p2 [___________________________________________________________________________: s# ^+ T' j. ], S
5 ]1 P2 G) c: @1 N/ H7 }
( k& F1 Q" o! r% S! ]
Method 03
: k) p% i/ D' }7 v5 Y0 R( y=========
3 O, W* T  C1 }! M- ~; D* s' h" s, U
) u. s' _) q0 B1 }# D, E4 q, x3 Q) xLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h+ R1 G: U; W! K) l
(API Get entry point)" x3 l8 R$ A6 ?% Q: _
        1 l( _/ f; _" U+ {6 w# D, W! f) |; B  r
6 X5 H+ _) I* Y. t
    xor     di,di. Y" T% }2 e) T1 h
    mov     es,di- N3 W* r' p( S$ ~6 N3 B: n
    mov     ax, 1684h       7 }' D1 r2 r' L- X+ `6 l" j# [
    mov     bx, 0202h       ; VxD ID of winice
  R- p/ l  ]' G4 C( x* \+ z    int     2Fh
7 d; v# k; ?3 `+ y) ?0 O6 m    mov     ax, es          ; ES:DI -&gt; VxD API entry point
9 P+ E5 D5 N) y0 Y% P& F    add     ax, di0 L3 ~; z& ~# c0 o# Q% ]
    test    ax,ax, I2 q2 X3 d/ }1 J+ r
    jnz     SoftICE_Detected
6 o4 t4 P4 Z$ w3 K8 G) ^& s( |6 W3 g9 Y1 G# s
___________________________________________________________________________+ q" a- s- t% A: b) @, }

' q9 \8 M4 L! m# YMethod 04
3 J) {! [9 s) z7 T4 t  w" D3 |=========1 D$ r0 T+ E/ N# z- ^! M  r  ~4 _3 j

; l& n# D0 T% a* ~0 W+ ^Method identical to the preceding one except that it seeks the ID of SoftICE
( Z& \2 V. C6 p8 p! o# }GFX VxD.- _7 l$ ~* Z, k: C: s% e8 B
' U6 I+ @3 C2 W/ q' L
    xor     di,di
) C4 R: I2 r2 k! F5 K    mov     es,di
" q' `+ a& g4 ~; [    mov     ax, 1684h       & n% ~: g& b% x& V3 N
    mov     bx, 7a5Fh       ; VxD ID of SIWVID
! H1 [3 t+ ]" K  j9 w5 I; ]    int     2fh9 [: b6 y6 Q" z9 Y( g
    mov     ax, es          ; ES:DI -&gt; VxD API entry point" e1 I: D# _2 C; F
    add     ax, di8 c  S* g9 {- _- K9 H2 k' q4 h
    test    ax,ax
) a  [- J9 p4 L& n7 V2 l: {( `# @    jnz     SoftICE_Detected
  V4 s, s9 C, b% _5 F+ y' m% ^
4 {" v; }: A7 _9 b. U: F% u. G__________________________________________________________________________- t5 w4 k+ w+ T
. x; m1 `* |- D4 T: K* J- Y* V
# z& p3 c+ `0 K! N
Method 056 f2 }& D$ B7 ?* O) C) V
=========# ~' l& b" L; J& l; Q
% b; h$ T6 c6 \8 s: A5 e
Method seeking the 'magic number' 0F386h returned (in ax) by all system% U& [: C1 _% V. e3 K- I
debugger. It calls the int 41h, function 4Fh.& s( k4 s" _  T
There are several alternatives.  
4 l; i( B5 Y: k3 z5 r4 `
  B9 h) h) j' g& l! W, `The following one is the simplest:; G1 A9 r0 e* D% `; J( D' _
6 ~: L4 b: m5 F/ r. C. G. G$ M+ O
    mov     ax,4fh
- b! |( O- ?  ?* S* }5 E& g    int     41h
1 _+ X4 Y3 d7 J    cmp     ax, 0F386* f' G$ X3 R/ K. K" e
    jz      SoftICE_detected
# m3 t  N1 g$ g5 F! t, s* Q9 z8 o9 d  Y4 @, h1 i& [- i1 B' V

7 Q% o7 J) j: r8 q- E) U9 SNext method as well as the following one are 2 examples from Stone's
6 K0 A: R$ M" Q7 s7 J% }7 I; U$ M"stn-wid.zip" (www.cracking.net):
% D$ z5 m: i9 {5 `
- C5 i8 {( [' ]3 I8 F    mov     bx, cs" U0 v# u6 t& Z" j
    lea     dx, int41handler2
8 w, W) |8 b0 D. d: M* b% R: P% K- f    xchg    dx, es:[41h*4]: h; y: f* w2 o2 }+ m
    xchg    bx, es:[41h*4+2]* Y: n9 X: {. P. n5 ~- A
    mov     ax,4fh+ K: X" P0 v0 F! Q$ ?+ D
    int     41h1 H$ Y1 M2 `8 E* q
    xchg    dx, es:[41h*4]7 R4 u6 j0 ~1 |% S: F( e' [3 u# w* s# ~
    xchg    bx, es:[41h*4+2]+ u6 [* ~# H; {* ?7 t5 Y
    cmp     ax, 0f386h1 C8 ^6 C+ K; A: {: P& [+ @
    jz      SoftICE_detected& L$ V. F; X' l5 j
( A( V3 s% O8 D( F/ x  b
int41handler2 PROC  H; B- J) Y4 R2 y
    iret
* Z% J9 V+ A4 w. B: ]5 mint41handler2 ENDP
& D8 y; x! t6 v# `% }! G" k3 i
5 ]* d5 n# m! a; ~1 Q/ m6 M. N2 F3 `: V; ?
_________________________________________________________________________
/ F1 ]4 R/ p4 T" {! ]# T
# }; N% h/ h9 V/ T+ t4 P, m- U
) v( x2 O! ^4 m# s9 BMethod 06: u) v" [4 x9 W4 r
=========4 V2 r5 |' ?. f/ m5 E6 L: h
6 `9 S: v4 `7 n8 H- f
& H- d2 A, X* o+ }
2nd method similar to the preceding one but more difficult to detect:
; ]. ?" [" y" T! Y3 l8 h6 m
5 K  I- @6 v8 ]$ |5 L
2 L  L3 S: l7 [8 q) \. O& s2 U# b0 ?int41handler PROC
/ I6 l! v- B8 O    mov     cl,al
$ K3 w9 I0 A* d, v- F( X- |* {    iret
0 q5 ~% Q& W- S# h" ]$ k$ A: v$ Uint41handler ENDP
6 X! H" a2 `* g0 p0 e  [- \3 x+ l" A. s' S$ @8 y2 @  g% H% C

. v) K7 E  S( L    xor     ax,ax' X# D0 y' x. \  O
    mov     es,ax
8 V6 x5 k; t8 z+ d    mov     bx, cs
0 w1 B4 s8 H* u. l    lea     dx, int41handler
& I6 T% g* |( [    xchg    dx, es:[41h*4], y  d2 `( H) j4 D3 v# l
    xchg    bx, es:[41h*4+2]
# H: Z- ?* t+ h+ j' T    in      al, 40h
- V+ D% k% b9 J. l" e% `$ J    xor     cx,cx
! S7 g3 v1 t7 S/ H& W    int     41h, o& u6 g0 K% G, H, z- O
    xchg    dx, es:[41h*4]
( g/ M0 V* Q$ C# ^  H' [0 i0 R    xchg    bx, es:[41h*4+2]
. \) _# X8 T2 ~& Q- c7 _    cmp     cl,al+ r9 H7 h! l/ M( R/ s) @: V4 r+ q+ u
    jnz     SoftICE_detected
) E4 U+ A5 F% @% F8 s) U. }* n2 I, A
_________________________________________________________________________6 Q/ d( s- u  C2 P$ h; _; Q
( ]; }- V0 q% l4 |- {
Method 07
9 Q0 o! P4 ]7 M=========
& w! J2 I, e; U! [( D/ T. I
0 S5 H% J; H2 D+ X  b2 M& eMethod of detection of the WinICE handler in the int68h (V86)6 {( l7 J- X/ u3 h: _) G/ s$ ?
7 O7 V7 w8 W  l* _2 L6 Y; B, T
    mov     ah,43h0 h( V6 |/ B5 m8 z+ d
    int     68h
" c2 l/ H1 }, h( \- }* m. C    cmp     ax,0F386h
8 Q% q6 M3 U* W    jz      SoftICE_Detected" j# W( i2 t/ n: D

% j* g( ~. i1 g' K$ x
8 i8 m. r+ U6 o# l1 P  c=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
$ W; e" {$ n; @# C; Z: D4 M  i   app like this:
9 @# n' `% A4 d- V2 L! ]" w7 R8 q# t. k
   BPX exec_int if ax==68
7 ?* E$ @0 K8 d, ]; F5 I   (function called is located at byte ptr [ebp+1Dh] and client eip is
/ v/ ~: u1 p8 Y' ]! \; J; i   located at [ebp+48h] for 32Bit apps)( }8 c; k, [: s' s2 o5 B2 B! {( M
__________________________________________________________________________$ z7 r! R* D+ h! v2 t

6 m# Y9 w6 E% v% e. z( K1 ~; L; m5 x# i. t+ M
Method 08
* {7 p9 x  n; b; s" o- A+ |=========* X' B5 Z: w  c: s; x" M1 W" K
8 l; m) _3 c2 G1 ~9 {
It is not a method of detection of SoftICE but a possibility to crash the
  J3 t! h6 `) |' \0 usystem by intercepting int 01h and int 03h and redirecting them to another
2 z1 ?0 K" x7 c2 T) L/ t5 Sroutine.- ]! n! T3 F- r
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points( [$ |/ F# O7 q4 _4 s
to the new routine to execute (hangs computer...)
7 b' F$ Q$ b+ p! D) G# U, g1 F" D  P+ d+ s2 v  e3 E
    mov     ah, 25h3 b0 R$ s$ }5 k
    mov     al, Int_Number (01h or 03h)
1 c4 A7 v0 g; k$ i9 m' w: Y    mov     dx, offset New_Int_Routine) s) x; `1 o: ^, q8 ~; U6 \/ L  l
    int     21h  ?6 }: X& i2 t; }: U% A, Y+ L' f0 Q

: y. s/ A9 G8 p6 f3 D4 p__________________________________________________________________________- [  o  H' c+ a8 `. u* v) `

) a% F) p5 d$ M( f, |  s6 nMethod 09/ G: b8 C* Q4 b8 q
=========! P( d/ `; s7 m2 ]5 x0 Q$ E5 D
% b5 l- n' c/ K) n0 S: O( P
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
! G; x: {6 l& S! v% y1 D7 f5 p! Gperformed in ring0 (VxD or a ring3 app using the VxdCall).
: I; d3 M/ ?$ r7 y+ AThe Get_DDB service is used to determine whether or not a VxD is installed
  b8 Q4 @* o- z+ ~3 ]& n/ c+ Q) ifor the specified device and returns a Device Description Block (in ecx) for0 u* f! I2 t6 V1 e2 B0 M
that device if it is installed.2 h( X" O% F2 l; l8 j
2 }( L4 x4 e! y: f6 f- |" d
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID& O! M" D* y' y8 ]6 ~0 h1 m9 t, N
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
& a) ]7 |3 c5 T. V5 M) b   VMMCall Get_DDB$ `3 T7 s, n3 B/ V- t( `
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
7 j. P# B4 O! _- {
3 K/ r! K- i2 N- ?3 E( g% T" r% cNote as well that you can easily detect this method with SoftICE:: t' r  @: I$ O
   bpx Get_DDB if ax==0202 || ax==7a5fh$ B) Y2 j, R5 H* x4 k; e: j* ?
5 K: G0 b5 P  ^. b  C5 J" D+ R/ o  ?
__________________________________________________________________________
3 H7 x* w# I+ X/ n2 \2 y" L3 O3 M' H* a
Method 10& l% V/ t' s; v2 p! U0 A6 B
=========
; j' q5 [3 i, l6 J) {! @, l! c! w, [$ v2 r! A
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
0 D/ a) t0 G- B% n+ [  SoftICE while the option is enable!!
, z+ w" a( f% T. Z2 W5 B; q1 Q' C1 O6 d: Y2 k. {
This trick is very efficient:1 W/ N5 M, [' ?' b/ w  {3 [
by checking the Debug Registers, you can detect if SoftICE is loaded
8 C( B. K; r( q9 {(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
: r/ ]; [$ w& Rthere are some memory breakpoints set (dr0 to dr3) simply by reading their
. Q5 g, o7 U) ~: \" x, U* a0 g3 [value (in ring0 only). Values can be manipulated and or changed as well
; S% s5 P/ u* O(clearing BPMs for instance)
" ~8 g/ A+ M1 Q# q0 i8 e- g7 \8 Y. A. `, }3 d$ k5 y5 Y
__________________________________________________________________________2 g* A& \- b7 P! E1 ?0 s) ?7 t' P

3 H6 j4 W; t& B6 n, A& bMethod 11
; i8 j$ J; d8 Q: Z=========& |6 g4 R  y& P5 U7 M
& ~/ K, ~! A* Y8 d) a5 @9 g
This method is most known as 'MeltICE' because it has been freely distributed
& M9 o. `% b4 xvia www.winfiles.com. However it was first used by NuMega people to allow
2 J2 ~+ b4 n1 V3 a' Y, r  ~& P# xSymbol Loader to check if SoftICE was active or not (the code is located* g; g  t9 `4 f) P
inside nmtrans.dll).
8 |7 B. ?8 o' k7 s8 r, I1 T: o, R
, a+ N- `- u# V2 C& [The way it works is very simple:- ?9 b- U' y# d& w: V% P
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for7 l3 s. R( a9 i$ l* v2 E$ F
WinNT) with the CreateFileA API., `$ t0 g. U+ R; K% H4 n' Z" d% f

6 C6 j# Z' p) {; O# dHere is a sample (checking for 'SICE'):* _) A( w; F4 j; P

! I/ n5 ^) @/ ]' wBOOL IsSoftIce95Loaded()( s" d. t+ [  ]! f- a2 S
{
2 d" S. W, z0 P0 L& d' x   HANDLE hFile;  
- }0 F$ ~" G; o" r   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
: C' j& J  g1 k5 D2 R+ H1 f- S                      FILE_SHARE_READ | FILE_SHARE_WRITE,5 c5 M- W- r( k- p! J
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
0 {2 C; V  j8 P( r) s/ g' N! c   if( hFile != INVALID_HANDLE_VALUE )
4 N" ]( L3 M5 w   {- q: ~! X  W+ [  e" n3 K+ A# v
      CloseHandle(hFile);: I4 t: X% n) g1 n% P1 V& B
      return TRUE;
9 h4 k' t! T7 C   }' }/ Y# i; L' Q; h+ s
   return FALSE;0 m  {6 C. r2 c- X
}
3 F, }" M1 N" g
$ C/ n# W" \; x9 ZAlthough this trick calls the CreateFileA function, don't even expect to be
' J) m- d3 S5 _8 Aable to intercept it by installing a IFS hook: it will not work, no way!
/ {: W! E# d4 s- X0 }; W8 VIn fact, after the call to CreateFileA it will get through VWIN32 0x001F
% n# R) D: g9 l/ P0 k$ {1 Wservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
0 N* E5 T2 b: z: {and then browse the DDB list until it find the VxD and its DDB_Control_Proc$ T4 l7 h4 _7 C7 K2 g
field.
1 _2 s% h' m$ a3 m- m( eIn fact, its purpose is not to load/unload VxDs but only to send a
, y; [$ N0 T, s8 QW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)" H# g, }" y; S. ?9 t- {
to the VxD Control_Dispatch proc (how the hell a shareware soft could try' y$ F. a1 P% M- @2 A0 ^
to load/unload a non-dynamically loadable driver such as SoftICE ;-).: G& K3 J3 |+ p7 ^9 Z" ~, g
If the VxD is loaded, it will always clear eax and the Carry flag to allow
# L) P8 t" [# J1 |its handle to be opened and then, will be detected.
/ p3 g, P" q: P4 ^" N9 OYou can check that simply by hooking Winice.exe control proc entry point
( e0 G2 p. B' h+ V  Pwhile running MeltICE.
7 {; d# L/ H! e" q# }3 w3 x% p: ~0 \* b$ Z& D2 u; O
' B; n0 k3 Y9 N$ f
  00401067:  push      00402025    ; \\.\SICE
% l! C4 X8 O% D  0040106C:  call      CreateFileA
4 z" Y( {" l0 ^8 b5 `$ x% r( B  00401071:  cmp       eax,-001* L( I0 a) Y( G& n/ w4 T
  00401074:  je        00401091, _% k, }' a" u1 N7 s

4 W$ }2 \& r+ l: m2 w4 |/ W- o1 X+ J
& q4 N- V7 u9 d7 \( p& DThere could be hundreds of BPX you could use to detect this trick.
+ G7 M& q; n0 m8 Z4 p2 P# Y4 y-The most classical one is:. Q. s5 |: g% C! `3 I/ G
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
7 O( \. J% X2 l8 e, G    *(esp-&gt;4+4)=='NTIC'
; v5 f0 x1 \4 R2 V* e1 Q- W" T8 b4 m" A! z. {: s4 N8 }% V
-The most exotic ones (could be very slooooow :-(" G  J7 X6 t9 A/ O7 P1 K( ?
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
0 w# p8 q) [( }/ t1 l- G9 `     ;will break 3 times :-(
9 ~* m, u( z- A# ?/ h  o. f# l$ I' q7 Z5 j: X! p/ Y
-or (a bit) faster: ! G0 S4 A9 r' S' x4 ]7 B3 }/ x" @$ v
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')+ @( e7 A3 P0 _0 ]2 S

3 O' Z/ |' n5 z; @$ [, b( ]   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
5 C& r3 s, B3 W# }% i( F  x     ;will break 3 times :-(; q; C! H) a' I
/ E5 X* i* v7 j) ?$ f( C4 I3 ^- O( ^; ?
-Much faster:
6 N/ a: t7 y8 h4 n% `+ o   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
% Q! P! w' h: x8 s6 J- v' P! w" I, n  v5 l4 Q# G9 @: c
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen
8 R. r5 V/ X8 c, ?, v; Dfunction to do the same job:* C8 M( k5 i: _3 J2 g- N; s
) f# ~( `- u% ~; j( i4 C
   push    00                        ; OF_READ
' E" _; [  c4 g# `& W   mov     eax,[00656634]            ; '\\.\SICE',0
6 t1 y5 W/ L( h+ w2 }   push    eax
1 v/ L/ L3 I! \, b: J. B   call    KERNEL32!_lopen; R' C& I7 h6 M0 s- I
   inc     eax
9 w5 t0 l1 ?( e7 ]( {   jnz     00650589                  ; detected+ B. l& G  G7 V- j* W
   push    00                        ; OF_READ& v+ Q7 N/ H$ {4 Y
   mov     eax,[00656638]            ; '\\.\SICE'
" w" v$ f. z9 B   push    eax1 d- I6 b6 L0 \* Q) ^  w0 c
   call    KERNEL32!_lopen1 C6 x7 ^) _5 @3 I* O$ S
   inc     eax# o; J1 V( H: Y. \# X- V1 {
   jz      006505ae                  ; not detected
: }+ ^, V" ?$ i( D& V) ~1 ?/ H; x  ?' L  W- o
0 R2 `) @4 m6 a+ e
__________________________________________________________________________
& P& r4 `. M9 ^# J0 H# F  K- f# h7 V9 b8 v: s( Q% r
Method 12
' Q$ V7 a' p( v; u, z  e3 I/ E=========+ R6 s9 o1 _9 H2 o7 Y* g) d( p
% }/ G0 T  }0 o4 Q% a- _
This trick is similar to int41h/4fh Debugger installation check (code 052 E% d6 y- Q+ r0 A0 {
&amp; 06) but very limited because it's only available for Win95/98 (not NT)
4 {+ ^. e) w# u0 ^" zas it uses the VxDCall backdoor. This detection was found in Bleem Demo.
7 e& F5 k# L2 l& r1 d: [+ _* J! `/ e3 N
   push  0000004fh         ; function 4fh
* k5 N- k' }  A" M- [! a) i( z   push  002a002ah         ; high word specifies which VxD (VWIN32)8 ^7 x  X# ]1 a, T
                           ; low word specifies which service
% }; U( P( c- O" x5 ~0 y  j                             (VWIN32_Int41Dispatch)
$ `" r, s. d, Y; L2 O   call  Kernel32!ORD_001  ; VxdCall
- H: B* L6 l5 u2 P( x  t4 F   cmp   ax, 0f386h        ; magic number returned by system debuggers
/ l: ?; F# V/ f& H$ ~7 }& p0 j4 m   jz    SoftICE_detected
& v' E/ ]' E& z3 k3 m3 o
$ j* b( }2 C7 r( M/ hHere again, several ways to detect it:+ j" {9 t! c. @
- M# m( U5 x5 Q; [7 b% Z- w. e
    BPINT 41 if ax==4f
3 v% R/ T  ]9 K, s* x
! J: F7 {/ C  F; w8 A    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one- B3 t2 F$ R1 z$ ~' F, ^

8 q' E. }3 {3 n+ R/ w; I9 n- X    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A0 R: w- n# N# ]

6 M% f# r) t* E    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
; f! {  z" j6 ~! \! A  U5 L
) S. }# J. j9 T__________________________________________________________________________: f- B4 {$ }7 c/ p. x  r4 a* \/ c" j

( z; q0 Y/ Y9 [2 x2 V9 }8 ^Method 13
) I! |1 J5 ?$ m2 y3 P=========2 ~# S9 @6 u% F' s* \1 m* a0 O, a2 y
! T- U/ n* ^8 o. i8 b
Not a real method of detection, but a good way to know if SoftICE is, m; s3 I0 E3 e/ v
installed on a computer and to locate its installation directory.. o1 c% H* z9 T9 }/ s/ n
It is used by few softs which access the following registry keys (usually #2) :
$ S+ T9 E/ Y# M& P2 y3 z+ E
) a8 L% K4 W4 I1 H' u-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
/ n" ^* v; ~1 c, {7 Y! m0 R\Uninstall\SoftICE
1 {! g6 x/ J. v/ |: d" Q5 ^-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE  x% v  |" m5 o2 `7 M
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion3 E4 f( d. v; ?
\App Paths\Loader32.Exe
$ D8 y) t! B' w% {2 D' `! q4 k* V# w3 H/ N  r( T
% I, y% U+ ]# h2 E4 l4 z3 X
Note that some nasty apps could then erase all files from SoftICE directory
- A/ L2 f* q4 D: S1 v* s: C(I faced that once :-(
1 x2 I0 D) g0 q: H" ^3 O  m
" e* y& q0 Y! N$ y" x. fUseful breakpoint to detect it:% l+ K; J2 h8 U  `3 R
  I' d) [5 e0 J! }& q# n
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE', ]* y5 O* \7 l

5 o. v( b9 Z- v* L! i7 L2 A8 }__________________________________________________________________________; \' B/ ^! N! L9 W: ^5 \) f4 n0 ?

% I0 `: ~* }' d7 D, _! W- v: m, i' L1 }/ I" [
Method 14 6 }5 \5 o( }6 F. L3 C5 ]% O2 ?
=========
2 a* O+ }& j8 `0 V4 {( M" O+ \* Y
  s$ Q: A7 O1 G% j% Z: c1 UA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
' P  L$ I$ E- {is to determines whether a debugger is running on your system (ring0 only).
, ^, N# h( `& ^! D: G
. S& e3 G; l  Y! U   VMMCall Test_Debug_Installed
$ r* _5 p) A3 W! q( t; j4 x* B! t' T   je      not_installed; L: h7 U  e. ^. z: K5 e! o/ s: o

7 H" P% S+ P4 I* Z0 SThis service just checks a flag.
8 ~: R) a9 O7 G: e$ `4 s% v, E. V</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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