找回密码
 注册

QQ登录

只需一步,快速开始

About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
0 ]& K2 ?5 X  \5 c: n0 }2 h5 Y<TBODY>
  @5 H1 B/ P/ X5 O<TR>! S; G4 d- s, m5 v+ `" P
<TD><PRE>Method 01 6 N% [' a1 j5 \; J+ p
=========1 t0 s% o( O& I& {$ u; `: l
3 T+ G% w9 V9 G6 `
This method of detection of SoftICE (as well as the following one) is- @7 P$ Y4 ?+ \- ]3 |2 j% {
used by the majority of packers/encryptors found on Internet.
0 N) K5 `( {, b0 N' BIt seeks the signature of BoundsChecker in SoftICE
, J' X7 L: o! ^6 {0 r1 f& P( ]5 L0 E, h6 F" a
    mov     ebp, 04243484Bh        ; 'BCHK': g& F  E% R; I+ h
    mov     ax, 04h
6 X% Q. T; w* C3 W+ m- Z  q) I! S# d    int     3       & ]! f, H8 p) M1 d9 `) |
    cmp     al,4
, c0 a0 h& s5 x# l    jnz     SoftICE_Detected7 R' m: {$ ^5 \% M: n  q2 A

6 E  q. A7 f+ N, m8 e4 d___________________________________________________________________________
8 j8 R! F$ `, x& B* A- c9 H* f% i: n3 m  @. D# D7 ?, c  f
Method 027 }  e" I& s* K/ E, E2 C3 a
=========$ v8 @$ C/ d9 w7 I6 w* R& l

2 |' K$ E, o4 r; x# j% H6 ~3 U! CStill a method very much used (perhaps the most frequent one).  It is used
  \/ `* N$ n1 @6 R. G/ v# @to get SoftICE 'Back Door commands' which gives infos on Breakpoints,
: I- t! w+ n( }8 N" H$ Sor execute SoftICE commands...) P$ J; b3 B" M8 r
It is also used to crash SoftICE and to force it to execute any commands
; c; _' M6 r% u3 p% p5 x(HBOOT...) :-((  
) h' p& W( u: o' [" n- S
6 x4 k* {6 K) k* Y5 H( j+ e: `Here is a quick description:2 {8 M+ @$ n  M3 S
-AX = 0910h   (Display string in SIce windows)
7 J5 _1 S7 Q, X, y) ]. Q2 [1 ~3 _-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)# D6 @* I2 z0 [6 }5 _& v; Q
-AX = 0912h   (Get breakpoint infos)9 L6 r! T; k* W0 b$ G
-AX = 0913h   (Set Sice breakpoints)/ \1 `% A! {! X) u, R) G$ h+ H( `& V
-AX = 0914h   (Remove SIce breakoints)8 ^4 Y, k$ e) A( q
) \! k. _# i) _
Each time you'll meet this trick, you'll see:5 ^8 Z2 S* K' Y# A
-SI = 4647h
9 E9 V% ~" Q2 h& x-DI = 4A4Dh- X- y; T( M+ _  e% z
Which are the 'magic values' used by SoftIce.- k$ M5 m& W* b% J
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.
% ]" d1 N( b# v+ d$ S, I1 j& E$ F( F+ f% P) a
Here is one example from the file "Haspinst.exe" which is the dongle HASP
% _4 j/ J" M0 O4 q7 v' ?Envelope utility use to protect DOS applications:* E$ L' L( E8 e" T4 [8 T
/ Q! Y! H- G: W  ~/ k0 w, A/ o' f: O
3 G7 _6 U" \9 n4 q3 `
4C19:0095   MOV    AX,0911  ; execute command.) O2 n# _$ S1 Q: F
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
2 m, H+ r6 |2 F8 h- K/ e, x4C19:009A   MOV    SI,4647  ; 1st magic value.9 D$ p$ `9 m; A" ^" t
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.9 z) f8 k+ v* s* u( u3 e0 l
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)0 v9 @8 E; T) E/ S
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute1 l  F9 Q, }4 n0 A
4C19:00A4   INC    CX
0 j+ C! V6 ]) [4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
  X; ]4 B: d2 h+ G, y5 ]& |0 U4C19:00A8   JB     0095     ; 6 different commands.
2 {. n$ Y# r: Z- f7 v( y( Z: i) M4C19:00AA   JMP    0002     ; Bad_Guy jmp back.  y! J7 e7 Y& N; \; U% h
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)& c4 ~8 A7 n' H6 Y6 V

$ o. e6 z2 Q6 Y5 t$ @5 K% r: RThe program will execute 6 different SIce commands located at ds:dx, which3 K, O0 w" y+ }
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
* S8 o3 G* c& d% I8 w0 ?4 @8 S9 q: n  A% T4 q) K3 C6 y9 Y5 Y
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
4 A' i/ D; u' Z7 Z5 d___________________________________________________________________________* d6 \6 M% |& }  g( P
+ a/ _4 Z. N4 E1 }, G/ \
& D. n/ x* F6 S
Method 03
7 F' d  @  p- S0 m0 |' H2 m=========  X) e4 `" {) B/ ~0 ^) ~& m; E

4 H& @8 U1 }1 l) y( U& c$ O$ FLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
2 J3 X0 W: S9 z+ y# E(API Get entry point)6 U2 L$ `5 s' W. V/ r: z
        
# F4 Z, O6 |& w: ~% J4 B  H
' ]* I+ A9 X( ~2 V4 H    xor     di,di
  ]+ a7 g8 u# ?+ t0 g2 x1 i" z    mov     es,di. T' }! M& B, C$ S; t
    mov     ax, 1684h      
