找回密码
 注册

QQ登录

只需一步,快速开始

About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
0 p& @' D8 S0 S1 E<TBODY>
& N+ p0 C3 l9 S+ C<TR>
3 h0 c: Q9 G& }. ~<TD><PRE>Method 01 ; @% \+ O' M/ @0 J+ ?7 B* d
=========* R) Y; G) T( R9 F7 \. ?

6 ?2 H9 `( J& e/ R. JThis method of detection of SoftICE (as well as the following one) is' g3 A6 t0 u/ b- x1 ^
used by the majority of packers/encryptors found on Internet.- B; F# v) E) n. P6 `
It seeks the signature of BoundsChecker in SoftICE
" u+ R8 S. p& B# }' L$ J3 g0 M$ i# X
    mov     ebp, 04243484Bh        ; 'BCHK'8 Q# u& v* m* a; Y! _6 v; q
    mov     ax, 04h
7 A; u3 M. I7 C  k0 B    int     3      
6 M) ?0 ~0 g+ J    cmp     al,4
6 N0 b6 X+ |; B    jnz     SoftICE_Detected/ L9 j. H: P- b' P( ]) _( `, P
6 E8 p* ^" E  C; a  R9 M- N" r8 V2 d
___________________________________________________________________________
5 S" c+ t' ?7 `9 n6 D
% e# g) I% W2 OMethod 02) w, F( r/ H, W2 g
=========
8 b. s# r7 j6 S' K/ Q( x; l- j( f7 ~$ ~  Y$ W
Still a method very much used (perhaps the most frequent one).  It is used
$ c- ?& S8 L; q2 gto get SoftICE 'Back Door commands' which gives infos on Breakpoints," a8 }3 E$ ^6 ~: |" B# d
or execute SoftICE commands...
# S% ^' {; D+ NIt is also used to crash SoftICE and to force it to execute any commands- o( c( P* |& `
(HBOOT...) :-((  
! z' M' k% @/ e8 ^# A9 q) @. \* q; p" W; D- l4 R4 J! {
Here is a quick description:
8 b2 k4 U( X$ R-AX = 0910h   (Display string in SIce windows)& m% O  O/ g4 ]6 Y- c' D1 w
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
+ {* m: b0 s% ^/ T5 {-AX = 0912h   (Get breakpoint infos)
8 [; R; m5 t1 f2 E8 V-AX = 0913h   (Set Sice breakpoints)5 J5 V' O: U$ L2 A- ~7 x# R
-AX = 0914h   (Remove SIce breakoints)3 k9 g" o, l- y

6 k( i" ?! K7 ~$ A" w4 yEach time you'll meet this trick, you'll see:3 Y5 L& V4 r0 D- T9 s
-SI = 4647h
$ T7 g& L; \9 h-DI = 4A4Dh
! H: B* g- g& R% |% {$ Q, NWhich are the 'magic values' used by SoftIce./ H( i: T; t: Z6 z4 l" f
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.
. i% l" c+ z: A5 ^; J5 Y
  s! Z' O! I/ E" D& M3 i: QHere is one example from the file "Haspinst.exe" which is the dongle HASP
" F% {: f: N- u5 W8 Q8 rEnvelope utility use to protect DOS applications:( _3 B! s: M; }4 f

' x$ ^' E8 G  c  A# d; A+ w4 x! K2 g0 e
4C19:0095   MOV    AX,0911  ; execute command.
2 r, w+ B8 ^/ k9 f) n5 S4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).# b& [- |# W& L
4C19:009A   MOV    SI,4647  ; 1st magic value.
# O. v: b2 N% H2 L) {1 Y4C19:009D   MOV    DI,4A4D  ; 2nd magic value./ ^9 M1 T5 t3 e& K" }
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
6 U0 F, g! E) v  X4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
7 u' f  D7 U/ A/ G, N4C19:00A4   INC    CX4 U8 }! g) ?2 Z  Y, v
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute- H- J& k" w7 M# @  q
4C19:00A8   JB     0095     ; 6 different commands.
1 R8 V. s# \+ f( b+ p) l4C19:00AA   JMP    0002     ; Bad_Guy jmp back.- V, b. z2 z) m5 b# b
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
. K. d  E& F" y% z4 i7 {1 x0 n4 t, ?/ S  ?/ T
The program will execute 6 different SIce commands located at ds:dx, which
0 ^6 q" ^: O! rare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
0 ?  Z! a7 g+ h! {+ }, _: C; t8 e9 ]
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
5 Z6 o7 F# v" R0 b4 L___________________________________________________________________________
6 V6 M" _& h2 S5 s3 v8 f
( M2 h9 B$ i% s
& l  I$ Z) N1 f6 b4 T; O& JMethod 03% u  c7 u3 m& M& L  i
=========
5 }) b* ]. e+ Q. U% P' m' \5 {7 Q' i& d7 C0 a3 J  S0 d8 ?
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
' ]2 N3 k6 X" ]% g( V( u& a# n& @' \0 R(API Get entry point)
( k% ~! s) i  M" O2 z9 g+ o7 ]        $ F9 \" E$ K6 e' y+ q% `
$ E6 {( ~* m" J( s. W
    xor     di,di
7 D: u5 s1 L6 J. w4 w    mov     es,di
/ m0 o* ?& B: Y6 X    mov     ax, 1684h       % W7 m5 u* w& F6 z) @. K
    mov     bx, 0202h       ; VxD ID of winice% q! K* }& Z- L0 u: {9 j
    int     2Fh
9 u& f3 s* y0 N: y    mov     ax, es          ; ES:DI -&gt; VxD API entry point7 N0 e$ N5 R, J: h# G: o  b
    add     ax, di
( u) G2 I# s' K! F, g9 ?/ S- g    test    ax,ax
0 ~; Q6 M! M; E! m    jnz     SoftICE_Detected% @$ l. L" e; K5 U

, o2 F4 K7 r$ W  @- v___________________________________________________________________________
1 b# @. Z6 W/ V/ w' _" w: I9 t, u+ @3 {4 U: u" g
Method 04
3 v$ h1 j' y9 N, Z; a. j( o$ ^% s=========6 e% ~" y4 ~$ Y. M+ }/ ?7 I
5 X: V4 }, T% s) p
Method identical to the preceding one except that it seeks the ID of SoftICE
1 W$ W* _$ w, p3 uGFX VxD.
' R4 F0 i# r3 W/ V; W. X4 T0 {9 x
) b) o8 K, c3 F) j5 \- D    xor     di,di
. f9 s- X: L' q1 J4 I( [    mov     es,di
4 ~4 P9 f' {1 A' `6 @4 H    mov     ax, 1684h       0 F% n) A9 L9 O4 B/ m
    mov     bx, 7a5Fh       ; VxD ID of SIWVID
/ y1 y5 o+ c2 G1 g( H9 D. i' g    int     2fh- X' D/ r. \% H4 A
    mov     ax, es          ; ES:DI -&gt; VxD API entry point* E2 h. |6 v- ~; b% |
    add     ax, di" ]; e6 ?3 j. W# H; }- z( z
    test    ax,ax
+ L" I1 l4 U5 Q8 h    jnz     SoftICE_Detected
% k, q% q- i# z' I( r6 j0 a$ i8 l" W2 n* B, @- d" @
__________________________________________________________________________) U5 V( I; p/ N. K( i) [3 N

- I3 M6 O: X9 P
6 o6 v0 C( r( k1 x3 B1 g$ A! kMethod 057 y1 d& ~8 D4 C2 R6 H1 x, `
=========8 n3 {5 y9 X& K5 D
4 }) }* Z9 T0 G8 l: Y: r
Method seeking the 'magic number' 0F386h returned (in ax) by all system/ S' h1 y5 l7 f/ _5 c' o  Z
debugger. It calls the int 41h, function 4Fh.
" r! c( m$ O, ?) V1 IThere are several alternatives.  
  i* ?3 J7 u1 I3 Z' z0 U3 w4 b% O: t0 e! N1 O7 r
