About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>: ]2 A8 t& f% A) j9 ?& J
<TBODY>
/ ~, p) @7 |" K7 J* ^* R<TR>
1 b2 R" q/ Q1 l  S1 F1 t<TD><PRE>Method 01
2 v( z' h0 b3 K: |7 p. Y; J=========- D+ [" j! ^: V, l" ~

* W+ u0 O5 J& w3 n5 oThis method of detection of SoftICE (as well as the following one) is
1 s5 ~2 P' u" g) t* c4 Z, oused by the majority of packers/encryptors found on Internet.
7 |9 s0 r3 ^* ^5 Q) m) I3 g2 NIt seeks the signature of BoundsChecker in SoftICE
6 ~5 g3 Z0 z1 z1 z3 X  Y3 ?+ ^2 L+ S
    mov     ebp, 04243484Bh        ; 'BCHK'! T" Y7 p1 L- V5 }2 a) n6 W
    mov     ax, 04h' m! S& ^* V; G6 K% M$ m& X( D
    int     3      
& c, F# b) o* ]) M; E( f: s    cmp     al,4
1 J6 y  W( ~  S8 j8 J    jnz     SoftICE_Detected
/ a/ a% u+ R7 ?# U, U9 G' F6 J% c0 v" Y$ n, r
___________________________________________________________________________- R# Y$ o. V% J& K) `! B

7 y& s/ ?' |; G' d- S  wMethod 02
7 G8 O* C. n6 V8 G=========
& G1 u# s( h* y$ ?& M% T
( |' x4 a; j$ w) F) F' u3 z7 `Still a method very much used (perhaps the most frequent one).  It is used8 d7 ?7 z5 |, p! w2 N/ q8 A
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,* ^0 k0 M# K% i% O/ Q6 O
or execute SoftICE commands...8 ]9 r$ K5 c: N& A
It is also used to crash SoftICE and to force it to execute any commands- V5 g0 y7 k* k/ E
(HBOOT...) :-((  % a" G9 w4 ]- r. U5 M4 L5 O

' P8 p" G4 D$ E( IHere is a quick description:, d+ o0 i) X$ d7 j+ |% V$ d. L
-AX = 0910h   (Display string in SIce windows); [5 u3 Z4 ~- w3 j
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx). o4 x/ [3 t; Q7 z6 e5 t0 j
-AX = 0912h   (Get breakpoint infos)
# X# q4 u7 c, T: X1 p-AX = 0913h   (Set Sice breakpoints)
) T4 M/ V) T& \' @7 T-AX = 0914h   (Remove SIce breakoints)1 _6 l9 A& ]" ~  q$ B9 P

, d$ V0 d5 b6 u3 b: SEach time you'll meet this trick, you'll see:
! I1 J6 i/ t" \' h-SI = 4647h
$ A; G1 h) o! ^7 O% N-DI = 4A4Dh5 }( A& A. M" O" x
Which are the 'magic values' used by SoftIce.5 ?" n* w9 F. H0 R
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.3 V# o+ T: |* N3 S% G

4 N! R& c/ l3 R1 K" M- NHere is one example from the file "Haspinst.exe" which is the dongle HASP
1 ~0 q" e4 W5 w6 G) S  K$ @' Z. HEnvelope utility use to protect DOS applications:
5 K4 v' \1 c' T) b7 P/ Y' x9 [( M$ Z9 p

! e1 g* w6 y# L* @0 X0 _5 d4C19:0095   MOV    AX,0911  ; execute command./ L% L9 E! x7 [- |
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).9 I0 L# i$ f' j  P7 G
4C19:009A   MOV    SI,4647  ; 1st magic value.
6 V( ~: |# ?4 ~3 \3 l8 p4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
% u2 n$ W9 l8 P* a; a4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
0 x# k& e3 ~0 H/ n& B4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
* o# @" c+ \8 ~" a4 d: Y4C19:00A4   INC    CX5 P# H/ A5 V5 n+ G8 X) R, i$ ?
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
# [0 c2 j; L, s' ]1 q+ j) _2 V4C19:00A8   JB     0095     ; 6 different commands.8 D7 W; h2 U' z$ X& U0 J
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
& k1 h" f4 X' f4 r6 z' k$ U4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)7 Y4 X- ^; n) J) O: m& |1 b' ~3 `
6 ]; a6 m& U5 q# Z! o; H. _  D
The program will execute 6 different SIce commands located at ds:dx, which1 _# _4 `, l- d+ X  o
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
. I% H  L- Z- }( J
$ N; [+ H- w$ e9 G* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.1 A5 E% b4 N; L* l: A& h
___________________________________________________________________________
/ A. g% B3 M( p1 w/ U. W/ g
" D$ @! r- {& _' F/ c( H3 V
( l/ Q( i' l5 S& s, t! M7 x* q1 QMethod 033 h7 `- O$ ?- w( ]: X
=========
6 v, c4 \3 x) d0 K6 {! Q0 H) }' ?. a
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h! }6 P0 ^/ k& q6 P' N1 ~
(API Get entry point)3 V! G. _! O7 g& _- v
        
+ f: o% |7 g4 ?0 b2 B
1 W1 A7 Y( z  z( N    xor     di,di
7 w; Y# f( `# W: t    mov     es,di
) J0 @$ m9 p! b$ T' V! }$ L    mov     ax, 1684h       8 S$ |8 F4 c& @( |9 r
    mov     bx, 0202h       ; VxD ID of winice  I4 J- N; Q8 v& L. i1 y
    int     2Fh
, C, p8 H5 m- @2 S3 S, G( l9 q. @! _    mov     ax, es          ; ES:DI -&gt; VxD API entry point! @' _& R" z( f* |/ p# T
    add     ax, di: `, M! w5 h  o' e8 |
    test    ax,ax- \. {' ^' M; X3 L; B6 o
    jnz     SoftICE_Detected0 S# [& D8 Z. c! T! u

2 L; R* W- A! [8 E- ]___________________________________________________________________________
  h2 i' X0 Y# d4 x3 K
( c1 Z- `: |( sMethod 04
3 d6 k8 o. u/ ^9 g" i  z=========2 V( t- G8 A' ~# f, n4 B  ~
/ [" I  l9 {8 v* D0 }6 w1 E
Method identical to the preceding one except that it seeks the ID of SoftICE
* p7 `0 q1 Z6 F+ f1 z( a3 ]: V4 fGFX VxD.  f! Q1 w) X3 `) }
  Y+ h# ]& S( R0 D4 ^: R4 B
    xor     di,di
  J/ f5 s' M% B% F& S; B8 ]    mov     es,di( O/ J7 A% s% t+ c# }
    mov     ax, 1684h       ; E, V3 k  S2 ^, s$ x5 J
    mov     bx, 7a5Fh       ; VxD ID of SIWVID
. m! i5 }$ i( \1 W, U0 x6 k) P    int     2fh% P* }: Y4 X" G2 A
    mov     ax, es          ; ES:DI -&gt; VxD API entry point7 {% `5 @4 u; u. J& w4 B) e
    add     ax, di
  ]& `$ c0 B& ?/ E+ Z    test    ax,ax9 x' X6 C4 g) S8 R- }% G$ _
    jnz     SoftICE_Detected
" H4 u' T7 W' T6 L/ |1 `) C( w4 Y0 L: {* ~
__________________________________________________________________________7 J8 V3 q2 Z2 c, H3 O% ]
- E' G7 M$ V1 A; ~& }

) J3 A! _+ ^( y; tMethod 05
. X5 X" \+ O( v# J5 L) v=========
" Q! j$ [1 M, h. i4 P9 r* {, @: \. p8 L! x
Method seeking the 'magic number' 0F386h returned (in ax) by all system+ t4 |9 n( W1 H1 N; b0 w2 O1 N
debugger. It calls the int 41h, function 4Fh.7 Q4 c' n& `( a) B2 X4 S9 \" ?1 K
There are several alternatives.  
5 b# W4 q- @. y( i" Q6 B% }
$ }: u" F' U3 j( y' VThe following one is the simplest:
0 q: B. n" \  T* Y8 [
2 k% A- ]5 D3 w; C$ [    mov     ax,4fh! k. F( ~0 h- Q# I4 G# r+ X& ]
    int     41h
2 P3 [% U) _5 ?0 }    cmp     ax, 0F386
. {/ z2 a2 ~! D' p8 ?& o    jz      SoftICE_detected
# a0 V0 J  Y- K  H: |( L# u& q4 m. P5 W3 c- X
" I& n# Q* A$ g! f. {
Next method as well as the following one are 2 examples from Stone's
0 i' i' Q4 ^# m8 ?) v  m& _"stn-wid.zip" (www.cracking.net):
# C6 N# z( }' [9 z& C5 u' m
2 K+ N# u2 M3 h0 N0 i    mov     bx, cs
2 c, O/ n% ^  P& |8 ^4 Z* ~8 z    lea     dx, int41handler2. o7 b9 b% a+ y' N
    xchg    dx, es:[41h*4]9 C6 ^' H1 q- }! y( c3 S: U# l
    xchg    bx, es:[41h*4+2]
9 l+ _! N# s( u6 M2 e0 W: Y5 }7 I    mov     ax,4fh4 f- h* \/ K; R  q+ U- H; J
    int     41h) U8 M6 l# a7 }& S0 O# _
    xchg    dx, es:[41h*4]
+ Q4 q: a7 W5 g, T    xchg    bx, es:[41h*4+2]" j1 c/ Z" {, h- T. Z
    cmp     ax, 0f386h" u% R+ L: t2 R/ V$ d% l5 @4 J) h
    jz      SoftICE_detected3 Y; T6 E5 d: }4 G+ z) i

- J$ n2 y, S5 j% w! Hint41handler2 PROC
3 p( z; B$ s6 {$ h2 I    iret
0 l5 i' o3 y1 X9 V1 l% s% ^7 m' }int41handler2 ENDP
1 G$ z. Q% K: M3 g1 i1 l" U1 d
1 s2 }6 o5 }8 r, K' ~# K
0 I: z& B0 F3 ]* E' M_________________________________________________________________________% o& T& g9 q# N+ @
! ?7 |/ v3 h9 L; E
+ e1 ~% _/ b7 ~; {
Method 06
5 v, \1 [- N" ]+ L=========
8 i, u! r+ g4 H
3 m. A) K) w/ B- C  V6 C  S; V# o  @" a+ S/ H$ Z: ~
2nd method similar to the preceding one but more difficult to detect:7 y- y5 t7 N0 U/ U2 T7 b