0 W& S* o$ w8 e! P$ P1 g2 [    mov     bx, 0202h       ; VxD ID of winice0 A/ q7 s3 A  X+ J
    int     2Fh1 M: \/ i" s4 i+ K
    mov     ax, es          ; ES:DI -&gt; VxD API entry point; p2 e! W( c% z8 ~( q
    add     ax, di
. u, q) C# {- n    test    ax,ax
. X9 c! b! k+ N2 q& \    jnz     SoftICE_Detected
, {# {: o4 s5 E* ]* g  F/ ?  G' q- @1 g9 B, j* v
___________________________________________________________________________
2 O' \: {$ E' w4 k/ t& T. m
" d, Y0 W1 t7 w2 G) kMethod 04. F, U* N& L6 ^. ~' p) ^4 x& ~* k
=========
4 C9 n  g9 }  e; z, U0 r0 }1 E2 ?) w" S$ W4 Q1 c$ e$ H/ C. ]  y5 I
Method identical to the preceding one except that it seeks the ID of SoftICE9 v& a% t2 }1 q! R7 r8 w) W( k
GFX VxD.
# F9 V' P+ t' G2 I; l
9 {, l, w$ s; @3 Y    xor     di,di9 L- V3 W3 }- Y$ @
    mov     es,di
& u. v0 f" `/ ]! P0 P* B    mov     ax, 1684h      
5 I9 u# S0 {1 n& W    mov     bx, 7a5Fh       ; VxD ID of SIWVID
  y+ |+ k3 H: W; K  @2 M( Q' |. g    int     2fh- F; I7 N! e8 L. W/ O
    mov     ax, es          ; ES:DI -&gt; VxD API entry point5 c) n, S) k0 A3 F
    add     ax, di. K( e3 T! B  r% O8 K( O# j
    test    ax,ax4 d: O) t/ v( Z; H
    jnz     SoftICE_Detected8 X% R) s$ z+ P+ ]: ~& h  n, E# v1 {