The following one is the simplest:* \$ V9 P' L- w# f! j

$ M8 f9 C) I7 c" s. d    mov     ax,4fh8 T! C$ `9 @# c# G( V1 a. z: B4 U
    int     41h% J! Y4 f( V2 ?8 L
    cmp     ax, 0F386: I- A" u8 n  I, i: t& L3 ~! S) u3 S
    jz      SoftICE_detected
7 a8 x. H. t4 Y7 D6 L6 Y# l9 a- a3 n8 v( i# I# R% R

* W$ D2 o; D8 k' qNext method as well as the following one are 2 examples from Stone's ; T3 [, i, F1 [3 {0 V+ c
"stn-wid.zip" (www.cracking.net):
) ]: s* ]+ \! m6 _% d8 B
( m9 q) o  K- p- r    mov     bx, cs
3 {. J" |$ X; L8 j4 g; j0 d5 O    lea     dx, int41handler2( b; D! R8 y% q: [
    xchg    dx, es:[41h*4]7 t+ _- n3 {' Q  ]$ G
    xchg    bx, es:[41h*4+2]
1 l5 Z. a1 `5 {  ]+ ?! \- m! R    mov     ax,4fh
+ q) V2 F$ s4 r* n    int     41h
7 @/ e" a- y3 S4 S    xchg    dx, es:[41h*4]3 F) b5 u* O, A' [1 A0 |6 ~4 [
    xchg    bx, es:[41h*4+2]# s+ N5 E! B3 c
    cmp     ax, 0f386h
3 W0 Q% h, l5 O9 R# k4 p) v    jz      SoftICE_detected& {* q2 `0 l+ J6 R# ?

" O6 N1 k; S* D% I6 {$ uint41handler2 PROC+ u& I" o5 P/ f1 w+ K$ _8 L" T! P
    iret) [9 O! |8 X' X/ U
int41handler2 ENDP! \' }/ i  p( A1 x
8 ?8 o$ D* @" v' v+ [9 r
4 Z3 m5 Y' Y: c( C& }" c. f$ v
_________________________________________________________________________
7 _+ l0 D8 Z# x8 Y7 I
0 t3 w: ^) z% h9 ]8 d/ D* X# I# p- v6 p: w
Method 06
3 H% x: L* g9 Y- a) j=========  s: g; N" ]2 g5 T
* x& L8 Y! X8 {. K. j/ K, b

" V, k3 r  B+ Z6 _' O, I2nd method similar to the preceding one but more difficult to detect:
, b* e$ v" R0 w/ e  d6 a1 c1 @( [
# D6 T! G) R7 v7 s  e
# r, a7 T5 a5 Qint41handler PROC8 C/ [# X- p4 Q0 ]6 C% o: u. ]$ v
    mov     cl,al; S% p9 X1 F7 m$ w
    iret' p" r% s2 C7 a, `$ M* v& E. K. U$ s# I
int41handler ENDP
0 H0 h6 A5 h+ v  c7 @7 ?0 v, X6 @6 D/ c% F& t4 X: z, ?* P

: ^' [/ t3 |# V' Q4 \  L    xor     ax,ax
3 h2 \0 e3 r4 n6 U    mov     es,ax
; o( U4 B/ T9 _2 c8 F: j    mov     bx, cs. l- ?+ Q/ d5 ?
    lea     dx, int41handler  V- n6 ^6 ~6 p( Z9 X7 p
    xchg    dx, es:[41h*4]
( y% G, z6 q& ]" b) D6 i    xchg    bx, es:[41h*4+2]
1 o5 s% P2 M0 M    in      al, 40h& l0 |- K% y2 S/ b5 i$ V/ f' V
    xor     cx,cx8 n  B% d9 c5 U- e1 ]# `4 _" f
    int     41h
# @. Y% v1 m* u9 O    xchg    dx, es:[41h*4]8 c" l& F6 v" ?& V) N
    xchg    bx, es:[41h*4+2]
- {0 y5 G$ r2 }9 e6 G+ e    cmp     cl,al
6 t- }( L" x* E% G. S    jnz     SoftICE_detected
$ }% Q. C( i# ^6 T
6 {0 p* h" u/ i_________________________________________________________________________
, W2 c& P) A% I  K2 d* j' Q% ^7 \: I6 U5 w1 v2 L$ Y+ m/ q( y
Method 078 j! G2 n1 G5 x$ Y; T
=========
! }7 s8 s  R$ H8 V+ i
( A0 h, [+ N$ j( R% |$ @9 W& TMethod of detection of the WinICE handler in the int68h (V86)
' z. a4 g2 S' W" b" X
/ D8 E& Q5 W% L( j3 |) p. q, P    mov     ah,43h2 u) j8 R+ P% t+ A/ s
    int     68h& @9 L$ ^" G, Q" T8 p$ \) O5 M2 s  ~
    cmp     ax,0F386h  X* ~4 Z6 K+ g" ~( L" O
    jz      SoftICE_Detected
; [& E, ~6 o# A
/ j$ Q7 C9 }! a  R: w- ^! Z8 t2 v$ o+ ^% |+ T: c
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit5 Z" g+ \- `9 [' F; Z. H: O2 w
   app like this:2 t, i) `( r7 n6 {( f/ H" Y! A( _* @
* E' W% [/ q- P$ r! k2 c6 d2 _
   BPX exec_int if ax==68
2 J9 d* K7 ^# I# Z# R6 U   (function called is located at byte ptr [ebp+1Dh] and client eip is0 Y; L. o3 I9 @, c' V
   located at [ebp+48h] for 32Bit apps)  `8 o2 G0 q8 |( H$ W- \
__________________________________________________________________________
- L% G. ]& c7 m2 z: p" r& H. Y1 B! K: z/ f: Q' [. y
0 N7 I# }+ |1 u" g4 V5 i
Method 08* b3 Q! H- j* b5 a1 n+ u( i
=========- D& p1 m7 q9 V, L) P: k3 k8 e2 r

8 K1 o& ?; V9 o9 d9 p8 \It is not a method of detection of SoftICE but a possibility to crash the
! Z3 ]$ @1 ~& t7 a( ?system by intercepting int 01h and int 03h and redirecting them to another
* ^. }, P! n5 @1 M/ D* S- W+ Uroutine.
" t+ t; U/ ?* CIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points0 M8 M# Z. Y; B, `/ g
to the new routine to execute (hangs computer...), m' I% ]3 O# h) N! ^" z2 I

