About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
+ H% }% M2 l; d. A: ?# C<TBODY>+ C) g; k* c* c6 k& z! |  u
<TR>
+ S. O7 t  A" F- ^% m# R# K+ w1 |<TD><PRE>Method 01
* N1 l2 ?% \8 z; i7 |! X. G, h0 c=========
4 ^+ E; m9 a# ]! v  |) a# O) Y: ^3 B0 [
This method of detection of SoftICE (as well as the following one) is
6 |( ?! H% v2 z6 T( gused by the majority of packers/encryptors found on Internet.2 Q3 Z7 x! j  R+ R) s
It seeks the signature of BoundsChecker in SoftICE! {. R# C  O# W9 n

; v" J# [# E% o) [8 m2 Z    mov     ebp, 04243484Bh        ; 'BCHK'
9 l6 k* g- H8 a8 T2 q( h    mov     ax, 04h+ y4 [( q( F, R; W" j1 G
    int     3      
1 p1 ~4 B1 {  N, Y# Q# b    cmp     al,4; U+ h$ A4 ]4 i
    jnz     SoftICE_Detected: S0 P. _& {; P' k& B* @! P

0 `3 d: L4 F( y- ?___________________________________________________________________________
  w1 u3 y( t' l. g7 v! E5 g
. w# N9 V; t+ ^  S/ aMethod 029 U( U2 R6 U- B
=========8 P6 n  \4 w" G

! R/ u9 H# P# r! K" c/ |( d+ ~2 hStill a method very much used (perhaps the most frequent one).  It is used
$ k/ u, z( H6 W0 g0 C) O; Ato get SoftICE 'Back Door commands' which gives infos on Breakpoints,+ j. N7 C# E% n, ?* a5 o6 [1 s9 ~: z
or execute SoftICE commands...
6 C0 b, ?- Z  p6 t0 r' A6 E( dIt is also used to crash SoftICE and to force it to execute any commands
- L! |- U. h) w: J(HBOOT...) :-((  
- `8 j3 n5 D5 v1 ~, l5 d6 v( A3 B, L) h3 z' l3 y$ B2 v& g6 }
Here is a quick description:
7 D+ X8 C! K$ K0 s" ]) Y6 f2 C-AX = 0910h   (Display string in SIce windows)
! C. M+ d. t" Y2 m-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
  ^. _( a5 B" z-AX = 0912h   (Get breakpoint infos)8 J/ _/ N9 u' _: M' Q% J
-AX = 0913h   (Set Sice breakpoints)
9 z& r# I" k: _; o, d-AX = 0914h   (Remove SIce breakoints)+ s0 ~3 l# t" G) ?
$ U$ b; {! f3 F( A! B& E
Each time you'll meet this trick, you'll see:2 Q! x2 D$ c% }9 A, [
-SI = 4647h
3 n7 O0 m" S9 R# C: j  a-DI = 4A4Dh% f7 q) m. _( c. h* B5 g7 R8 i
Which are the 'magic values' used by SoftIce.
% O6 H. N( q* L' t, c6 GFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.
) ~! e) _2 j; J
. ]. j. s+ d5 l1 Y. @" bHere is one example from the file "Haspinst.exe" which is the dongle HASP' P4 O# j  S# c% L
Envelope utility use to protect DOS applications:$ k* j- [/ j, u3 R8 v7 @

8 |) G0 v/ M4 ?! P$ q# ?) m
, k' \0 D' e# Y4C19:0095   MOV    AX,0911  ; execute command.9 \* G* G& g! U) y1 o0 i
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
6 w- J$ U( ^2 b, c; j4C19:009A   MOV    SI,4647  ; 1st magic value.
2 x7 e5 d. \# l$ H4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
2 ~" g5 w2 I2 y% O2 _. n4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
+ E* _2 D6 l- r3 S9 s' j* J% d+ @: P4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
# Z6 F6 A% ?2 v) [5 K7 s) b4C19:00A4   INC    CX
& B# D% U9 j: D; k4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute" s! ]7 }. J7 q2 S+ D1 W
4C19:00A8   JB     0095     ; 6 different commands.
# G, x, i. D+ ]0 F! z! ]3 p4C19:00AA   JMP    0002     ; Bad_Guy jmp back.2 t' G* x, z  ^. y) A+ }
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
, e' Q& x& [  N) v2 D. R$ R1 p
7 G( S1 N0 u9 W3 e$ c3 ZThe program will execute 6 different SIce commands located at ds:dx, which
% D0 V; B! m9 j! A* _. Pare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.- V$ q4 Z* B' w7 t& P

, g' {' U% L9 e0 Q' n* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
3 Q: [9 N6 l4 K% t3 ____________________________________________________________________________" e6 g8 H4 l5 ^- q; l: j6 N" U3 {

# ]! L4 ]' G8 D9 F7 |6 ~( W3 j; Z
5 U5 J  W5 _5 y9 z" w5 U( O" rMethod 03* T: d" i5 q8 L. |2 f/ B, V0 C
=========' {& R5 H2 ^( H1 h  S

1 m( I$ m4 Y1 N3 \3 PLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h6 Q4 Z$ ?% x  {  c$ p3 _: s4 U' K
(API Get entry point)) v5 C9 e4 y; J# i3 t$ }+ V
        
8 b7 v3 o, y; ~0 f! _( ~, O3 f. Y# [# V- w' L6 j' y4 c
    xor     di,di! M( N5 _$ g/ s5 H5 O" F
    mov     es,di
3 O2 M0 a8 F+ F, j2 V( _; K6 e    mov     ax, 1684h      
1 X) j1 |" D- B6 Z    mov     bx, 0202h       ; VxD ID of winice9 F* l$ P/ P3 ^
    int     2Fh: q! W% c* t. c/ J& z2 l
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
$ u7 ~* v1 r; f) E4 d4 k    add     ax, di
( ?) D( k& s4 i, Z& d5 r    test    ax,ax
9 B$ H' g1 m$ m$ r8 ~8 t# F1 x    jnz     SoftICE_Detected' u: j6 L/ ^4 H9 s

4 g4 d' ^( {  ____________________________________________________________________________) d! I7 A( z# X  D. e# }6 O- X$ y! d
9 v+ C; j. y) n
Method 04) C$ Q( h2 ]2 }
=========9 H1 m: r# p) y; \. Y* G* c
7 W" a/ ^- J( K- b- }% |
Method identical to the preceding one except that it seeks the ID of SoftICE4 L8 g0 I# N# H1 R6 ^& o
GFX VxD.- N9 z5 T/ Y2 n4 v  @0 g: q
$ ^5 b- g( ]  V9 T. i
    xor     di,di0 j8 E, b4 N" \! {, }6 c
    mov     es,di: X6 l  \  k) i4 t2 U' F$ b( \
    mov     ax, 1684h      
! u9 [/ e- c/ M. g    mov     bx, 7a5Fh       ; VxD ID of SIWVID& S7 r; Q1 F! u; Q2 w& M
    int     2fh
7 u- A: {: n6 J    mov     ax, es          ; ES:DI -&gt; VxD API entry point6 }0 F: d$ W) V' A2 Q* X5 c0 F
    add     ax, di; t0 K: L  ?3 r& Q. m
    test    ax,ax1 x/ F! x6 L. N  d/ H" Y
    jnz     SoftICE_Detected( J9 J: V- e/ i# k/ u, f

+ o  j! O4 A. I  f, v__________________________________________________________________________
. }2 K  @  |, \6 P6 K) l+ f1 N0 l* A- R3 A6 z

. J6 k& S! \7 P0 V3 QMethod 05
  \# l6 Q/ K1 [. K: i% @=========6 {2 B( f3 l1 S' F$ Y8 g( E

: q1 S+ N. I# _+ \6 M6 e/ L5 XMethod seeking the 'magic number' 0F386h returned (in ax) by all system7 {+ E6 R1 F4 s) D; J& J& q, b
debugger. It calls the int 41h, function 4Fh.
, }$ e' h" r, QThere are several alternatives.  
* n( [& Z9 f; j1 J+ a! ~5 e5 {( e3 [0 N8 M. v& v
The following one is the simplest:3 }9 A" x" _: B/ R. V

+ ~7 b% a3 _! S0 s8 ]6 a8 M4 y    mov     ax,4fh
0 V+ ]) T. y7 P& Q* O+ M0 S    int     41h5 {" E  F& K7 p  C& u
    cmp     ax, 0F3864 Z' o6 t* i7 X, L
    jz      SoftICE_detected" E6 e1 `5 L' T# {* G# L
6 R6 n- V) G9 ]: R

5 f* q1 D9 F  k% N# s5 GNext method as well as the following one are 2 examples from Stone's $ G  M4 ?; c6 b* r/ t
"stn-wid.zip" (www.cracking.net):
+ L' j: |$ i) D" U$ R. t
  k5 @2 J' I; X+ c% l    mov     bx, cs
+ d1 }! G( F  a4 J    lea     dx, int41handler2
/ c: S! p- ?* g" V% @    xchg    dx, es:[41h*4]
6 r# G: C( L; l6 H    xchg    bx, es:[41h*4+2]
5 C5 T" c/ |8 Y+ g9 A    mov     ax,4fh
/ l, a* F$ g" S) V, A2 Q    int     41h" A( @6 L0 H# C/ g& z& |! S
    xchg    dx, es:[41h*4]
& [$ D; h% k8 L) v. U) l    xchg    bx, es:[41h*4+2]
" R4 P' e5 {9 G+ ^) P) u  o    cmp     ax, 0f386h) Q3 j  [6 y/ N8 `" R2 f5 _
    jz      SoftICE_detected
! G) \8 ~0 s' h1 p0 p$ g2 ^/ M( m
int41handler2 PROC6 l& Q( r& D2 f$ y0 `
    iret
. r0 Q3 T! N# E2 B# j- @/ m- \int41handler2 ENDP
, j% ~+ h6 h+ i: k7 F) j( ~4 H- e# \1 l( @& m+ U0 `3 i- Q" u
2 p; F  Z0 m2 n% u1 T* \
_________________________________________________________________________7 O) l( P( U6 K

# ~. h# u$ D# [4 x( y6 t
! `5 l2 o4 ?- y( A( t. [# tMethod 06
' z8 w4 q! Z# E9 Z+ u2 r=========
6 H- h9 _! o/ A/ w' D* ^
+ F( D# a& i& B- I6 v4 y3 H/ g
3 x% F' o0 p! m6 x( X0 @: C$ L2nd method similar to the preceding one but more difficult to detect:
% I8 P, W- h! k2 k- G
+ n/ f/ h1 K1 W! _- C; f0 z% \6 @
: a- H, \. ], E- H% a8 A$ ?int41handler PROC5 Z1 j/ M& A/ i: J; J. z+ X
    mov     cl,al
' O& I! G  a* v( F    iret; w& Z: |6 K7 K0 O- H, P2 P
int41handler ENDP
; b) a( T3 }) D! ?8 D* X1 [6 F8 L$ q; [8 k! W. O2 y9 L

% P4 E9 E1 v3 c0 N- M/ Z    xor     ax,ax
0 n6 J" w; r! {    mov     es,ax
1 _& D/ z7 C0 P' D$ @( |. N    mov     bx, cs
3 h; b$ e: B1 S4 x" n. y    lea     dx, int41handler- ]/ U2 L7 X& d9 k& [& M8 J
    xchg    dx, es:[41h*4]
9 Z0 A4 `7 e7 ]) s/ x+ V    xchg    bx, es:[41h*4+2]- H& W. R5 `$ s8 l) q) B# S
    in      al, 40h
/ s( H' o  ?+ O; V" O0 T5 p    xor     cx,cx
" h- [' |6 y! x    int     41h- G! a5 T2 I5 D1 I  A% s
    xchg    dx, es:[41h*4]
+ h  w4 v8 N  v6 _% [2 M$ R    xchg    bx, es:[41h*4+2]3 i9 i( A/ P; H+ S/ \; v) |7 b* L
    cmp     cl,al
% @% E$ @1 W6 O$ F8 n    jnz     SoftICE_detected/ j7 d# x" z" u% E0 q) W7 `. X
1 L9 g$ r( K6 I
_________________________________________________________________________# v* s/ g. w) _; d. X
4 A0 h' y6 n6 Y; q
Method 07. U4 P% C. \8 K5 M6 C5 ^6 n' l
=========2 u3 v: G$ j2 W" k3 r
- k$ K: h/ T1 z' ~6 H2 X
Method of detection of the WinICE handler in the int68h (V86)
; c9 p$ J5 L) ^9 x& u! ~; S' B8 `2 n& F; _* o2 ^
    mov     ah,43h( s3 a$ v$ ]5 U& z$ T; ]
    int     68h6 }( F9 }5 [4 z. x( G
    cmp     ax,0F386h
* T- Q& D( g% H    jz      SoftICE_Detected
( ~* s6 o$ I9 Q5 u" t+ E( t% n
: g+ D7 J' @; B1 h3 a& U9 q+ c8 u; X
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit; c1 I( I% q5 H4 V
   app like this:
" @/ j% w7 g+ s2 j& i7 N
" Q! l0 [) Y4 _9 @- c4 d  V  r1 v9 H   BPX exec_int if ax==68' ~  U4 x0 \" a) b' j3 M" `
   (function called is located at byte ptr [ebp+1Dh] and client eip is
! ~8 o7 M7 @% x# ^- q/ o   located at [ebp+48h] for 32Bit apps)( f0 }0 ]7 |, V8 [0 h+ B2 U
__________________________________________________________________________
3 h! W/ S; K2 o8 ^+ t3 e7 v  ?
" a" @, g0 o) O9 T8 }' ^
Method 08
* x; o( S' O' U8 \=========5 q9 a8 `8 x- v" U: S
- ^" [0 g1 g% [) ?
It is not a method of detection of SoftICE but a possibility to crash the
8 R0 ~% y5 L+ ^7 p+ ^8 lsystem by intercepting int 01h and int 03h and redirecting them to another
7 \1 P6 V# T: R/ A& mroutine.
2 I5 |: Z/ O8 X5 q6 m) XIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
, |8 P. m2 P* `# X( p' p. o8 N5 ?! D9 sto the new routine to execute (hangs computer...)
; q: l8 I0 ~: R( V9 g9 S/ t4 Y0 a9 V& o9 e
    mov     ah, 25h# {+ M4 \* ?3 z
    mov     al, Int_Number (01h or 03h)) b0 l7 ]* _% _" P
    mov     dx, offset New_Int_Routine- v/ t! N; E5 s8 z& Y5 A- t
    int     21h
) E+ P( \  H) B* |, ?, W6 ~, Q3 f
* F* b9 M9 S2 p6 a! C  K; ^! Q__________________________________________________________________________
& c% R6 N( L, A7 T- i. F1 T, J* ^; O3 a8 n0 v6 [; W( t2 @* w
Method 09
! {7 j# \/ B3 Q9 N2 N" m4 u=========" `1 P7 I- F+ U5 ^9 x

! R: V: b! ^7 k2 T7 m8 E: q. f! q. CThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only) v" `  E  S3 p' ^# D- `5 q( Q
performed in ring0 (VxD or a ring3 app using the VxdCall).. v8 ^* x7 R9 ~; M1 W' S% `6 R
The Get_DDB service is used to determine whether or not a VxD is installed
7 v3 q7 {* w) A8 s: {for the specified device and returns a Device Description Block (in ecx) for' }, Z5 B2 }! p
that device if it is installed.1 [: O( I  o* n1 _0 U4 Y
2 a3 q9 Z6 g9 ^, W# m& @( S5 x
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
# C, `; i6 t1 \/ x/ O" |9 Q   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)0 Y8 @7 i4 \2 N4 N' X+ K' s1 s( \
   VMMCall Get_DDB' d3 @4 d2 U6 r7 r
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
# @" f' z  w7 G+ y2 b- q, h9 P/ c4 l8 Q9 K: \
Note as well that you can easily detect this method with SoftICE:& Q! ?5 Z7 U$ y- \0 d
   bpx Get_DDB if ax==0202 || ax==7a5fh
, c% g1 [0 e- j* m  D- T! p( v# u. Y, e9 x7 ]
__________________________________________________________________________8 k/ k9 A( h9 C9 a! C5 D
& M/ P3 Y9 ~% j+ m
Method 10  `8 B6 ?6 L* x3 Y
=========' F8 k. m; {$ J( X
2 J: B- T' P1 P
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with6 x7 z: B% o2 b
  SoftICE while the option is enable!!
/ o3 O( k) Y9 C# l% H4 A) }1 e; j" ]; {+ Z! ]0 d. ]# y3 F% Y" p
This trick is very efficient:7 G3 W& Q2 i% f
by checking the Debug Registers, you can detect if SoftICE is loaded8 x9 X6 j# o" |2 U; H
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if, T: v1 @/ e" C& e* V. y2 Q# h4 b
there are some memory breakpoints set (dr0 to dr3) simply by reading their4 a1 B7 l5 B- a2 H
value (in ring0 only). Values can be manipulated and or changed as well, t) i+ u9 E0 {- Z, [$ Z9 L' K" F3 I
(clearing BPMs for instance)
- @+ A/ O. O# f( R
- O% q5 F9 ~' v__________________________________________________________________________( G7 o+ u9 G6 q% k9 d$ J4 l. Z

2 V. J1 i* V0 h1 A; m* W$ wMethod 11, s0 B, {, ~& A, N' B( q
=========9 M# S2 P4 [' p* N' Y$ q
' V" B% T! v: m  U+ y
This method is most known as 'MeltICE' because it has been freely distributed
' V9 O$ K+ q* g3 \! B' S$ [via www.winfiles.com. However it was first used by NuMega people to allow
0 f0 b3 E  Y! Z- R% iSymbol Loader to check if SoftICE was active or not (the code is located  Q! ]7 S+ L1 [
inside nmtrans.dll).! k# _0 H9 M: i* y& y
7 ^) Q1 b; x" Q+ U
The way it works is very simple:
$ A- F* t/ U5 m5 Q2 D9 V% ?+ dIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for! B0 Z) c. F; V) a, P. V
WinNT) with the CreateFileA API.
; Z1 z# y3 S" b# b3 {/ @. m* z+ f5 u6 X1 L8 E- C0 k; M
Here is a sample (checking for 'SICE'):% v6 \( l) }$ o  i& m2 C

/ J/ O, x+ t+ z0 N! t, `BOOL IsSoftIce95Loaded()
  @+ H0 ^; E8 v4 V3 M{  `( S  f; A/ H4 X0 j/ M
   HANDLE hFile;  
' {' h$ ^5 B# e4 @0 ^   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,7 r7 D8 g" g. S) F- e+ N
                      FILE_SHARE_READ | FILE_SHARE_WRITE,8 m8 C9 H6 C: O/ e: N* `7 _( m
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
. c) E4 L. t/ {8 l/ \- X  Y* g% g0 O5 O   if( hFile != INVALID_HANDLE_VALUE ). i% _# A& I. D5 L# B7 R
   {- m9 p1 k/ D( `
      CloseHandle(hFile);. N& y. [& ?! @8 z$ H& [
      return TRUE;
& f5 n' N% {4 W   }0 X' C' }' L+ F$ ]" H; d5 n, w/ p
   return FALSE;3 H! z9 _3 C+ u% L7 ~0 f7 b/ o
}
5 P; A0 s' [# Q/ ^# ~# L0 \3 b
( |6 G, ?  ~7 c, t% UAlthough this trick calls the CreateFileA function, don't even expect to be. _- O9 S, P0 y# s' p4 ]' a
able to intercept it by installing a IFS hook: it will not work, no way!' _, h6 L. B: {+ g$ @0 |
In fact, after the call to CreateFileA it will get through VWIN32 0x001F/ [8 x0 s# b' B6 c, l
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
( E3 q/ a9 i: F; z) B; E) Nand then browse the DDB list until it find the VxD and its DDB_Control_Proc2 [; Z# K( o: O* v
field.0 P; v! u, y9 C; q$ G
In fact, its purpose is not to load/unload VxDs but only to send a
% g2 H) G, K! L$ U5 NW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)/ p, T  h: |6 n5 z/ s; D
to the VxD Control_Dispatch proc (how the hell a shareware soft could try, q7 e# u! X* i
to load/unload a non-dynamically loadable driver such as SoftICE ;-)., U" C& I) x4 c- X
If the VxD is loaded, it will always clear eax and the Carry flag to allow) A2 w) B% g" x1 z8 }( o
its handle to be opened and then, will be detected.
& s( _1 _" u/ p; e0 uYou can check that simply by hooking Winice.exe control proc entry point
/ u" M$ @3 c6 a' l8 ^7 mwhile running MeltICE.
& H/ _" q& G  m. x- K' ]/ M; G+ |' a7 v- ]

7 [7 y5 L1 V2 d) ?9 B  00401067:  push      00402025    ; \\.\SICE
# C8 b' G) X8 I0 q; o  0040106C:  call      CreateFileA1 l' O" a# F* O* h0 X( V
  00401071:  cmp       eax,-001
% z! x3 F: g2 w$ ?2 \8 W  00401074:  je        00401091
7 d+ c, {' y" N4 t' \9 r
* s$ m7 `8 b- q$ n" w! o$ m. g* C. x6 `7 w
There could be hundreds of BPX you could use to detect this trick.
8 e0 S4 ^# R6 s& r9 ?-The most classical one is:7 d: i2 i! _0 m! k% A* Z! }3 y+ S
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||0 W6 F1 Q; a* P' S, n
    *(esp-&gt;4+4)=='NTIC'
& g5 a5 A: v/ O. t) S$ o' N
' S0 b6 M8 }9 e7 Y-The most exotic ones (could be very slooooow :-(# Q1 C* t' a! E& }' N4 A# M2 M
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  & w( n" r( Z0 w9 |( t, {
     ;will break 3 times :-(
  t7 ^' b& Z3 c2 N
6 V- i4 I" d+ E& g  G  Z- y-or (a bit) faster:
. n( a2 ^: q$ V0 ^8 ^5 S- a! U- L   BPINT 30 if (*edi=='SICE' || *edi=='SIWV'): m1 M7 n: P/ y0 ?- d6 D4 E; |
8 M2 Y- B, W1 e- o# C+ n" p+ w3 h' ~
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
5 N. [, ]1 j1 @     ;will break 3 times :-(
5 {5 z* c3 [$ G! _5 S. D$ \3 ]1 p6 j: q! W, V3 ^
-Much faster:
1 b' ~' v- n& y   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
$ F; F/ D3 ?( @6 v- h/ |0 R  }9 Q! V) Q" ?- r" A1 M6 D
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen
. P* m; b; f& Z0 ufunction to do the same job:
5 v. l& v4 {) }/ ?+ g
9 C! v( X* u# T   push    00                        ; OF_READ/ K' B- c0 p' z/ w
   mov     eax,[00656634]            ; '\\.\SICE',0) i9 o! H$ u$ O: `6 G
   push    eax
- d" C8 t; O. j) t6 }   call    KERNEL32!_lopen+ r1 M. u9 n) B! M6 D" ]* Z
   inc     eax
2 s" c5 Q0 |, @   jnz     00650589                  ; detected
4 Z* J8 f, z5 X- n# g7 Y+ s   push    00                        ; OF_READ
7 q, U0 H8 l) n1 E; X5 ?9 ]   mov     eax,[00656638]            ; '\\.\SICE'
) T* z% f, m* j0 Z! o6 Z7 N0 c   push    eax% q2 Q" k  L5 E. x; ?5 w
   call    KERNEL32!_lopen% V& e# P' r8 o
   inc     eax5 l, `& e7 W/ x/ v# y7 x( ~
   jz      006505ae                  ; not detected
1 Z- I, m5 d2 ]+ r
" A4 D* _) X3 u# g& ^* p; v
/ d0 r9 t& [  ]4 L__________________________________________________________________________9 R$ l, y8 V' R4 X+ ^5 l7 ~6 l1 C
' q% e4 S3 ^% I# _0 [+ w
Method 12
& c- M/ m) n: j( `) ~  x# Z! r+ \=========
' J4 z  m$ G0 k; O5 @9 Y. ]% d0 P5 T
1 u+ g; P( g" b2 g2 A# I! d  pThis trick is similar to int41h/4fh Debugger installation check (code 05  y. z- f1 z/ W
&amp; 06) but very limited because it's only available for Win95/98 (not NT). }0 K9 z' L" j9 i
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.
9 Q7 _5 H8 O: E+ d6 p; [7 Q0 t3 R9 \, I8 A
   push  0000004fh         ; function 4fh
! A  J+ a- R. ~' I8 M   push  002a002ah         ; high word specifies which VxD (VWIN32)  f2 C8 G/ j- r  `& {$ Q
                           ; low word specifies which service
0 e2 \" a# N, x& R* Q& Y9 z# C                             (VWIN32_Int41Dispatch)/ W9 M1 e/ s! {7 ~) c, h
   call  Kernel32!ORD_001  ; VxdCall
6 G8 N# J  C# D3 J' g7 s4 U   cmp   ax, 0f386h        ; magic number returned by system debuggers
; ^% a" v4 Z( _5 q5 @+ _) ^0 w  G# q7 j   jz    SoftICE_detected
1 W+ |; [! e5 H0 V& ?5 n9 {) Y
9 J- Y0 }- l' B2 k. u1 l6 a+ HHere again, several ways to detect it:
! [2 N/ G7 L' s0 i" w& g$ ^1 K+ h% N+ y  S, v) V) H
    BPINT 41 if ax==4f
) O1 x. r* r( y- K2 ?' l2 u7 j+ z$ K5 z& I) R* N6 J, w+ A
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
3 B! [, c9 ]" y7 b! f( x' \: z' ^  z3 J! P
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A/ }, e! Q: O. e/ o

( F5 g; W, t& O2 u( K    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
  f4 N2 ]- n/ i5 F/ G8 @2 _7 W0 e! N
__________________________________________________________________________
! E6 v  ^) B* T8 [# w$ }. ~; b
! {- J" H0 E7 x& Y: LMethod 13" @" j, Z6 j7 l7 y$ W9 @5 X/ l
=========
5 V/ o4 c# n) R4 }* e: W2 @& s+ S% N
. X6 C3 p3 ^" h! j: e, b3 FNot a real method of detection, but a good way to know if SoftICE is
' A2 f) G6 f+ W' {/ x% y  P, \installed on a computer and to locate its installation directory.
4 J7 t. ^4 ^% `  w) E5 T) |3 r3 jIt is used by few softs which access the following registry keys (usually #2) :6 m0 x- V* q" w8 ^
  y2 a0 d3 S. I6 B; w
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion1 ?0 e( _/ O; z& d9 k+ |' G
\Uninstall\SoftICE. g  \4 l& j# W6 X) c* E
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
4 T8 r( e9 Q" w! Z; z4 `-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion- V' [% A' E2 N9 G5 _% D/ t" z" K
\App Paths\Loader32.Exe
' t. C) L. O" w* ]4 g
5 B. Y) n3 O8 N  e, e( ^
+ O5 T; ]$ t  }; Y7 n% CNote that some nasty apps could then erase all files from SoftICE directory
0 }  h" \& M1 Y( l9 }(I faced that once :-(0 a; l$ x: Z) K' Y

/ s6 X# ?# _1 z# W1 _Useful breakpoint to detect it:
- P, \5 @$ U7 T1 r: X/ ?4 y& N  S1 ]4 L8 Z; f
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
0 C: }5 l+ j, j9 o% @  a6 N1 F7 G4 ^; \; ?1 h, O
__________________________________________________________________________
7 U* ]; D; p& B, g/ X- Q/ o  x& T! ^1 k* s# T
0 u% Q9 A2 ~' l$ z! o
Method 14 * N, U9 I  X' L, u1 g) l! A6 I
=========
) ?" v" t. f8 L# i0 J, Y( h* S
& B- T  t- t& F6 jA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose; R7 B) H$ n& T3 b  U# S
is to determines whether a debugger is running on your system (ring0 only).& F2 c! P' f5 E5 Q" o
; z2 l2 C- V3 A3 o' V
   VMMCall Test_Debug_Installed* x( n6 ^; z4 O* R3 s6 |
   je      not_installed  v2 q9 R$ N3 c2 D! i; x
/ K1 M6 j# C. v0 @
This service just checks a flag.
% l- i6 `9 o5 w' C</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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