5 L3 x; g; h( D7 k, x1 Q__________________________________________________________________________* p1 V! ]  b; K9 p
  `$ {$ U- g0 Q$ Q( b5 L7 S4 x

6 r; K6 \& h! q* m! K, h' e! z# g: gMethod 058 u4 p" _! u" |9 T: X/ |/ d$ n2 E
=========
% r$ _6 n5 Z# k$ l7 x6 v5 m" [7 a" S: a. a- N, m' g  r, m
Method seeking the 'magic number' 0F386h returned (in ax) by all system0 x9 m6 G7 D7 ?/ ]- d
debugger. It calls the int 41h, function 4Fh.
, K  r! k- \* r- RThere are several alternatives.  . a( V. o) k. @

) f# A2 d8 ?! U% r9 N6 R5 G5 FThe following one is the simplest:9 V6 ^1 S9 q* m
/ U/ V* J* y6 p6 J5 f5 H2 C( b9 h
    mov     ax,4fh
1 i) O5 ^( k* @" l) W    int     41h
% p; ~/ B+ p& j9 K    cmp     ax, 0F386
6 g, P. L! }% r8 u3 j2 T    jz      SoftICE_detected
$ c/ U& [1 d1 }5 M
; u7 X) Z% l. y3 q& i" k( c$ g( t' [5 p  L$ d! r& ?8 _
Next method as well as the following one are 2 examples from Stone's 5 B7 L' V2 l1 }# f) y$ p) |2 S
"stn-wid.zip" (www.cracking.net):
$ t2 F) N/ ]$ k, j% r9 ?; ^9 O0 u* ?+ u, m- h' D- [: m6 E. A
    mov     bx, cs# B7 P+ Y4 a. t, J
    lea     dx, int41handler2
0 G7 j: N  H! _9 j: Y    xchg    dx, es:[41h*4]
# ~" Z( }4 C5 G% k9 v0 H/ g    xchg    bx, es:[41h*4+2]
. F/ l# o3 ?' D4 @$ _' k    mov     ax,4fh: o( S$ j5 d1 [
    int     41h4 Q' E8 t% m8 O1 S3 B& i/ a$ E+ t
    xchg    dx, es:[41h*4]; {) K. L& v! J4 @! O: Q& l, i
    xchg    bx, es:[41h*4+2]1 n/ i7 z/ K8 [* k0 f$ ~1 g0 d
    cmp     ax, 0f386h0 q, ]$ \  K- y  ]4 R
    jz      SoftICE_detected0 Q) A/ V1 k6 K* H& ^
7 w6 E$ H& G5 K% B% J
int41handler2 PROC
2 `1 U9 i. W, V; @% X' e$ D6 x    iret
; U2 E7 \3 E: V0 K1 Mint41handler2 ENDP7 Z. J4 c2 V0 i4 _8 E
# h0 A7 K' z% ~0 ?
& w2 v% }* M! Y& }# R  q; W4 E" p
_________________________________________________________________________
' p8 @; g1 V  D6 v2 N+ P6 d; t4 {. \! ?6 y: s" k8 a5 x: }
; f/ n- J) Q. e' y0 \) F
Method 06
: \1 [9 @  V& k8 Z: M=========
6 A$ s! \" L8 Q+ v# w, H
% N! p# ], c% R. H
" p; _0 H$ X  |2nd method similar to the preceding one but more difficult to detect:. F  N, Q0 \1 F4 m* h

% h0 s0 z! O# d$ O( _. v% e- m  ?; g: C0 s* a
int41handler PROC5 h" [+ b% b$ J! Q% t3 O
    mov     cl,al
+ N1 M( [0 V% U# C* x$ N& s# d    iret
" Y: n0 g9 W+ S$ z/ U  W$ gint41handler ENDP
: }" s+ d* C4 r) b7 }2 b9 H- C% z: K9 ?6 m2 z
# \( V* k( J; W9 F( x+ A0 {+ N2 W
    xor     ax,ax
# X# L1 M5 `2 j& L    mov     es,ax1 i+ v% B+ g4 Y2 Y* |! U& s
    mov     bx, cs
* p9 {% P4 ?4 T    lea     dx, int41handler) l0 C1 n- p$ a8 \; j, ^) B' G7 R
    xchg    dx, es:[41h*4]
, F( ^; c- z- k! L" m    xchg    bx, es:[41h*4+2]
; C$ l9 K- o$ H  K+ s& D* j' k    in      al, 40h
3 |& i% K! T2 i7 D4 ^6 z4 {3 D    xor     cx,cx% e, m& f% n  @4 D2 b
    int     41h
% V( c. J+ I1 S+ j- N  Z+ @    xchg    dx, es:[41h*4]
6 H; V) [) X! v% C7 g, I    xchg    bx, es:[41h*4+2]
/ p2 I' S9 b1 }) M    cmp     cl,al
: Z2 [' T9 O! [; j% P    jnz     SoftICE_detected! L" r( Y: u8 q, U) o, a% Y" ^2 S" N
: X, P2 o1 e: L+ ^
_________________________________________________________________________9 F  _. v; m0 Z9 x. _% `
; |+ v" k! z. X3 B9 g
Method 078 F( Z1 l) K2 J0 H% B. s7 s
=========
. |3 P- m' B: @# O7 y- d; b0 i; T& l7 `& \+ G
Method of detection of the WinICE handler in the int68h (V86)
. D: h7 K6 H8 _% J0 d' N: y$ O0 G) O( i% ]( A
    mov     ah,43h  Y; `% Z% w$ _/ |% G& U* N& R
    int     68h7 x3 v2 d9 r5 y! d: J5 Y
    cmp     ax,0F386h5 u" T  u- a, P0 [
    jz      SoftICE_Detected) g8 p8 A: V5 ^; W) ]$ u

0 E. M- k; F, y& X  l0 e% X4 `8 p  u# S9 Z7 e8 _
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit( N6 ^- M! |) K* y
   app like this:  U" D4 h) a# T0 }7 w; o& z8 e
' M+ Z- G8 O4 A
   BPX exec_int if ax==68
6 ?" S: W5 j, t. f/ `# ]/ y7 |   (function called is located at byte ptr [ebp+1Dh] and client eip is
6 d5 c0 m7 ?3 i   located at [ebp+48h] for 32Bit apps)% j3 _  I2 {! M4 p) r9 n
__________________________________________________________________________
! J' }9 {2 h$ `4 P
- H- H/ `6 H" r. X5 Y' r6 I/ P& ^6 _6 Y- l+ O7 i& o) K9 j& @
Method 08
6 R! T( H3 }5 W3 v- G* X=========7 E* o! X/ }: C/ ?( H

# W3 }1 H2 Q# m% yIt is not a method of detection of SoftICE but a possibility to crash the
% ]- Y  Y# [9 L3 b) dsystem by intercepting int 01h and int 03h and redirecting them to another
  d" ~! v! i7 {$ ^" o! h1 a5 ^% Yroutine.
! s* K  ?+ d: z$ s6 ~2 X" H5 wIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
$ W) D  x" `2 v; S* `5 Q( r# sto the new routine to execute (hangs computer...)
; L) k4 s7 \1 ^5 U& U( k" b; W. L2 H, o+ a. m
    mov     ah, 25h, Y, {. Q5 n& w- Z( O3 [
    mov     al, Int_Number (01h or 03h)
" X4 c  B7 |& w2 l+ w- l    mov     dx, offset New_Int_Routine% m1 ?) ]% k, s' q7 J4 d
    int     21h6 E6 J, c& q3 Z0 t2 X
( X9 ]/ |6 A1 T
__________________________________________________________________________& y0 l- ^1 {7 W, E' Y
  r6 d5 G4 C$ N& j9 L0 u( \
Method 098 r! P  A2 W. m: _
=========3 G: _; L# R) @/ P) Y
2 x5 S3 O; I  E* J4 k; u- R  B8 l
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
) t1 f& \# U8 r, Iperformed in ring0 (VxD or a ring3 app using the VxdCall).
% V. E1 C) h& ]4 NThe Get_DDB service is used to determine whether or not a VxD is installed' y9 e" N: w" d
for the specified device and returns a Device Description Block (in ecx) for
3 K, ]/ |% }: C4 Z  J0 ]0 V; `( nthat device if it is installed.
9 g* _# w# c  _: y. r3 x+ O- F3 s+ ^3 ~+ n
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
, U, d! I% U3 u* {, k2 b, c( r   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)6 f8 }9 D% S& H# `( [/ K
   VMMCall Get_DDB
6 Q8 v7 L* |! A, t8 b8 o$ a$ O   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed. o) X' H$ F/ j" V& @/ y

2 k. W( S3 M9 E! `! rNote as well that you can easily detect this method with SoftICE:
  V6 O; e0 E# m8 G5 [0 [3 m   bpx Get_DDB if ax==0202 || ax==7a5fh
% ^! W+ W+ ?" `+ o7 n0 g+ b1 U9 c  J4 V" H
__________________________________________________________________________# [+ H/ [8 p) b8 r% t% g2 ^  @$ E2 N

+ d. M& p3 o+ |2 W2 K' k3 j& R' B& qMethod 10
( w, q; @5 _* Z+ h. f9 V=========
( b  W- {* @: V% N4 d! K) e
) X2 _7 [: Y0 w4 o* g=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
( l$ p, c. g, o$ {$ y  SoftICE while the option is enable!!; J. T/ L3 p0 [8 X

8 h& C  ^4 |( S$ B8 qThis trick is very efficient:$ v; }9 I1 a, M& V, O# o( K
by checking the Debug Registers, you can detect if SoftICE is loaded7 p) e! `: |+ T; U+ T3 k+ u& Y3 w
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if8 T7 J' [# r: r
there are some memory breakpoints set (dr0 to dr3) simply by reading their
6 E0 G& y  }8 o% ^( s3 |value (in ring0 only). Values can be manipulated and or changed as well7 A$ h' A$ {4 l7 s
(clearing BPMs for instance)/ @& o% K2 D, k  w- b+ f& r
1 b5 n. p+ T9 u6 u" ?8 F( ~$ u
__________________________________________________________________________
# f0 q6 q# j4 h& N( p0 L: r; X
# m$ F# f' g' Y+ z% c; nMethod 11
" B3 k# `3 W/ d=========
' e8 Z* ?9 B6 Z' U3 l3 U
9 ?, g& M  i- {- }7 r% LThis method is most known as 'MeltICE' because it has been freely distributed
* n; V- b0 ]( C8 lvia www.winfiles.com. However it was first used by NuMega people to allow
3 a! d, m% w; L$ K. NSymbol Loader to check if SoftICE was active or not (the code is located
+ n+ a7 ~" \8 N* r+ l! b: jinside nmtrans.dll).
7 ^2 }& j1 j/ ?/ Q* y
9 g  @% r" @5 h) YThe way it works is very simple:
5 U3 o6 G0 f7 u7 LIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
4 e2 h+ \; W4 m4 L, y. g$ i: D# b# l- rWinNT) with the CreateFileA API.( x* }7 ~; u. r- N

, l9 \% A6 e* r$ HHere is a sample (checking for 'SICE'):
& F1 z  _6 G* v  Z" `7 k& N" j. {: i. b5 D7 u
BOOL IsSoftIce95Loaded()
9 t3 C5 b) h2 _! |{
4 F$ u" n. H0 C' g# w. }& a   HANDLE hFile;  % n) q; S: U" u4 _3 x6 v
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,$ Q8 b- K' s; S) I
                      FILE_SHARE_READ | FILE_SHARE_WRITE,
- ~8 r! F  l0 h. a                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);$ h* C# N+ g+ U) n6 {
   if( hFile != INVALID_HANDLE_VALUE )
% b# n  y2 N! m   {
7 o( H# A' j5 @; S$ b% r      CloseHandle(hFile);
, [! J1 C' E% N3 |7 K8 t) t7 @      return TRUE;
! E- ]$ k, y3 I& {. v, \   }+ S# c( U0 d! u# c: I' o
   return FALSE;
7 X& s0 J3 E. o6 y& g- [+ w}3 L1 E4 V9 D& J+ U2 L4 d
- T$ K$ L, X7 G4 V" i& Q( }
Although this trick calls the CreateFileA function, don't even expect to be( t' _/ Z$ I- W; A+ d+ w
able to intercept it by installing a IFS hook: it will not work, no way!
4 O* M# U9 W0 W# o" B5 L/ sIn fact, after the call to CreateFileA it will get through VWIN32 0x001F$ v2 S+ N- i( K5 c5 }& W+ ^
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)3 X0 Z) O4 x5 }: E) y. b& u
and then browse the DDB list until it find the VxD and its DDB_Control_Proc
6 v$ J4 H  I! O. W  R3 [field., }/ ~4 q* }* R4 @5 v+ _
In fact, its purpose is not to load/unload VxDs but only to send a
' r$ f, w: r7 e4 }- i0 ~W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
: }% h! q) z! u- P0 Ato the VxD Control_Dispatch proc (how the hell a shareware soft could try0 F/ W$ o. s$ m4 L
to load/unload a non-dynamically loadable driver such as SoftICE ;-).
3 @3 B: V; z& }" u- C! iIf the VxD is loaded, it will always clear eax and the Carry flag to allow
; W( b7 V. E" x; t3 eits handle to be opened and then, will be detected.
: \0 K9 x3 ?" s4 B- }$ j: @! fYou can check that simply by hooking Winice.exe control proc entry point7 K- C# N; j: L  h5 r
while running MeltICE.  c7 X# Q. s( W" ?! ^4 y

  V# t8 R3 p$ n! Q' o' s/ E. q, T7 p; P
9 }. w* P2 Z. }3 l  00401067:  push      00402025    ; \\.\SICE! u5 c  G, E1 J, Y6 p6 i# ^
  0040106C:  call      CreateFileA) @. e; T6 W6 T" n1 X
  00401071:  cmp       eax,-001