$ C' m" W( a: ]0 Z$ u- D. a1 d    mov     ah, 25h- n. f/ u* J3 x" U# J
    mov     al, Int_Number (01h or 03h)- R# v2 _5 F9 q3 z+ K& R
    mov     dx, offset New_Int_Routine* a/ I) h: d1 e7 Q
    int     21h
! t0 I* `5 q% W( E" h0 D3 O* l$ k) j4 v$ n4 X( X
__________________________________________________________________________4 n+ Q- ^' r) }! X
: O! A1 z4 R  K; ^; e
Method 09; ]2 W" a. `* ~$ t" Z8 e, t) D
=========. @. T/ u& V& A* c, n( j; x

$ \$ o3 l/ s$ d; y) @3 gThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
8 a( Q% A6 A, B  R7 nperformed in ring0 (VxD or a ring3 app using the VxdCall).* w% i0 ?/ l: f& t# Z
The Get_DDB service is used to determine whether or not a VxD is installed( E/ z1 N3 I' J- R8 I
for the specified device and returns a Device Description Block (in ecx) for
9 _2 E! j) Y+ l/ ^that device if it is installed.
( ^' I: ~0 S6 g/ w" T
) P! Q" i' |+ I/ |: i% S1 u   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
: V  e. i1 V4 ~- r! I& X" N5 f8 H" F  B   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-): y" \  |6 M: G! O" i
   VMMCall Get_DDB2 u8 Q4 L! i/ d7 x* u
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
" d. y" _+ o/ [3 d! i# D& B# k. j' U- j8 K% p
Note as well that you can easily detect this method with SoftICE:
% p7 g$ r! Z0 q/ T% ~" M$ b; T   bpx Get_DDB if ax==0202 || ax==7a5fh
0 v) J2 G/ h7 M7 A& A
2 a$ r9 E: \- F__________________________________________________________________________0 r% l& _/ [4 G" `

6 e0 g4 k( Z! R7 p# I+ b$ UMethod 10
& H" e& W' s: H3 }5 K7 h=========3 t! y! b2 T2 c) |- X9 A1 d

* \# m5 M8 ]* {  f, r=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with% I( B! Q6 \) p0 }* h0 U' v
  SoftICE while the option is enable!!% {) s/ D/ [+ X6 \' ~! Z

, Z7 R6 o6 ~- ^7 V# e' s. i5 BThis trick is very efficient:
1 n5 s4 v+ e8 f- e9 j* w3 [7 gby checking the Debug Registers, you can detect if SoftICE is loaded
: x) @; D* U- Q- w- v9 G(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
8 K+ i8 W& R3 `6 B$ Lthere are some memory breakpoints set (dr0 to dr3) simply by reading their
# f2 H- D% N3 }- `' t+ h1 Svalue (in ring0 only). Values can be manipulated and or changed as well
3 ]; d/ U6 }; o/ M: s* M(clearing BPMs for instance)
3 @2 q" y$ W9 V8 }, H1 H) b# V
- J6 g+ w! d( s8 k__________________________________________________________________________& P& n# x  u6 \# H. T8 b' `

9 s/ Y; A, l6 e, `  P8 DMethod 11
) |; [' U. F! O7 U  R" u=========0 P1 Z, s5 A/ Z) a/ N
( z: d  p" T7 {: y/ K. s0 X" E
This method is most known as 'MeltICE' because it has been freely distributed- ]# ^3 ?3 p3 x
via www.winfiles.com. However it was first used by NuMega people to allow1 E# E1 _8 T3 e
Symbol Loader to check if SoftICE was active or not (the code is located
# \4 X; ~. h: o7 }7 M. }inside nmtrans.dll).
* ~; d8 T+ t1 A) m: {* ?# n/ L+ g: k: K" v. [
The way it works is very simple:& J' |7 L* T1 J! L6 n5 p6 l+ J1 p
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for: N7 L" _, G6 }% |  [$ Y
WinNT) with the CreateFileA API.
1 ~6 I  q' G* p: l$ g* u" ^4 l3 Z- l) F. N! z. _
Here is a sample (checking for 'SICE'):
; R0 T- }9 g- e( _0 b4 X3 D! H# m, H4 \+ i* e
BOOL IsSoftIce95Loaded()
2 {: t' t2 I& T1 r6 Q# t& H{
& x( Q2 l) C3 v0 Y/ W4 h. f   HANDLE hFile;  
$ m6 J& J- Y+ @5 ^& D$ Q. m# h: X   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
% d1 y9 o8 m# O6 g9 T, _" i$ h                      FILE_SHARE_READ | FILE_SHARE_WRITE,  [& e4 p' h) a: C
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);0 ~9 e( ^& e7 A2 J) U, b5 A* w
   if( hFile != INVALID_HANDLE_VALUE )' E! |4 z% W+ Q: _1 u+ G  Q5 m/ C- o
   {4 Z- R# x! l; u6 V  ?: Z& U
      CloseHandle(hFile);3 c, O5 _  o( {$ f2 z, L+ H
      return TRUE;" o. z9 O1 Z' |1 R6 X" o7 L
   }4 p6 t9 c8 @: F8 `/ b" J
   return FALSE;
2 S" l: ]5 Q, u9 Z; o9 l! t}' O; x8 |9 n. F$ s# F* D

& J& h$ v% h1 @6 o$ G  eAlthough this trick calls the CreateFileA function, don't even expect to be
7 \' m) s7 p) V/ Jable to intercept it by installing a IFS hook: it will not work, no way!9 e& m3 s7 h1 ?! r4 x/ E1 g
In fact, after the call to CreateFileA it will get through VWIN32 0x001F  X2 w2 H8 a7 V: w
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
& R0 M0 _' {+ J5 s0 Wand then browse the DDB list until it find the VxD and its DDB_Control_Proc- j& S, ?# H5 Y$ n# M% a
field.
: c4 v9 y" o) Q- KIn fact, its purpose is not to load/unload VxDs but only to send a 4 k% u! D+ Z. B! q
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)/ X  ]/ |6 G- _$ I5 L2 L& d0 r
to the VxD Control_Dispatch proc (how the hell a shareware soft could try
! X8 z1 l) q7 S& pto load/unload a non-dynamically loadable driver such as SoftICE ;-).+ w% G$ `2 k/ [' ?0 a9 k7 }& l5 g
If the VxD is loaded, it will always clear eax and the Carry flag to allow
2 s  o3 }6 @( uits handle to be opened and then, will be detected.
$ J3 L  W1 e6 m& Q% p  dYou can check that simply by hooking Winice.exe control proc entry point, |! j3 {# C; @1 t
while running MeltICE.
- [: K0 ]) f' F) T+ |
, F5 v5 u6 A2 M7 N8 s
( x9 H4 Y5 x9 u* y4 F  00401067:  push      00402025    ; \\.\SICE6 u/ S# l  g$ ]& [+ D' x$ F, D
  0040106C:  call      CreateFileA
% v2 K2 M; b2 _+ O! x& }  00401071:  cmp       eax,-001
8 X# I: K. P( g  00401074:  je        00401091
# R* P0 ^' J3 \; Z9 e
+ Q# S4 r) B4 [% t1 r5 l2 H' A* y8 X6 ^8 A$ r" t3 e2 t+ }
There could be hundreds of BPX you could use to detect this trick.
& z4 P& q" F$ }& D# f-The most classical one is:, S% @: ?' w! j# [) v, M
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||( N3 f8 y3 m' @8 }- W* F
    *(esp-&gt;4+4)=='NTIC'
- t7 @$ Q1 B+ b+ V; N) t- A
8 A( W7 d, \4 M- E& J  j# ?-The most exotic ones (could be very slooooow :-(
1 l5 A" S* C  X4 Y   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
' K# z7 r9 b/ M; z5 ?0 c     ;will break 3 times :-(7 ]+ u2 \# W4 T$ a. X
& K% W4 y0 Y9 i$ L! t. {# a+ R
-or (a bit) faster: + g; D0 ?9 c2 K+ R, [
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
# b% g8 ~0 E+ y6 \9 d+ Q
: \# G, V8 D- ~9 @   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  ( V1 Y  }- ~' `' i. A* E0 A
     ;will break 3 times :-(
* `5 @4 c! M7 d0 [! ^( D9 o; |/ Y
-Much faster:
* E; c7 r. J  S0 K. u5 T8 d   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
1 D# K! E7 E6 |3 _4 C+ i( S" R
2 M) L5 L9 Q+ a1 ]9 _Note also that some programs (like AZPR3.00) use de old 16-bit _lopen
9 A& I# ~: E, M& K6 V6 t" Ofunction to do the same job:3 n% T0 |- k0 p, s0 `
. `0 k( d& Y2 V! D# w, i5 W8 T
   push    00                        ; OF_READ2 a5 a( _. B* t6 V. ?0 Z* N7 Y% f
   mov     eax,[00656634]            ; '\\.\SICE',0
) \4 J- y, o+ o$ O' u; q' }9 Y: \   push    eax8 }7 y2 y0 Y  @
   call    KERNEL32!_lopen
9 z$ D$ `. W! v" z3 Y5 Z' m   inc     eax
0 B% m' x5 K% T8 |; E* z; V   jnz     00650589                  ; detected
$ n2 r% F  d& A' g+ {, q   push    00                        ; OF_READ' M: o( ~6 p; P# i
   mov     eax,[00656638]            ; '\\.\SICE'
3 {- A* a  o; T2 d2 U7 A   push    eax1 r9 l* j+ _2 a  h! ]4 r
   call    KERNEL32!_lopen
1 f& e7 E' H; @1 P; Y9 w; K1 S9 p7 Y   inc     eax6 l4 U3 v, S& L0 V' _% p3 o
   jz      006505ae                  ; not detected+ |* V( v# j2 e4 t+ O9 H

7 |  U7 _! m5 P
% v/ T: C/ g  t2 z+ U" m: Z# |__________________________________________________________________________
! R5 h, C  w3 E1 |( O- Q8 p& e8 l+ f6 I* i: p- A
Method 12
& T2 C+ c$ w- W" g1 r$ R7 G=========% ]" X* F" B, c9 v
5 u- x" \* ?8 N; d* R8 ~
This trick is similar to int41h/4fh Debugger installation check (code 053 Q) Q- [8 j% Z. q% _+ H
&amp; 06) but very limited because it's only available for Win95/98 (not NT)
# [) M1 o# h: p4 o/ ]8 Vas it uses the VxDCall backdoor. This detection was found in Bleem Demo./ h: `' `$ S! b3 I" C: E

: g& ^8 \: Z" ?8 ~: H   push  0000004fh         ; function 4fh
, H. n  d5 d" _4 h- g# d   push  002a002ah         ; high word specifies which VxD (VWIN32)
; H( `7 d" Y( Q6 Z  m! ~) [/ }                           ; low word specifies which service
$ \& L  L' c# e1 R$ w3 I- {                             (VWIN32_Int41Dispatch)
( U- m% Z" ~0 b4 v- u   call  Kernel32!ORD_001  ; VxdCall1 B+ F: ]3 k* W8 t8 W
   cmp   ax, 0f386h        ; magic number returned by system debuggers" G# g6 ?7 Z# l
   jz    SoftICE_detected4 P. x6 o; f# G$ [1 B
: k( h; H$ }% ^, r3 u7 W/ x
Here again, several ways to detect it:: N8 S5 Z6 z$ I0 T. v6 n
( E- `+ Q# P. Y! V& Y" s
    BPINT 41 if ax==4f
, Q6 ]! g" c5 n3 _
4 j2 g0 B, W2 k% R& z    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
& l1 ?% p+ C- P
. Z+ u1 C6 D9 q8 k: @$ {6 u    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
3 e, u' I$ y; I4 _2 m* p4 s% ~8 c3 @/ O& q" O# A' T" N$ }1 E: |
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
3 U0 ~) h5 [& }2 V  F8 p, Z" c' x5 w3 P. V% J
__________________________________________________________________________; a& P6 t9 j3 m- ]7 c

" l7 q7 D6 ^, G! g. P- ~) N) bMethod 13
: W2 ]/ ]' I5 |" x  A+ y7 [=========. t/ }( ^6 o1 g2 s! }

9 V9 d' N! r6 v- V% q! o/ mNot a real method of detection, but a good way to know if SoftICE is5 X+ @/ D0 Y! b5 D; \
installed on a computer and to locate its installation directory., y( M' t4 Z1 |4 C+ d- s! r
It is used by few softs which access the following registry keys (usually #2) :& A# y6 y3 k5 [/ q, I
! R3 O, D# W4 c% e
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
7 E1 W3 }: S0 K\Uninstall\SoftICE+ U: T" K  L( C( i' D4 C1 U
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
/ ^/ v9 A' n6 i  i* J. O3 X7 g; W: n-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion" e/ y8 z7 r, U
\App Paths\Loader32.Exe
5 _& X9 Y  T) [3 {6 [6 C4 D4 q/ k" n1 s- h1 B, i* K
' O! h) U3 n: \$ ^/ k
Note that some nasty apps could then erase all files from SoftICE directory
* I2 k9 g" Z  }& x. L(I faced that once :-(8 \  D8 W; z* E! u
! E4 f- L8 x5 L1 M' w
Useful breakpoint to detect it:
/ z% R0 s( [( N
0 D  I) s2 A  E% ?1 V0 M; d7 i& k8 J     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
6 C9 Y0 V* E' z5 L
0 s9 Q$ T$ N* ^2 K% K# I* Z! d__________________________________________________________________________$ \1 X1 c5 l1 i4 j

4 L) x' r. `$ B' Y: N& Q& e5 }5 J" k* C+ L8 Q3 v7 a" N  X
Method 14
( {. N* S  O" A=========! L- V7 a; Z! i1 F; k0 U0 z0 }
( e7 d+ a& W) X! z
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose6 i. ?. v- Q# E  M7 W! B
is to determines whether a debugger is running on your system (ring0 only).
- ^6 i9 F) X1 s! e* a# z1 }/ I
) Y% D/ U, p" z# P+ S' Q   VMMCall Test_Debug_Installed
1 E  P$ n& H8 e8 N8 s- G: Q* n   je      not_installed# K0 g2 n5 }! L+ D

' k  `6 m* X  u) ?" vThis service just checks a flag.; O; s# |" W" r+ m3 n
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|本地广告联系: QQ:905790666 TEL:13176190456|Archiver|手机版|小黑屋|汶上信息港 ( 鲁ICP备19052200号-1 )

GMT+8, 2026-8-8 09:51

Powered by Discuz! X5.0

© 2001-2026 Discuz! Team.

快速回复 返回顶部 返回列表