About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>; H% y# D& z3 F) y1 C, X  B2 n
<TBODY>
, t6 P  e0 P' p<TR>
" G; h% B. Q, F3 a# i<TD><PRE>Method 01 * w6 S9 I4 _9 y# d. a: z, w
=========
6 ^( V8 e% q7 v
( {$ \0 W- C( f$ S7 bThis method of detection of SoftICE (as well as the following one) is5 Y# p5 v  K& g$ V& ]$ H* f
used by the majority of packers/encryptors found on Internet.  w; T9 E. Y/ N; Z5 k( {9 \& Z
It seeks the signature of BoundsChecker in SoftICE
- x# H  {- t$ p2 q# n& c2 c" \
3 |  B( s0 D2 Q( i9 O2 M    mov     ebp, 04243484Bh        ; 'BCHK'
- U9 `* l" U8 y" i    mov     ax, 04h& p0 y, s; c7 x" s5 Z- ?
    int     3       ! t2 K9 F4 H0 E. o. g
    cmp     al,4
& |3 z, z' V! R: S3 n7 Z    jnz     SoftICE_Detected3 g8 L/ q% S. J' n' x9 q. e

% V* {) O7 `( R& e% y! I* H___________________________________________________________________________
' m; J0 ~: c# T; h/ Q5 K0 t" x, s2 p3 [
Method 025 _; J7 X4 o$ H, o5 v9 |$ S
=========9 N; [9 F+ [& X( T8 Z- P  `
0 D5 d0 a, j$ e$ D
Still a method very much used (perhaps the most frequent one).  It is used) k- A' g4 q' |. d! `
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,- l( q: ~! G) Z: Y2 K* S3 u) d: ^
or execute SoftICE commands...
1 {2 ~$ H: R. |( h$ ^4 a/ hIt is also used to crash SoftICE and to force it to execute any commands
& w& C( T- ]$ E& j7 |(HBOOT...) :-((    \- Z) z5 b: f. N9 S8 m5 ^# M7 l
5 [. i, H5 [: \( o$ a
Here is a quick description:
/ L' [( b' p. H& K# G9 q  e-AX = 0910h   (Display string in SIce windows)
6 q' M/ ?/ q0 l# Q; P8 g-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
# x1 N. h! j; d3 H; g5 r-AX = 0912h   (Get breakpoint infos)  H9 _" R$ E/ {8 \- w8 y( j
-AX = 0913h   (Set Sice breakpoints)
' {3 s1 `1 e5 M# u& t' r% h& z-AX = 0914h   (Remove SIce breakoints)
% k- j! k1 P9 e) X2 u; z3 W/ S) X$ i  V* Z5 V; Q
Each time you'll meet this trick, you'll see:
9 I  w8 q0 B7 Q+ s% J6 F0 w-SI = 4647h
* h+ [( i4 I0 c. T8 u-DI = 4A4Dh" g" q" H7 l  N% k* Y
Which are the 'magic values' used by SoftIce.
- J, w: z! X, A; DFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.% ?/ p/ [* q# K) j
: l  Y% l/ c, ?2 V: q3 j
Here is one example from the file "Haspinst.exe" which is the dongle HASP7 C6 E# ^; p2 s; h; Z. l  U
Envelope utility use to protect DOS applications:! P( z) O- b( L' ?5 ?' X
" Z- |! l6 q* Y- B0 Q5 k5 A$ h$ _
8 ~6 A* ]; h6 {. M+ A
4C19:0095   MOV    AX,0911  ; execute command.
6 }0 ~0 p% h9 P7 o) x- J6 m% ?4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).# m1 K" E1 ]. ]( Q9 X6 m9 H+ G
4C19:009A   MOV    SI,4647  ; 1st magic value.9 q* {- i" z9 ]7 {4 d7 ^
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
9 r/ F: h1 m+ e4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
1 j$ T& q. j! `8 A8 k& ~" t4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
; [) |  Y8 Y! H, {2 X4C19:00A4   INC    CX
) ]0 L1 A# s  O* r+ J$ D+ p6 ~4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute: e/ N) O5 ?0 Y( q3 }
4C19:00A8   JB     0095     ; 6 different commands.1 T( b* |* v8 n9 k
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
. m  `5 }( P# f1 a; s4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
8 ^  m. H. q7 H  J9 a0 d2 g
: i& F* ~2 [& {2 `6 @The program will execute 6 different SIce commands located at ds:dx, which
) m) {) |+ Y! n" \are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.9 P( A4 D$ t7 r6 i( z! K& ~3 ?
2 m5 L, @5 R: n5 E$ M( v" G
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.4 h! V* X; s" i" {0 C: h: U( m
___________________________________________________________________________8 P4 t, E5 u. W* E! ?" p
+ n# m) ?, ^+ f' m! a

  u! x) y- h3 P  rMethod 035 a1 v( y8 Z, i, b8 I: K: v+ \4 y
=========
5 c% d, K2 x# L! K4 c" N3 e) v1 t( \2 |# _8 B) P
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
( _: l, ]) ]2 o(API Get entry point)$ J- f6 C( ]' ]0 D5 ?8 ?
        * d: |  @& w7 H7 d& ?! t. B
4 R0 A8 L4 v5 q. R( J. M$ S! z
    xor     di,di/ k& f( b6 X& x& |% k6 j
    mov     es,di
) D8 {2 x$ l, r/ \    mov     ax, 1684h      
5 c! }% e( J& V4 ~( c& C4 `3 p1 T    mov     bx, 0202h       ; VxD ID of winice
3 f( ^" q) X4 l& e    int     2Fh
" e  t4 C5 A6 p/ G& }1 F! v- b    mov     ax, es          ; ES:DI -&gt; VxD API entry point
& J& u, Q/ |8 a8 b- h) ]. @    add     ax, di
" X2 c0 L  L9 C) G) `    test    ax,ax& p! s; y! n! ]4 Y+ Y) ~, D, h
    jnz     SoftICE_Detected7 u4 [$ d6 s! A, w

5 {5 y+ q! x$ W/ F; a% l1 @9 U___________________________________________________________________________
2 s! ~/ @# d6 \6 t- o# `! e: M% g( @1 Z2 ^9 |
Method 04
, S! [# d  ~8 w- k. @5 a=========( c+ w& ^; L, J; K6 P' K

7 t7 u( U( v% l3 KMethod identical to the preceding one except that it seeks the ID of SoftICE
/ ?5 R' A* Y! b1 a& ~! S* w. w2 Y" OGFX VxD.4 d7 c- P4 f& d% p& ~% i4 g
3 p/ d, `6 e$ K2 n- G7 V  i0 ^! d
    xor     di,di/ `$ Y. W; L* f5 c: @! t
    mov     es,di
( B, e! E1 H' K    mov     ax, 1684h       6 a& M; c' O; l# |8 o
    mov     bx, 7a5Fh       ; VxD ID of SIWVID
% V# |3 m1 T8 f/ n3 M    int     2fh
& D3 m: P" n& X5 K# o( ^    mov     ax, es          ; ES:DI -&gt; VxD API entry point
- d; Q6 i8 F1 _0 r    add     ax, di+ y8 K+ [  C, C# k: t' |* T
    test    ax,ax+ `- D# a8 A5 S5 q
    jnz     SoftICE_Detected! v1 Z  j; t1 V: L
/ \. v) w  e" a0 R3 l1 J
__________________________________________________________________________/ [5 N3 Y/ q0 ?% T- k9 ~; T$ J1 H
1 R8 l' W5 ~( P% [6 m4 t5 O+ e8 ?5 Z

) f! N6 B/ u* @* B) ?) q& JMethod 05" J% T0 _1 @5 `. r# _+ l
=========
8 e& k/ g  z* B
2 D+ Z+ o/ F& LMethod seeking the 'magic number' 0F386h returned (in ax) by all system
1 A5 j3 \1 p/ u1 ?' v) Edebugger. It calls the int 41h, function 4Fh.
. D+ o, Z6 V4 n2 K, bThere are several alternatives.  6 K: D+ A& a( |
+ X' l1 l# Y; W" l) f+ I
The following one is the simplest:
. g$ W- d3 Q9 a2 Y
1 e; M  q6 \3 E$ }4 C  h    mov     ax,4fh2 K. i- d6 `* v3 Q* K7 l
    int     41h
4 S  V# u* i, e    cmp     ax, 0F386+ Q$ J9 T% l  k1 s! C
    jz      SoftICE_detected9 y5 k2 {% D3 c. J0 o

, I) [3 E* |/ S$ F
4 ?8 D# J  ]7 V0 p3 A' T2 R8 nNext method as well as the following one are 2 examples from Stone's
: E' d3 ^5 ]/ e3 g' ^"stn-wid.zip" (www.cracking.net):
& H9 q1 N% e/ ?5 }* q! R
8 }( o7 A2 B' M    mov     bx, cs
  L, g3 F' l$ D& y7 o    lea     dx, int41handler2- J! H7 Y0 a; ]) q
    xchg    dx, es:[41h*4]
" E. l' q+ y9 C9 v    xchg    bx, es:[41h*4+2]& _* T7 n* M$ A9 x7 E3 J* o
    mov     ax,4fh
0 r8 R+ A0 d9 S8 F4 t) G    int     41h5 ^1 e1 o3 @' p) s  L
    xchg    dx, es:[41h*4]  i9 U' h5 z$ d- J
    xchg    bx, es:[41h*4+2]
+ |8 g; z, s* O5 Q5 [$ j: R* s. V    cmp     ax, 0f386h6 y5 o5 m( h% E7 q8 W
    jz      SoftICE_detected: R6 r9 x7 S' n2 a% ?+ L

1 {# c( h  ^8 R* X$ t6 iint41handler2 PROC2 p0 C5 W- c: s8 O) `# o7 K0 z9 `
    iret7 v) U9 k" a" t& \& `) I3 r- M
int41handler2 ENDP
/ M/ v- G2 W% T3 D4 w- Q1 F5 K: W7 k' _
  W! l, M1 I% L3 d
_________________________________________________________________________
  |! A" I% _: i) ~# B1 {1 W' W
0 U/ Q5 z5 f6 O& N
3 L7 l1 U- p/ z$ A& oMethod 06
$ F- g; z9 \: {5 ^=========
& ?. A/ H/ d! Q+ `5 L
# `9 F8 l) b  l$ t6 n& \) S2 s! H8 F
2nd method similar to the preceding one but more difficult to detect:; {. w1 m7 h& g& K

! P2 V4 p* \9 y8 c( V6 i) x+ b  J; d3 E( m: X
int41handler PROC8 D& C$ s! F, U# }: d& G5 G
    mov     cl,al7 T3 [# ?8 B, O$ {" U& C
    iret2 c- {7 `0 N/ l3 ^4 k
int41handler ENDP
3 B5 F" b8 J+ [/ U4 U9 K
9 P% b# S) H# M! Q& }2 ^5 `
1 c( D! m+ \1 F! |/ R    xor     ax,ax) l* J! s5 o+ G9 L: b) [( t
    mov     es,ax0 t8 F2 p+ ]* _
    mov     bx, cs$ B2 E2 T$ K  A' A
    lea     dx, int41handler$ E3 X8 p7 ~% u, ~$ F$ h  ~5 y) I+ f
    xchg    dx, es:[41h*4]
6 {8 S) W* H( r% v! a    xchg    bx, es:[41h*4+2]$ U' G/ o+ {; m6 z. H
    in      al, 40h( ~9 f( L' o( W" A( L1 {8 s
    xor     cx,cx
) ]. q: e: J# ~. b$ k    int     41h
& Y1 x, V/ r0 X. M- J" O/ K" ^7 {. I9 ~    xchg    dx, es:[41h*4]
, d3 }) G. r+ X" a    xchg    bx, es:[41h*4+2]) }0 x7 o- E& D$ t& \
    cmp     cl,al. C8 F' O& A: y
    jnz     SoftICE_detected
9 |; x  I; Y8 @5 @% j; q+ G8 A3 J! u' b2 C" G8 G2 ]1 p& Q
_________________________________________________________________________
  n* O0 ^% q+ C7 H. @* d0 K
" ?6 Z1 w# V! |# a* v6 YMethod 07
0 A$ J* z' A1 x4 N- B( _=========
5 n+ v' T, X# b% z- j/ e
- I4 P7 F# t: `7 `- L; o- C5 VMethod of detection of the WinICE handler in the int68h (V86)7 W+ M8 S& {/ n7 \' Q" x" {
9 M5 ]* `! |$ G- T& N0 g
    mov     ah,43h
7 g2 c' K# C8 h7 H    int     68h- h$ ^4 l" @& B  X
    cmp     ax,0F386h! U# M9 q0 w" P, e* \+ R
    jz      SoftICE_Detected  t& M8 N4 S# D2 A# B
# Z7 p) e0 W3 ^  y; k2 x; T. Z/ E% J
8 M; m, j) ?7 v  p
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
& C0 m0 W8 k' I$ d* Z   app like this:
# A! R5 ^( _8 Q+ @7 P5 P0 s
0 }& _3 |( m" l4 @   BPX exec_int if ax==68
) x* u) D8 C- _+ }) Z   (function called is located at byte ptr [ebp+1Dh] and client eip is
5 c5 h% ~" k9 M: X   located at [ebp+48h] for 32Bit apps)6 ~2 e- ^! H3 Z6 T4 [
__________________________________________________________________________
  M& r/ K4 v4 [- T
, x1 p! l. u# F* l: F
; [+ G8 ~/ M/ u0 P$ i9 VMethod 08: d  R+ v( M; {0 {8 B6 a
=========
9 I' I8 W- L8 T) @5 r* ~# e; a7 }2 ^+ M- ^8 V
It is not a method of detection of SoftICE but a possibility to crash the$ v$ A; N& i9 U, R
system by intercepting int 01h and int 03h and redirecting them to another$ j3 A, k; C4 N
routine.
% X2 W# j3 |1 b1 D7 EIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
6 `5 K7 Z& f$ L+ D4 w4 h' D1 ]  L& mto the new routine to execute (hangs computer...)
" D7 n7 t2 B# b( J8 h; G5 i
* r+ ]; j" D( {; W# f    mov     ah, 25h  ^  u- K- i/ u9 f/ p
    mov     al, Int_Number (01h or 03h)
7 h; Q  M/ x% K3 \: D! Z    mov     dx, offset New_Int_Routine
5 k5 k) x) r4 C# s3 V    int     21h8 F, r, N$ \2 n% Y8 P) m

  @" e$ Z0 x/ o3 O, j, J% v$ \( s__________________________________________________________________________: B6 G: P9 M4 N' D* d

& Q2 ~3 M* B' ?8 ^* m5 |1 Q$ ]$ n: ]Method 09
) N* Q. Q" k& j( ~=========1 C  H+ \/ o3 M( H) m: ^" A

8 [  x) H2 Z( J& i3 i6 _( cThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only  a3 B% P* K* d+ x: T, O6 @" ^
performed in ring0 (VxD or a ring3 app using the VxdCall)." V( Y+ ]% S1 W
The Get_DDB service is used to determine whether or not a VxD is installed
8 k+ c* `; y; N2 ?for the specified device and returns a Device Description Block (in ecx) for  n, }' R* y1 G- F- h2 Y( `
that device if it is installed.' W1 U) E5 D. F8 ?& ^4 p$ H/ F
- c6 T5 j+ D' C" s/ [! `4 m
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID9 V0 s4 S/ [& S# S3 Q
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)5 ?2 G( r1 T- ]* ^& F# G
   VMMCall Get_DDB
/ {5 z5 F5 c6 r' x6 p   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed0 n9 Y# |4 i; y" g& Q  F
& |+ [6 x4 `8 v
Note as well that you can easily detect this method with SoftICE:
( \' ?9 x  I9 R# L9 p   bpx Get_DDB if ax==0202 || ax==7a5fh
/ K, M* Z5 d2 a- N$ T
" V( m" b9 W) y7 n/ ~+ u5 m& P__________________________________________________________________________
( |" G6 z% }; m% }. g& Y8 N. I( J  X# _
Method 10
2 o- z( [( P1 n# p# I=========
/ q  j* a: r8 W+ J! Q0 X  ]6 [& d& s: D3 K3 U
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with% a) l2 k- t9 |! h; \  w
  SoftICE while the option is enable!!* b: r" b. _" m# A

% c/ L( n; D. s* T5 tThis trick is very efficient:% I: j, P3 C5 d6 F- Z
by checking the Debug Registers, you can detect if SoftICE is loaded
9 y2 I0 a/ X; P% _3 e(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if9 Y* e2 Z" S1 G
there are some memory breakpoints set (dr0 to dr3) simply by reading their
6 o$ M" D' o1 q+ B8 {0 |value (in ring0 only). Values can be manipulated and or changed as well3 F( u1 _# R! W
(clearing BPMs for instance)9 j/ B, ~& e! M7 M
+ I, }1 O$ ]$ k: L( ^, B% ]) F
__________________________________________________________________________4 T* R/ G& \8 O
0 N1 z& ]6 o* l$ l# F% y( ~* F3 x
Method 11' i- H0 N9 o, K+ ]6 y
=========" @* B+ g4 |; D4 [$ J
, e+ j! t% p2 B  B
This method is most known as 'MeltICE' because it has been freely distributed
& m9 c! [) ^" Q' Z1 O- Dvia www.winfiles.com. However it was first used by NuMega people to allow0 \. ?4 _5 l8 W4 N. k
Symbol Loader to check if SoftICE was active or not (the code is located3 W, r' k, z/ B. |. M
inside nmtrans.dll).$ i; f/ ~1 U. N! R
9 @# {* P5 j$ G0 r! I& w9 ?
The way it works is very simple:
. [" [9 F1 U0 OIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
; y( S( H; D: uWinNT) with the CreateFileA API.9 O; D8 I, u" I1 w: Q; u# R: X
+ m; Z" u  Y* b7 f- ~
Here is a sample (checking for 'SICE'):
- E% r  P  h7 U7 s* ~, h  v
+ U) a& s5 t, d3 B+ c8 }6 tBOOL IsSoftIce95Loaded()
# e4 N" y, Z# h4 a' _7 ]* E{( o9 }' X- o$ N
   HANDLE hFile;  . ]& R( B- p) _* C3 E
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,4 ]% P# Y* w4 V2 }/ r  _
                      FILE_SHARE_READ | FILE_SHARE_WRITE,& |+ o' s. b; A: W! p+ d8 \
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);0 \; u. k+ e* ^1 k3 E. I) Q! @
   if( hFile != INVALID_HANDLE_VALUE )4 N. j# e0 t* A
   {/ \9 X  B2 c+ f
      CloseHandle(hFile);. x1 L& L! g. U' _2 ~
      return TRUE;0 j  ~! h- w- K- ]" }+ X- ]4 B
   }
. s' w, S9 U8 j: A  @$ Y   return FALSE;
1 P( z* v3 a1 r7 B; j}7 _- x0 L& l3 K& w- ?

2 ?- q6 K- V3 }" oAlthough this trick calls the CreateFileA function, don't even expect to be% g6 z+ f% ~0 a% u7 v
able to intercept it by installing a IFS hook: it will not work, no way!; X! |! p6 \1 a. ^
In fact, after the call to CreateFileA it will get through VWIN32 0x001F
" @* k9 ?8 n* ?4 D: Wservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
. c; N' r1 M2 h) l" I6 hand then browse the DDB list until it find the VxD and its DDB_Control_Proc$ o3 L3 q- |4 F9 o
field.: X. Z( V5 W; g$ v4 Y
In fact, its purpose is not to load/unload VxDs but only to send a
9 w( v  J( f' n( O( f+ e/ G% q- LW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
' t1 _1 @( C  B. eto the VxD Control_Dispatch proc (how the hell a shareware soft could try+ Y9 p4 u, |* Q/ ]; b' E
to load/unload a non-dynamically loadable driver such as SoftICE ;-).
1 o0 e3 A' i) R7 G4 QIf the VxD is loaded, it will always clear eax and the Carry flag to allow1 A, e# D( Q3 d# j; p. p
its handle to be opened and then, will be detected.4 p2 g$ j& \* P$ j7 k
You can check that simply by hooking Winice.exe control proc entry point
- A  V! a- u: i1 n1 C% ~; bwhile running MeltICE.
& h5 d. J: D5 ?  D1 v' z/ a" E/ s1 h
, u4 P! N: `* l$ t+ q6 F; p1 k$ z9 D4 h% }8 a+ u/ C
  00401067:  push      00402025    ; \\.\SICE
$ [& Y- Q& C/ b% U: D6 S  0040106C:  call      CreateFileA
+ D' n( s) o4 Y9 ^  00401071:  cmp       eax,-001  e' O0 g8 H, G+ a/ R
  00401074:  je        00401091
) A! @# k% Q) I$ o
# v7 G; P4 r/ s" k# o: u! s
: V& z' ~! C, R6 vThere could be hundreds of BPX you could use to detect this trick.& S; R3 r9 {* Z8 J  D
-The most classical one is:, }! E! A! T9 e$ h; a) p/ {& p0 t
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||2 ^+ ^6 C3 u  C1 |: U. V6 S
    *(esp-&gt;4+4)=='NTIC'
9 n3 O2 z$ q2 F, S' t- D* v+ L( {2 q6 o' j
-The most exotic ones (could be very slooooow :-(
8 u0 o) B7 }+ V- `. Z% h* O$ {2 {+ ^   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  ' ]* @$ H4 M, N1 g* @5 g; I
     ;will break 3 times :-(, R% T1 Q- I& q+ A5 a* D" ^0 o  x

, j. |6 N8 P. a9 c* H& \5 z  ^  w-or (a bit) faster:
) n. ]: J, Z: ^9 }% }# d   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')  P& c$ _$ ]1 w* K

0 W5 R- l' a$ ]: x  t   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
- W' c  D) z! ]1 K5 Q     ;will break 3 times :-() |# @; C+ `- u9 i3 t
: P  K& q3 Z( T& f* B9 S
-Much faster:
6 m" p* r5 I: m) f% ?, i1 `   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'7 G8 c5 e+ [2 H- ~, O/ h

6 E* w# v0 W9 _4 qNote also that some programs (like AZPR3.00) use de old 16-bit _lopen
9 u& B! |8 R3 F/ q# e* i" jfunction to do the same job:
1 q% c5 W( |- ?9 n- v! R% x
; q8 S3 ^- u6 Y6 g" _$ b3 f   push    00                        ; OF_READ
" M$ o, g: A7 p   mov     eax,[00656634]            ; '\\.\SICE',08 j& J$ \+ S* F
   push    eax. P  w* l# Q  p6 T* f( Z0 s
   call    KERNEL32!_lopen
5 \7 g" [& S$ q. y- {5 k, K6 L   inc     eax
4 ~! `6 R9 V$ k; G& M   jnz     00650589                  ; detected  u; Z% i& c$ ~2 _/ `! [, @- N
   push    00                        ; OF_READ
7 d1 x  w- ]; }4 n; q4 O   mov     eax,[00656638]            ; '\\.\SICE'6 M8 _) ]% @* W* R8 e. ]
   push    eax
' f& s$ j# v: Q0 v& ?$ u  R   call    KERNEL32!_lopen
$ s, F( C9 d4 \- g0 Q1 ?) V   inc     eax0 F  z  p: c$ J5 b  @
   jz      006505ae                  ; not detected
8 v2 S' l9 c% H8 R+ w  B, N5 ^2 G! h. K$ T; C7 w
- \$ F! w' B7 V$ e
__________________________________________________________________________
  h- G# o  \! p. h4 T& K4 V7 |
& ^$ m; b: j6 CMethod 12( Q9 \0 N7 Z9 W% M/ n
=========
# k: I1 U: Y9 m4 f0 I
3 N6 M7 W( f* L8 {8 f" GThis trick is similar to int41h/4fh Debugger installation check (code 05
2 V4 ~: W0 `; [! [2 O&amp; 06) but very limited because it's only available for Win95/98 (not NT)) D! W5 ~, t( A8 l3 y- S  K
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.
; C1 L/ I! a* t1 t0 f; S7 ^" p( t6 g. {4 i) h' t
   push  0000004fh         ; function 4fh
) e! U% @3 y+ n7 t* l   push  002a002ah         ; high word specifies which VxD (VWIN32)
  V) F- A7 A& |                           ; low word specifies which service
- [1 R; P4 H( D. A3 b' b; a9 i& F                             (VWIN32_Int41Dispatch)6 C" v4 h7 x' v# X& I0 x! Q
   call  Kernel32!ORD_001  ; VxdCall+ x& s4 H9 t* h4 e1 _
   cmp   ax, 0f386h        ; magic number returned by system debuggers  V- u  `! W6 d. B* q% R% c
   jz    SoftICE_detected1 _' t* v7 `* V3 K/ k4 h* N/ g
* G8 E4 v( S/ g; v
Here again, several ways to detect it:
) z) Y7 o) U; I$ O5 P& ]7 `. O0 U; W# z4 q
    BPINT 41 if ax==4f
+ N" f3 u: O3 d. j9 \* p1 g" \8 O( u) }) {: y0 p3 y0 V$ d- l
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one1 i8 a: H' I. E

5 w' T1 j9 v* ~# `5 ^; g    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
$ `( T$ S' v6 |# [# F( b  H  d1 I7 |. n# u: j2 C/ E
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
( U* n3 d: T( B: [3 U' d2 a5 }8 {6 f! C
__________________________________________________________________________
" D' A# f4 E* f# R2 ?0 J0 h& Z5 a/ m! ~" K( |6 N
Method 137 \) X" O/ Q4 `) P6 x
=========# k1 e' s) L; |

1 \0 d' L# N0 x6 qNot a real method of detection, but a good way to know if SoftICE is
( I! Z, n" N3 |) E& Jinstalled on a computer and to locate its installation directory.5 R  V" E! P& U% g
It is used by few softs which access the following registry keys (usually #2) :/ `1 V/ [7 I3 J

- v5 P2 \8 B4 R-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion' i% T5 g, q1 z$ Y
\Uninstall\SoftICE& ~& C; i* G8 r  b7 v
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE2 b$ U# p# X" V9 X, ]4 L
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
* P, A. N/ y/ A* S1 t- x\App Paths\Loader32.Exe
& D3 k) p6 [! L$ Z# B
7 d2 E. e7 h: S7 I" G
' w" W( `1 n7 Y7 u3 q$ pNote that some nasty apps could then erase all files from SoftICE directory' K+ b3 I( Q( o6 @; H2 A2 Z
(I faced that once :-(
: L  i$ o# _0 Q' f3 ?& ^
# Y' f3 m6 J- T' _, {) z8 jUseful breakpoint to detect it:
) ]: R# |4 ~% y! ~( M; I/ t* ^
( b. ]3 l, o9 [; P     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'1 g, u6 ^7 g) \5 X1 r) Q

; i0 }6 E% s/ \5 }& Y! ^: n__________________________________________________________________________$ X5 `) o' z$ d
% r* r2 y; W4 K2 g

% e' o4 l$ H+ I! b! DMethod 14 9 c4 P5 Z9 @! z, e9 I. t4 t
=========
/ q- m# C, x; r7 p0 I8 H) t  h2 {. ^* l1 Y& f
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose& R1 y9 I9 s( D. L( ^1 X
is to determines whether a debugger is running on your system (ring0 only).5 D$ F* i+ u3 ?. B( T; R  b% l
, ]  H6 [/ c; I) e9 h
   VMMCall Test_Debug_Installed
' \& ^( |( R+ G  a4 P* t' R   je      not_installed* T5 j1 {: Z' }' C( _" g* w1 R, O2 S

! m! ]% v$ ^1 T& z4 ]This service just checks a flag., E; y" J5 p& x( A' ^) w, p) W
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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