5 ?. W8 Y# t. H: L  00401074:  je        004010913 u. U6 k0 M0 P  Y! u3 C

1 ]5 c; R6 D# v  q! H$ Z6 H8 r/ P7 c) g0 J) O' }1 ^
There could be hundreds of BPX you could use to detect this trick.; X8 a! I( _2 m1 }0 D- y
-The most classical one is:
" N; X+ E5 _; O  U2 M7 Q  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
) M# E/ B# F9 Z. V  ]    *(esp-&gt;4+4)=='NTIC'( K. _/ k. W, h+ m% w3 N

$ C- J" a3 R; @; _- a-The most exotic ones (could be very slooooow :-(6 A0 |. s5 |; O( O
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  ! Y8 H4 U5 h9 x$ o( {
     ;will break 3 times :-(% p) S5 ~8 @: [( x2 |8 v" u; N4 c
) I/ ?8 t- \3 A$ a% V% ~# I5 `. r
-or (a bit) faster:
' l0 T! w1 I. A9 C! W. @, Y! P   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
1 f% G& I  p+ X$ G% u4 M
; ^( f: T7 H0 b" v. F5 \* m   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  5 }! [% [% X; l' v2 }3 O' v
     ;will break 3 times :-(
: {, W- @4 \6 f/ j; T/ r6 D3 W( Z3 [6 h3 M5 }1 Z
-Much faster:) x4 K0 r) {/ d* `3 ^0 r
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'7 P0 j% G' ^2 w0 }) o8 L6 t

+ X5 ]6 _/ u7 K, x' ONote also that some programs (like AZPR3.00) use de old 16-bit _lopen$ X7 t) v( I* u' r" h
function to do the same job:5 I: q9 Q' _0 y6 j4 o

, s, ^4 s  |8 x   push    00                        ; OF_READ6 W% Z; P$ x$ J
   mov     eax,[00656634]            ; '\\.\SICE',0
. @# L" _2 a1 u' x. |4 y- P, Z   push    eax
; E: V+ l1 n& s% Y, ~. d' q   call    KERNEL32!_lopen& @. F* m. `1 w! I
   inc     eax
" x# ~+ s9 g$ B  T4 Q4 f- W3 Q   jnz     00650589                  ; detected: e5 G- H! @' A
   push    00                        ; OF_READ
6 V) r( m$ W2 v& a0 t   mov     eax,[00656638]            ; '\\.\SICE'
6 ?/ L: D+ d0 X/ Q   push    eax
# L! O" R4 Z( W! v4 q   call    KERNEL32!_lopen0 A/ a' g/ e) p  d- e' y
   inc     eax; x* `) y6 R# K* e' ?; s( c' I
   jz      006505ae                  ; not detected
3 H5 R0 ?* Z$ j5 B3 t! C  x
; m/ p' {5 t! w' U, z+ |
# Q$ U0 _$ |: {% u; j" Z__________________________________________________________________________
' y7 x8 |* G& ?  q4 B: t6 w; h: A2 z
Method 12" K5 y- I: H# A% _
=========" D2 P$ t- e2 D, F7 Y6 |7 j
0 U8 c7 d  }2 ]  A" c$ S
This trick is similar to int41h/4fh Debugger installation check (code 05
) x& p1 N/ z2 A0 a: @0 a; ]&amp; 06) but very limited because it's only available for Win95/98 (not NT); R3 h& G5 w& `- M7 e: d
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.
# Y1 o( d- b7 Q3 r! |1 t* }$ Z+ E3 b0 i" q& I
   push  0000004fh         ; function 4fh- I/ Y% ~$ l0 E: p4 x5 o, `" N
   push  002a002ah         ; high word specifies which VxD (VWIN32); Y6 ?% h; A/ J  n4 Q; K
                           ; low word specifies which service
0 c: n7 E" @1 Y9 t% }$ X- V% m                             (VWIN32_Int41Dispatch)$ g: }( Y; s# ~9 Z
   call  Kernel32!ORD_001  ; VxdCall
" e1 h4 B4 @" }, `   cmp   ax, 0f386h        ; magic number returned by system debuggers
$ {- e4 k: [4 L2 [) u" u, o   jz    SoftICE_detected; ^. g$ V% w$ L+ P$ v, S- s& v# v6 w
) A- a1 w9 d( h8 f2 ]3 C
Here again, several ways to detect it:
; V8 j! u; E) T) l7 P' ^, A8 R. p, Q( W8 F& y: r. u5 T' @
    BPINT 41 if ax==4f! `0 z5 L, o5 J1 c+ E. J( u3 w
. i# H- R, M0 v4 x  H5 p
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
5 ~. x. ]" ?2 O# Q: {5 d
' _1 y- O. j: `    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A& B$ {& A( ]* m

! l# }6 [; m+ L  C& z    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
/ f8 ~0 O# U2 j! q% o; o5 o# X/ |1 g' c1 q4 i6 t
__________________________________________________________________________( G9 k7 {; N  y& K

6 @/ {( |" n2 W- k, ]Method 13
- c" _. p; z/ a, d=========. B) a& A6 g3 P8 c* K6 g

9 Z4 B' I/ ^2 u6 O  rNot a real method of detection, but a good way to know if SoftICE is* s; @) e9 ~. S4 P( H
installed on a computer and to locate its installation directory.4 h" M' ?+ q  c, s, m* k9 w, S( Z
It is used by few softs which access the following registry keys (usually #2) :
  D, {% R9 S( R- c; V6 |0 C: d( F5 E
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion' q1 A9 z1 D% o! J2 u
\Uninstall\SoftICE
' H7 y$ R+ r: S4 X4 H-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE, {- y' y% i: O6 y/ M+ B# k" A2 S
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion! }4 W* v& l4 z8 |2 r
\App Paths\Loader32.Exe
6 F8 u' K. k( n7 d; q/ _2 M# T! a( H& _! a
+ {& r) T& v: P+ d4 Y( V8 z
Note that some nasty apps could then erase all files from SoftICE directory
6 r- q7 A1 v' s  @(I faced that once :-(+ w  v2 Y" f7 H4 H

  f' p% C- s$ z: S' J8 vUseful breakpoint to detect it:
" x6 \5 z& g( l; G; c4 J3 v1 c4 v. M
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
" z1 g& B8 u; M7 i& R& f, w$ _) k- W3 p$ I
__________________________________________________________________________. n6 }, \- Y; Q

5 e+ J4 Z: j* p& B
7 R: P) [  `/ N. I5 OMethod 14 ) ]+ q  M) T4 W9 I+ q
=========* m5 t' o, t) n6 t2 |$ }
0 b; s8 r# `& r1 m
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
, h5 R* i0 G# H2 r  N0 Bis to determines whether a debugger is running on your system (ring0 only).3 S  P: w& P- ^* X8 B1 @" Y# l: w
2 ~) b; k1 \) R, z6 O
   VMMCall Test_Debug_Installed4 D3 I0 W% U7 l$ {: H1 b
   je      not_installed
/ \8 {! c' u5 q0 c  e; _1 Q* ^" B. K% Z/ H! F  Q' V& Q( b
This service just checks a flag." n7 P3 u, Z) S8 ?, {
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2026-7-24 17:59

Powered by Discuz! X5.0

© 2001-2026 Discuz! Team.

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