3 A; b2 @! g& o- {/ b+ p" p; i* `5 ?! Y6 ?& e
int41handler PROC
6 y6 F; b, G8 A, N2 g$ `8 i! p7 p    mov     cl,al
5 U5 T8 v! t( `8 v* I0 R) M# ?    iret2 e9 z0 H7 `4 ]& C/ e* a, ]4 J" d2 R
int41handler ENDP; {" s3 U$ t" P1 Z  t
0 @8 m8 E4 g$ J

# }4 t+ X: |# q0 i- E( ?    xor     ax,ax
5 Y6 l4 [8 {. w- M& V# e5 W    mov     es,ax
; J( V8 I3 e! C$ w8 M" P3 }    mov     bx, cs
! J- i$ i: Q4 f/ D( Q    lea     dx, int41handler
9 W+ H; v8 |$ b) F2 \% B    xchg    dx, es:[41h*4]4 Z! Q6 l; U5 V3 n' L, I
    xchg    bx, es:[41h*4+2]" N6 A' ^  g& F7 g, o" o" O! f+ @
    in      al, 40h. v, G7 K+ l' }% p* W; j
    xor     cx,cx( A) A  S- Q4 {& g3 {8 q/ G
    int     41h7 I# M$ M3 ]9 `% |; ^8 k1 x  m9 ]
    xchg    dx, es:[41h*4]
2 H4 V2 D0 e. R# Y    xchg    bx, es:[41h*4+2]! A7 o7 k' Q5 k) m& M7 _
    cmp     cl,al& n" [+ S$ h% ^5 X, s0 U
    jnz     SoftICE_detected
+ c- A, q' i# j) O  Z# A3 t. h/ Z# A) z0 v  c
_________________________________________________________________________( q& e  |" L# c: ^* A  }# R
( g$ ~8 n! N4 H
Method 07
# J  J1 }+ a9 l& {- L=========
9 Q4 F# S* a& y. u# N: _1 g% w; N+ V$ k
Method of detection of the WinICE handler in the int68h (V86)
$ i" E  e# q* I7 U) S8 X3 H( C- S$ r4 ?% O) g" \
    mov     ah,43h: @1 r3 F" q# z3 t
    int     68h
8 `. @1 S  y1 P$ U2 A    cmp     ax,0F386h
* x) c6 u$ P8 N1 H    jz      SoftICE_Detected
( T/ a+ O7 H4 G& a$ m  c" M
2 D# a( [- C3 R' ?% F
  C' K& ^0 W5 [/ H=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit$ d0 P, N4 G& ?( F/ [4 ?
   app like this:
7 u/ X' Y% b9 H7 [
2 g5 s/ q" P$ `   BPX exec_int if ax==68
& I: B9 I6 O4 w' z! K9 d   (function called is located at byte ptr [ebp+1Dh] and client eip is
" ^! J; Q0 q8 e   located at [ebp+48h] for 32Bit apps)1 q" n  t: S8 H# W4 B- B  u
__________________________________________________________________________) D: O/ b" Z' D* p
- u& J9 p+ m2 K3 N

2 E0 V$ p9 W5 i) H& @Method 08
+ a# x" e4 s9 v; x1 `9 [2 B' h=========
$ \# x" C* |# O0 f, V
/ g: Q4 B: C: ?# UIt is not a method of detection of SoftICE but a possibility to crash the
+ v7 L) b9 P' A7 k( C& R( Esystem by intercepting int 01h and int 03h and redirecting them to another' [' |/ z! i# w7 L4 I7 m% H+ z" F
routine.% j, k( @5 T( w. k/ F2 n
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
( y3 C" Z" Z0 [$ p) W4 m# i: Sto the new routine to execute (hangs computer...)
9 |7 a' `/ ~6 {. u& Z( ]3 X! S
( Y4 k, k/ s  k2 Q) G    mov     ah, 25h9 P( C# l9 I- ~
    mov     al, Int_Number (01h or 03h)
3 t. ]  ^: n. i  E" q$ n$ C$ |# W    mov     dx, offset New_Int_Routine( Z& M; T9 P  o8 ?
    int     21h/ k# m  h, v/ \: h, q. W* u) `
' U' G# G$ m1 h+ k; G3 d. M
__________________________________________________________________________
1 D1 L: \# A5 m  j; J" Q. d. R0 `. D; u: ?% F3 |8 T: k8 t# ]
Method 09
1 M6 Z3 h0 B) y. w% g  P6 J3 i& J' L=========6 t* \& \" ]0 N9 c+ v1 h. f2 x# c
  G5 \- |" z% \- l
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only+ v( H2 q% Y0 b/ o* d  v
performed in ring0 (VxD or a ring3 app using the VxdCall).
$ G/ G: M" O$ E- T- MThe Get_DDB service is used to determine whether or not a VxD is installed
7 f, w7 b( S5 b& ?' Dfor the specified device and returns a Device Description Block (in ecx) for* L3 Z, a1 f3 A0 m# r
that device if it is installed.$ G: K* e5 }( y) ~

" k  y9 S& M4 q   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID; D8 C; k8 M$ P9 B! ~
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
# l5 y4 m1 E5 R, v. ~9 ]# a! m   VMMCall Get_DDB9 K0 |+ `1 I  ]& L2 _  o: X
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed& n9 \* H6 R- v% @
- ^# C; T/ w- x
Note as well that you can easily detect this method with SoftICE:
) w: j0 H2 C  N; A8 g% |+ H   bpx Get_DDB if ax==0202 || ax==7a5fh
& w6 Q# G2 n0 P3 p' P& q5 S
' h; p# M- l6 z$ t__________________________________________________________________________
& K' x) u$ H/ z+ O' o9 x+ O1 T) J" A7 s+ r, n/ P' f- M1 Y
Method 100 ?5 Q/ C" D$ i* p
=========. [! V+ X5 @5 v% A2 s1 B8 b
6 l" G2 l# U" ^' ~0 E. P
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with% X; ?& T3 o1 o, n3 [
  SoftICE while the option is enable!!: S+ i+ n. o& ?
  F% D% O2 L( {
This trick is very efficient:7 v. E/ r- G/ j7 J5 g8 V& o
by checking the Debug Registers, you can detect if SoftICE is loaded
; c% r( d! \! I/ ?(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if" Z3 T$ K  }% ?7 p- _1 y% n3 y5 M9 Y
there are some memory breakpoints set (dr0 to dr3) simply by reading their& C0 R/ x' ^  I, Z1 W( p
value (in ring0 only). Values can be manipulated and or changed as well, ~% E9 n2 g0 ?
(clearing BPMs for instance)
5 q: d/ |/ `. ?, J  H" |* j+ d+ {/ u$ _4 n/ b# h/ m( J5 P
__________________________________________________________________________1 ~! }6 Q! u" j# l1 o1 S1 {

5 c- @) B- l) ?' {* O7 gMethod 11
( T  _! U/ A0 P* \! G=========* Z' g* w9 w  _) d2 I. O, V5 U

4 O* o5 c( J5 _  y5 G# @, KThis method is most known as 'MeltICE' because it has been freely distributed( t$ F" r$ v5 S9 \4 \
via www.winfiles.com. However it was first used by NuMega people to allow7 d" D- b. C$ |3 i% C
Symbol Loader to check if SoftICE was active or not (the code is located6 b/ O* d' u( c3 J# ^" O6 e
inside nmtrans.dll).+ v: [) L8 {: c

2 R) K/ {$ ], h9 O3 G9 n, P0 ~0 UThe way it works is very simple:6 [3 ~7 N) _# C
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
& K$ S6 v1 l4 U  [- Q# w! CWinNT) with the CreateFileA API.
# C: e5 h; }7 L9 }4 q3 k1 D$ ?/ q) F, Z
Here is a sample (checking for 'SICE'):+ ]; x9 U* X$ \* R
1 {% t7 c- f) B& u( e; m5 v( p
BOOL IsSoftIce95Loaded()0 u7 A7 q2 c1 V; I9 y
{
, S& U. G: \0 _; h1 C( _9 n   HANDLE hFile;  ! V2 x0 O) G6 Z& |/ ]0 L) F
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,9 m/ T6 I( s2 i/ p, A5 F: R6 F, {
                      FILE_SHARE_READ | FILE_SHARE_WRITE,
" R! Y/ {5 K' f/ B                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);. v: x4 ^5 v2 O" |# m# }+ k
   if( hFile != INVALID_HANDLE_VALUE )) O$ P1 r8 R; s9 e/ u. h7 b, F7 _; ?
   {6 R+ ?$ h3 `& |1 f
      CloseHandle(hFile);
) A7 G) E: {0 r& b$ ]+ d' o      return TRUE;
& t) a2 P. [- z8 @) e% g, _* _7 r* u   }
/ O. I3 ^0 G0 l# r- H   return FALSE;
- c4 ?( p/ D, T0 ^$ q}  p6 x+ R4 f& H: V

/ X4 W  a$ Q$ Y9 X5 @' a# J. a- p4 lAlthough this trick calls the CreateFileA function, don't even expect to be/ s9 p, ~5 ?6 h4 g7 L2 Q
able to intercept it by installing a IFS hook: it will not work, no way!
) J: w0 F% p5 [: J1 t" D& ]+ gIn fact, after the call to CreateFileA it will get through VWIN32 0x001F
2 i- J8 ^' e' V6 uservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function). G0 y2 }7 f5 W9 {) [
and then browse the DDB list until it find the VxD and its DDB_Control_Proc3 x* _2 {6 K. A" k
field.8 g7 O2 a& T+ E* g
In fact, its purpose is not to load/unload VxDs but only to send a
8 l' m$ C+ C6 ?, |; l3 z6 tW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
: e9 \* _- }$ ]to the VxD Control_Dispatch proc (how the hell a shareware soft could try  a  h% A; n- ]  L0 @1 v7 S/ x
to load/unload a non-dynamically loadable driver such as SoftICE ;-).
# l" j  C, f9 R/ N  VIf the VxD is loaded, it will always clear eax and the Carry flag to allow( ]" c) e- z) C3 v6 K: {) n
its handle to be opened and then, will be detected.9 h8 {9 q' f) W, L5 V2 o* C
You can check that simply by hooking Winice.exe control proc entry point0 s8 j& L3 Z& e' H" h1 W
while running MeltICE./ Z9 B' F9 W9 E( z5 E

# T$ \) \" X" W) _" a0 I( q% Y/ `+ A, O, ]
  00401067:  push      00402025    ; \\.\SICE! G: F. L" k+ _/ t
  0040106C:  call      CreateFileA8 Y# X5 P3 _! L; H0 [2 t* a
  00401071:  cmp       eax,-001' `- V  M$ u* Z
  00401074:  je        00401091- P  j1 t  G$ P6 F3 L- L

' o7 n/ C3 m. g6 q0 N! B- t" ?0 c. [
There could be hundreds of BPX you could use to detect this trick.
. g2 \  h9 u; k6 v/ ?-The most classical one is:
) D. d$ x1 [# _0 ~* p& y" A3 \  n5 x  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
6 [" B! }2 U! K% |' C( L: n+ b* \    *(esp-&gt;4+4)=='NTIC'; H+ E: l8 ^& o9 t

. B+ Q* d: \- j; i1 z& N9 B" ^-The most exotic ones (could be very slooooow :-(
  h, h0 |7 l, v) f  |7 @) M+ z4 d   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
4 J5 M6 k6 l) A9 b/ K     ;will break 3 times :-(& e2 p' j0 W% G/ t$ ^- }* Q- K
- o* h! |+ Y% y
-or (a bit) faster: 2 j* L0 v. ]$ D4 H$ u" v7 L
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
9 @6 Y8 M* h$ S. @) j, j5 N0 q1 H3 z& W7 b7 y
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  0 Q+ H5 Q) E4 P8 J0 V) S2 r' h
     ;will break 3 times :-(
6 _# ~" Y" P2 i8 l9 M
3 ?. v8 @# B9 o: P-Much faster:
# y/ K; C- R& j* J   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
3 P) n6 ~6 E# n2 \9 \/ B* `+ ?5 F' ^0 m" @8 l3 D  h
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen
) m  [5 B! ^) `* w8 xfunction to do the same job:
9 O2 b3 z. s4 k  D
3 R3 i6 o$ {: N, j% E   push    00                        ; OF_READ
0 a% U. Z+ C4 g1 t2 c+ o   mov     eax,[00656634]            ; '\\.\SICE',0, X; M' J3 a8 O# W1 z
   push    eax
; P2 e: E8 {% i1 j+ ~   call    KERNEL32!_lopen$ K: {" K6 R* ~& @1 C: E
   inc     eax
0 x* q; b6 ~% G7 t1 {   jnz     00650589                  ; detected* m0 z& N# f. m1 W( D# t' H1 [
   push    00                        ; OF_READ
! t. s) t! S* w6 }2 Y   mov     eax,[00656638]            ; '\\.\SICE'- Z1 N3 I' n1 t7 i
   push    eax$ v1 c0 Q" u# Y0 |6 Z( o( o$ B: g5 Q
   call    KERNEL32!_lopen
- y- l: J# }: G/ B( E   inc     eax: s# Z0 u8 K! p3 z- F: }. g* T
   jz      006505ae                  ; not detected3 q( U1 {; N/ e: `
% {8 e! b5 Q2 ^7 m( G1 t  G

6 F1 K7 e' Q1 X& e2 k4 F" E' Z$ x__________________________________________________________________________6 G) `; P, {, z. O- n
4 O" ^5 j! c& x9 o8 ?
Method 12
) V* |+ Q4 I) ?4 K1 x! s# X=========
2 }" ~$ z. x7 Y6 F' i
! ^" y4 e7 z7 |This trick is similar to int41h/4fh Debugger installation check (code 05
) X6 W& w4 E/ f6 E4 n0 H&amp; 06) but very limited because it's only available for Win95/98 (not NT)/ }; ~- ?" l8 {& M
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.$ B/ k0 C$ k% k/ D/ y

$ W, r# `& D/ s3 I+ P) t* I   push  0000004fh         ; function 4fh
/ c) H% O% E7 q   push  002a002ah         ; high word specifies which VxD (VWIN32)' u* {: I$ \( R" y0 G; t" P8 z
                           ; low word specifies which service
2 M: V6 W6 }+ D' l( Z                             (VWIN32_Int41Dispatch)( Y* c6 Y4 @9 h) V0 x
   call  Kernel32!ORD_001  ; VxdCall
  d1 H3 F2 @$ }" b( f8 ?   cmp   ax, 0f386h        ; magic number returned by system debuggers
' f: X* a4 [( \7 p! C; H( ^, M( [   jz    SoftICE_detected
( G5 o% \) W2 {' X9 ]
) B# T% f0 s& E" K+ b- ~+ QHere again, several ways to detect it:6 M! t! V- X- P6 i

7 S. A, M6 N0 {7 ]    BPINT 41 if ax==4f; N6 H% L% c0 o% `
+ R* ^5 c( _  `
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
" }, s* w' U; f7 F5 Z- l' ~! v" l
4 @0 g9 v. S; _9 m    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
1 w2 T1 \: a3 G' s+ R0 ]! f3 w
# f, f" X# L1 J8 U/ ]    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!& i! ^& N4 L; \( A$ E6 E3 H

0 F7 X; R/ |$ l9 ?0 l9 y__________________________________________________________________________0 X7 ?1 Y1 f" R/ u

9 ]( w$ ~+ J9 `1 z0 y% A( A( nMethod 13; Y: m8 _# k9 Z
=========/ Q) X2 Z! x+ q9 }

- v& r: U3 \2 k8 eNot a real method of detection, but a good way to know if SoftICE is
- p7 n6 i1 I& a; Y# uinstalled on a computer and to locate its installation directory.
, `& C; x6 ^3 k4 T) ZIt is used by few softs which access the following registry keys (usually #2) :: K0 t( r# o1 \6 m5 l' ?$ M. i8 y4 Z

4 ~/ d2 K5 {7 B/ Z; N* l% w-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion+ V+ ~1 q5 V, }8 q4 R9 H7 T( }& l2 o
\Uninstall\SoftICE% t. w" O" S+ y3 H, L5 k) A) P
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
, e1 }" r2 O& Y9 f5 k3 z2 X# ~-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
) f  L  c1 }, v" N\App Paths\Loader32.Exe$ Z, ^2 Y* F% F
" G9 b, |8 D+ Q, S
# c, e$ a: s7 `: I' q2 X
Note that some nasty apps could then erase all files from SoftICE directory
* f: D) E4 {- {: m% b(I faced that once :-(
2 N' \% Y- g9 Z+ Y4 S, @9 C0 k& U2 _" U) B* N; W
Useful breakpoint to detect it:: t7 \6 `/ Y( j- x

' z9 M+ O( p5 A& U% O- H0 Y' l, u# q  G     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'* B7 a( O$ M. u1 ^; Y, d" E

! g0 c2 v1 l6 \+ E, N4 e" n) I__________________________________________________________________________
- e" V& t. ?7 @( ?4 ]' ~5 }% S) }# g/ ^$ B8 L  V% S

* [) h- c% {) X* Z6 O8 eMethod 14
( w" L0 p* k$ `1 N4 W=========
' a# z& [8 M$ H
( v1 c+ V; A. g7 \7 \$ e0 `A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
/ a. B( ^( t9 d& }2 His to determines whether a debugger is running on your system (ring0 only).3 g; B) v" W1 E7 d+ _" i

, D( J3 k- T- L6 \7 x0 t   VMMCall Test_Debug_Installed5 M/ y5 u5 M/ m- ^6 Z
   je      not_installed' n/ Z* _( g7 U4 h
" L: p5 {- G, X2 [8 g( O$ X
This service just checks a flag.
6 q3 @/ U- Z6 _  z</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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