About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
) w+ N; h: h$ ~( e& l<TBODY>
* L* w! q; R9 P$ o3 u! p  `, [" n, a" v<TR>
1 }6 J# K; B3 t9 j- X* f! H5 \" ^<TD><PRE>Method 01 5 v# y" C5 [2 t8 f
=========0 Z. B. i2 s; \% @$ f

) I3 q8 @3 L) M6 E6 k9 j, e, ?This method of detection of SoftICE (as well as the following one) is) {' d: }/ |6 _8 e: G7 y, A; N* Q1 h
used by the majority of packers/encryptors found on Internet.8 a+ B. X6 k# R9 o- F" G, ?
It seeks the signature of BoundsChecker in SoftICE
* J! u- S( H. w, \3 G' ^$ {9 c* x
    mov     ebp, 04243484Bh        ; 'BCHK'! h+ M' n( z  N/ u9 O" @
    mov     ax, 04h6 g# R* b/ @: k! w; P' I8 c7 y
    int     3       4 b) W& G0 g: @2 X$ w; d0 r
    cmp     al,4
' m% t7 e9 U, w( [( L    jnz     SoftICE_Detected
, V: s+ N, p9 Y  v+ B/ c
0 E4 o! x/ e2 D$ b___________________________________________________________________________# o9 G/ X8 }, Z9 v6 s7 N4 p9 ~
  w4 g2 G. k8 c5 _, L
Method 02& o7 Z# o) {* g/ g) ~) N
=========8 ?* r( V/ Y7 }+ d' C+ `2 o3 y
+ J2 G( n9 [6 R) T  J6 W+ z
Still a method very much used (perhaps the most frequent one).  It is used
* V( Q: c  C; h, F' Pto get SoftICE 'Back Door commands' which gives infos on Breakpoints,- P! j) J- j' F6 `4 h6 U/ B
or execute SoftICE commands...
* Y; ]" `0 O* |5 G) ]/ h+ |; xIt is also used to crash SoftICE and to force it to execute any commands/ c  }% r/ d- }! e% L% L
(HBOOT...) :-((  
& A8 H& H6 P! @& u
: N0 L; S9 G, k) [7 ~# C* hHere is a quick description:2 @4 J: h2 @- g' v* o& D
-AX = 0910h   (Display string in SIce windows)2 n( j! |) |: h$ L0 j
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
  J# n2 O  f. S-AX = 0912h   (Get breakpoint infos)
( t( N8 x( C- K  M) d  s) M# g6 N-AX = 0913h   (Set Sice breakpoints)
2 u5 @; X" E$ e- ~" t# p. K4 M-AX = 0914h   (Remove SIce breakoints)* I  i: ^: \" w

. j: M. c( g  o/ b9 ]& I/ l7 PEach time you'll meet this trick, you'll see:
! }6 D& Y; i; F9 j7 [* v-SI = 4647h- V! `$ G6 Y# J: V5 X0 P
-DI = 4A4Dh
* U4 X0 v$ c1 m0 X1 ~Which are the 'magic values' used by SoftIce.& v* m4 q6 H5 ]4 a* ?5 e
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.. l1 N' Q. m# f
% c; h* k+ c, A3 \+ o$ q, S
Here is one example from the file "Haspinst.exe" which is the dongle HASP
0 F% H# ?( O; i- E1 f( xEnvelope utility use to protect DOS applications:8 [: v/ w) u4 k8 j9 L; T5 _# `) B

( j. \% H5 z8 a6 p. D. t! s0 d; k: G( C. [; f- E- E" m) h
4C19:0095   MOV    AX,0911  ; execute command.
, b1 ?, t$ b( u$ K( |; T2 h1 h4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
  _$ |& O' K4 q. s4 A$ ~1 w/ W4C19:009A   MOV    SI,4647  ; 1st magic value.
/ r# B# R4 X; x* {+ u9 H9 {! c4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
, I# }/ e$ W5 z5 ~# v7 ]4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
0 z! }  A7 T, M4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute" o" J& M9 R' j3 T. Q" p9 v
4C19:00A4   INC    CX
1 y& D1 l" o. c2 s9 `4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
. ]8 W% S" t6 c* R. @4C19:00A8   JB     0095     ; 6 different commands.
9 d; A$ L% q' X8 i: o9 ~4C19:00AA   JMP    0002     ; Bad_Guy jmp back., j; p' ~, ]  s3 b2 Y
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
& {: e( n8 M3 i0 C5 R' j- ]1 Z/ x  v$ K
The program will execute 6 different SIce commands located at ds:dx, which
& w; x8 a& k6 uare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
, l) H1 j4 Y$ T. L3 o& Y% v9 r
" q9 _& v: t3 u) N) T* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.: H8 p: q6 w3 Y8 U" L" a0 ^4 d& k
___________________________________________________________________________7 w$ F& f3 |3 S$ x( _1 D! W7 `
% R9 F4 h- F; B# E! `: T; X

" Z) I' N" Z3 ]Method 03& J/ ]# n$ F6 ^6 J
=========/ M7 X  k0 K" L9 r2 N
7 `" Y, j+ H# q$ D8 u9 M( A
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h( X! g- F1 N1 w& t% O+ M' O) D
(API Get entry point)- m% ]3 u) p/ D% F0 d& }
        
0 i4 n( `4 e4 m) f" o, B( D% U$ R- c* }6 e
    xor     di,di+ b: w+ y8 W2 B& t. W4 y' `
    mov     es,di3 L  H5 F4 Q: F2 z
    mov     ax, 1684h      
4 E5 `* ~9 a: M9 I$ L0 r    mov     bx, 0202h       ; VxD ID of winice
+ o  v! _! v$ F8 o9 U. b2 x    int     2Fh
2 p2 q6 ?7 e0 `$ d9 g' O    mov     ax, es          ; ES:DI -&gt; VxD API entry point
% v/ g  q0 E' H1 `( M    add     ax, di' l6 f. m2 I% r
    test    ax,ax
# U) }  g: {* V3 O, b* ~' c: y    jnz     SoftICE_Detected
( D) ~* }' W6 D* M( _) E' \% y- x6 o3 h+ P3 O" h0 o
___________________________________________________________________________: Q2 e2 T5 {) l  O7 q, \

( s% V. ^) P! ~Method 040 j) Y/ B3 n5 ]& X' V7 p
=========
+ X; m0 e; \3 j# |- \& K9 S1 O. b8 N  x) Z3 B+ c
Method identical to the preceding one except that it seeks the ID of SoftICE
; F9 N/ b  q5 ~- kGFX VxD.
. T& h5 m" `! Z5 ^7 ~" Z
9 [1 {& W8 i0 F- K' m0 d1 i* G    xor     di,di# e) y7 `( |3 \
    mov     es,di% _/ K- ^2 @% }- S) c
    mov     ax, 1684h      
* b" `! L, i* E  \) h6 V    mov     bx, 7a5Fh       ; VxD ID of SIWVID0 |6 {( g) U9 c( l5 ~8 {. O
    int     2fh
; ~# {+ s* q; e( Q0 _- m# P    mov     ax, es          ; ES:DI -&gt; VxD API entry point
2 Z& `7 B5 S1 o: a+ T; N* o9 R    add     ax, di) o0 _! {& Y5 J. g
    test    ax,ax
1 M3 \5 x/ R, x8 ]    jnz     SoftICE_Detected
4 `0 G$ ^" S% J8 V/ ~8 a: b! x8 j+ s  u( t# \7 y+ m, _
__________________________________________________________________________7 K; U- V; f# T# Z$ j: ~- W
/ C) M0 F/ q" t1 c2 Z

( \( x( A) A0 P8 o. g2 \% h0 _$ oMethod 05
8 c9 l9 N# W5 Z=========# X* A$ p& v3 N5 W# k4 o9 Z8 i

$ X1 Y8 j: U# K5 I2 E7 G3 \Method seeking the 'magic number' 0F386h returned (in ax) by all system
1 m. Z3 _) }) ]6 qdebugger. It calls the int 41h, function 4Fh.
: Y+ p0 C% d5 o# h1 L( c, @2 KThere are several alternatives.  
; M2 q8 w9 o4 b: y( C5 T% ?, p( N* ]2 f5 U
The following one is the simplest:
+ Y9 K+ q* U# d% H# K. `( K) m) ?5 |# G
    mov     ax,4fh, w- o- g3 }3 c: _* ^. X
    int     41h
& J5 Y8 ^, D- u7 [3 ?- r    cmp     ax, 0F386* ]) G0 }6 Q+ u7 z" C6 [5 r2 m
    jz      SoftICE_detected
- |* f& F  R6 Q! L% K. ^0 }# y9 P+ M0 u/ R! s- P1 U

7 G4 V+ [  P; ?* @Next method as well as the following one are 2 examples from Stone's 6 Y6 |& i/ E; J9 W7 n4 [  i8 e
"stn-wid.zip" (www.cracking.net):8 K. _9 H. Q, ?$ j

& m/ z6 O6 S/ @! ~    mov     bx, cs
3 v) ]! A3 [. E" o9 r    lea     dx, int41handler2
- W' s& h1 s5 t. x  G. x! H    xchg    dx, es:[41h*4]/ I! T5 `: K% g9 u- p/ t0 G8 @
    xchg    bx, es:[41h*4+2]* t) m+ l& ~, j; ~8 [! {
    mov     ax,4fh
. T! S, o/ r  \4 E# V$ R    int     41h
9 ?3 A) t$ V: t) ^" i- @& ~    xchg    dx, es:[41h*4]  U8 I4 K4 B) B- w" }* x7 e% t( {
    xchg    bx, es:[41h*4+2]6 q1 i& O4 z" ~% Z0 M
    cmp     ax, 0f386h
/ ^4 G+ A: S/ h; N  x$ V2 a$ t9 U    jz      SoftICE_detected: c" M6 k" V# D

1 ^8 ]4 M/ ?/ V  E' ^int41handler2 PROC
, S* C9 m- Z& u: ~  ?# v    iret
3 P: C0 p+ w, K' |8 u* X5 B! B, Oint41handler2 ENDP
7 @' F; ^6 E- l" C( T$ `  d) a
  n+ }) y% J# x8 X7 w8 Y
2 M- e/ a9 q) u7 ^( Z1 R_________________________________________________________________________( ]4 J5 Y* \2 N4 j3 Z7 M4 v

$ N2 X0 P7 U6 @% W  Y) F  Z, B$ a; P" X" \
/ b: ?4 J7 m) H# b4 {' _' wMethod 06
- v/ f" }" w; }7 F=========
8 X0 p8 ?( }1 s( Y# e- `% n5 ?; D5 A3 i3 q

9 _7 y& I! w# R9 k  n; m$ Z2 v" d2 F2nd method similar to the preceding one but more difficult to detect:' L6 p( G8 E0 U6 {4 h
' X& M" l9 G- Q+ A) R
! g9 p7 T, a5 F% ^# `
int41handler PROC" W4 w- c0 G5 F7 W
    mov     cl,al
7 `- c7 ^5 o8 }6 b. y    iret
1 q: `% ?5 c! B5 Q3 A- u( _int41handler ENDP2 B; y5 }6 p7 a0 X' r  b
. r% z& ]2 ~4 q8 a# M' r9 R

& X/ a+ z/ g6 D/ A9 ^7 G    xor     ax,ax
* `8 X2 g: P, _$ Z4 z) R    mov     es,ax
  D# p3 e% i/ i# p1 V4 o    mov     bx, cs
2 ?. U! C; f7 @2 T; V- I: G    lea     dx, int41handler' v$ t( h8 B% L4 A" P2 t
    xchg    dx, es:[41h*4]
4 y+ `& ?+ u6 P* F3 w    xchg    bx, es:[41h*4+2]
( k2 H, k/ q* O: t+ z    in      al, 40h
' a/ U, c: t  Y, u) ]# s    xor     cx,cx
+ C( w7 Q1 c; T1 o    int     41h
2 E8 P/ _9 V6 Z) ]: u& l$ t$ x    xchg    dx, es:[41h*4]
; n2 Q1 q8 }$ Q* [, J+ O8 [4 y) r    xchg    bx, es:[41h*4+2]
# T# k( q2 [8 f( d5 O% Z: T    cmp     cl,al0 N9 b" E7 C1 H& p( ?
    jnz     SoftICE_detected9 J) v- O$ t/ r; V7 A4 v5 b6 k* w

, |1 R; u- I8 f- __________________________________________________________________________  I" t* c5 X* [: G
+ i3 d! F  W3 A3 W
Method 07
. q, t- L/ s- B$ [=========4 O* L( z' D4 v6 b
6 K/ C  W5 o1 y5 ]9 l
Method of detection of the WinICE handler in the int68h (V86)
. |3 `8 m. c( p2 T; |5 r  B% d7 h) z, G
    mov     ah,43h
/ y+ b% h3 b, H/ b    int     68h
! [6 Z' e6 t" E; n& z' T    cmp     ax,0F386h
# g5 Z4 Z" v6 _: k& G- _7 A& Z    jz      SoftICE_Detected8 }7 D5 Y% ^- u% L+ K8 M" T; w
/ e5 N' v) ?' n$ \

* C+ J( O6 ^! Z+ D=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit2 b: y& A. x$ [$ E7 D' n" l
   app like this:
! c! o: u( E4 ~. v7 g/ w
: l( B$ Z# C' X% R7 m/ L1 S   BPX exec_int if ax==68
, d( K5 E' B/ A; g& X& @   (function called is located at byte ptr [ebp+1Dh] and client eip is) O0 \" g+ \7 z4 O3 b5 E
   located at [ebp+48h] for 32Bit apps), r4 s7 S% E3 {! S: b
__________________________________________________________________________4 F) N( s) @' I6 K9 f! x
. o* H7 d3 [! M; M5 \0 a
5 }% W4 a1 c4 _4 S5 ?: N
Method 08
! W2 Y; o4 x4 o/ M- R=========) K5 |2 ]* K$ ]$ a% L% `1 N

4 o6 {) d" n% P5 GIt is not a method of detection of SoftICE but a possibility to crash the6 v1 t; M" k+ m+ N; c6 M; V/ e, t
system by intercepting int 01h and int 03h and redirecting them to another
/ @( |1 M  y9 B  p$ g8 jroutine.
6 A) t8 `5 s1 K6 n" v, BIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
" x4 Q" W$ e( _7 }5 k5 O4 C( eto the new routine to execute (hangs computer...)
) m+ N+ `3 a2 A8 F# O" w" |2 `! D/ I0 W( a; U* {) w
    mov     ah, 25h0 o/ @1 ]  h( ?! ~9 l' E8 {, s" f
    mov     al, Int_Number (01h or 03h)1 q$ T( M) i" D# G7 @
    mov     dx, offset New_Int_Routine0 t; K" l, W" t* i! ~
    int     21h
9 `+ P, N9 a' Z) w6 J- T- ~
% C, E/ y6 w7 o9 s# }__________________________________________________________________________
. b, U% X" d' j( W4 c0 v7 v' J
+ F- e( \: }7 D+ d& h1 N7 q" z; JMethod 09
8 L$ x) R% l; i, h9 t0 C=========1 c, C7 Z8 d/ m' x& ?6 Q  K4 m' U

* E. S5 O9 s! g8 [6 iThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
! j& d. h2 Z0 o" k8 [performed in ring0 (VxD or a ring3 app using the VxdCall).8 i2 R  K$ }4 j- D& {- T
The Get_DDB service is used to determine whether or not a VxD is installed/ z% q) v" o9 z" n( ]. V  V
for the specified device and returns a Device Description Block (in ecx) for5 L, z4 _' e% h  D3 ]
that device if it is installed.9 q$ h/ s4 y0 x0 B

, ~9 b% y& L9 w4 _* L1 R8 G8 l# a   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
; A+ p$ H- o6 B7 x* v9 N3 Z' V4 C   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)/ D7 h& [9 t9 k$ q
   VMMCall Get_DDB
* p- L& v3 B& o/ N8 _4 Y. i- H   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed  _# E! f6 C7 B' s

* y+ X. ^1 R2 _Note as well that you can easily detect this method with SoftICE:2 w8 Y' ^$ \/ V8 F# X9 W. A
   bpx Get_DDB if ax==0202 || ax==7a5fh
, ~  u- q& }# `7 {
1 ]3 C% c8 K9 ?  \- p# w__________________________________________________________________________
0 h, g6 g* @$ {) \7 O
8 j  m  p3 I# P# n1 N0 m* PMethod 101 ^, n  b( `3 N8 {7 ]/ n7 K
=========
9 \, u. a) \9 i
& U8 D4 \: c) ^) V% o; z( t3 ^=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with$ F/ L; t" t" a! C# \+ {
  SoftICE while the option is enable!!
8 X% R& N+ Q* C, C! X; Y- I
5 Z) R7 c& I, L. s$ [6 t1 SThis trick is very efficient:
  i2 U& i6 A# \) x* {. vby checking the Debug Registers, you can detect if SoftICE is loaded: y$ y/ H4 i- [" W
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if' H2 g; H! [5 @* G& ~; h9 P9 y# L
there are some memory breakpoints set (dr0 to dr3) simply by reading their
4 d. P0 d7 q2 D$ l8 B7 n5 Yvalue (in ring0 only). Values can be manipulated and or changed as well) F) E# ]' v& _6 r
(clearing BPMs for instance)2 s7 I" Z1 z* r2 R

' P- N+ g2 |' k9 `  P( ]__________________________________________________________________________# @% v" Y: H3 p  f+ A6 ~/ S

- k% s  m$ N) _, A( T6 o* zMethod 11  G2 j3 z; L3 ~$ ^' u" c' J
=========
6 Z& c* r" [, @) K6 D. R4 g# m
9 i+ o: {3 L& R7 ?  [0 }* yThis method is most known as 'MeltICE' because it has been freely distributed
  P# q4 b" T8 Z, [via www.winfiles.com. However it was first used by NuMega people to allow9 m1 g, l8 I: d: p9 z$ Q1 f
Symbol Loader to check if SoftICE was active or not (the code is located1 P2 i! D% Q# Q2 w$ n) {# C
inside nmtrans.dll).' @3 h, Y+ {) \. w! T2 N& o3 N
0 Z/ `2 r/ ], [
The way it works is very simple:) w! [% V6 E, j: `0 S# m7 I
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for7 q# j5 T+ q/ f. {% m: \
WinNT) with the CreateFileA API.+ H! X8 y) X7 Q
6 Z; `; @# K6 E4 O8 ?3 M
Here is a sample (checking for 'SICE'):
$ j4 b) z( |6 P8 ~8 Y' Q
6 |0 U6 S7 V! VBOOL IsSoftIce95Loaded()
( i' L% {! `; F; }2 _( M{+ T* @1 a% Q/ `, i# U, L% ]
   HANDLE hFile;  
! ?1 p; ]" I; ^2 L: ^4 N   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
0 [( V. _( W: O                      FILE_SHARE_READ | FILE_SHARE_WRITE,* i2 g) E2 r5 k+ U& H1 V$ s' K
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);4 z2 A0 ]* x) V" q+ m$ I
   if( hFile != INVALID_HANDLE_VALUE )
& @  l8 [3 d9 Y   {
- A6 r$ m! W! o5 w2 H$ H7 f' G# F      CloseHandle(hFile);
- T# i! J  @2 u# F7 ]2 T& ]      return TRUE;
9 Z( ]6 K3 ?" v+ L3 z; e   }; I+ T0 W# L% V4 y
   return FALSE;
5 ^' Q: j( S5 C. H& R  P. Q4 W) X- M}0 A. ]- h) {* ^0 v. d) w  P" x

1 R9 x, U* a( I  V+ u# F  MAlthough this trick calls the CreateFileA function, don't even expect to be
) N  [# G1 c! T4 W4 wable to intercept it by installing a IFS hook: it will not work, no way!0 k& `9 @. B. M/ P6 c) L- i
In fact, after the call to CreateFileA it will get through VWIN32 0x001F& H0 b  j( s- V. O3 P% b
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)& l6 \: z$ p6 S8 L+ C. v
and then browse the DDB list until it find the VxD and its DDB_Control_Proc: w$ X' n7 `9 c  X( w4 p7 V0 G
field.
, ^! o2 O; N9 c( W+ qIn fact, its purpose is not to load/unload VxDs but only to send a
+ \3 h  y7 `3 {' z& w; RW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)% \& D2 ?6 i5 V, O5 \
to the VxD Control_Dispatch proc (how the hell a shareware soft could try
: l) P, l  O8 q) a) |to load/unload a non-dynamically loadable driver such as SoftICE ;-).
& m, Y" D- f/ v$ S4 c  {8 y! E9 UIf the VxD is loaded, it will always clear eax and the Carry flag to allow
8 a/ d* _8 B: B- wits handle to be opened and then, will be detected.
. t% Q  r9 E& Y& |4 }' F3 QYou can check that simply by hooking Winice.exe control proc entry point
6 ^6 j+ J) v. {2 j# F! a6 D! dwhile running MeltICE.; X' Z' C2 k0 }; j) _

8 l! B, R/ `; _" m" [& B
) o+ {0 I% [; w0 z" b0 }# N  00401067:  push      00402025    ; \\.\SICE* ^$ S7 b( _3 T% k8 A+ Z
  0040106C:  call      CreateFileA$ X4 ?. T$ B7 c( Z3 D$ _6 k  [' n0 l
  00401071:  cmp       eax,-001
4 _, U7 j8 W: d' }8 e, c3 i  00401074:  je        00401091
3 l1 M+ B; ^+ w; V" ?2 U, _) p
- @+ ~; B9 ?0 U5 I
) |! ~7 Z# d. `* NThere could be hundreds of BPX you could use to detect this trick.
, H2 J6 \! c0 [% A  w/ b-The most classical one is:& _$ \' j3 s/ ^! M0 ^. C/ G
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||  A2 `9 D( \8 i& G( M! I1 o, ]9 V
    *(esp-&gt;4+4)=='NTIC'
5 A: i) t3 i: \
) V" N# P' h* _# z-The most exotic ones (could be very slooooow :-(
2 t- r0 \$ ~2 }* H/ o. w2 x& q   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  6 B+ o, D: z7 I1 K+ v  w# I* j! v
     ;will break 3 times :-(- [8 x" ~) P9 H5 r) e  J

9 b$ w9 I2 P" d-or (a bit) faster: 9 z$ m% e2 s" R4 A
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
% J% h. B8 l! l+ M5 A& A9 b* U" d3 V4 F* ~4 |2 Y5 r9 |
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
! r# ?% n5 f" @5 I! m1 t$ N     ;will break 3 times :-(  C0 T# A# }( ]  L" s/ `" L5 S: S

  n: f4 A) y2 K$ C9 P$ x-Much faster:
2 W7 s( H/ e; A" G$ o% Q   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'0 @6 b; [( Q  b6 j6 [: F9 k

, b1 q* t7 o1 g4 s& j  D/ }* _5 }" ANote also that some programs (like AZPR3.00) use de old 16-bit _lopen
1 L$ I; g& M5 M" a  l  xfunction to do the same job:
+ A/ J* E; t+ C" P! m' y( k2 n
& Y% w0 g8 q0 i% S, r0 D6 x8 ~) ]5 ]+ B   push    00                        ; OF_READ
9 z+ r2 r6 O  T. }" X5 W   mov     eax,[00656634]            ; '\\.\SICE',0
4 [& W3 U3 B' ^& ?7 C" I- i   push    eax6 f! m/ w8 W* @! G! E
   call    KERNEL32!_lopen
, J0 O6 a/ u: N7 V" E   inc     eax
2 _1 G; E  j6 |1 S   jnz     00650589                  ; detected
, a0 u! u6 A2 d! d4 ?( ?$ F   push    00                        ; OF_READ
" I" l# Z4 A4 q5 G   mov     eax,[00656638]            ; '\\.\SICE'
0 D% [+ w) d4 d- l% o   push    eax
& @1 |6 W8 v6 R: v   call    KERNEL32!_lopen
2 N+ z, w* K" M8 l# r   inc     eax
* r* |3 C2 h( F% H: L% P, g   jz      006505ae                  ; not detected
1 [+ i1 Q2 G% g, l( L
" g7 q7 G' z( G' o1 X1 l
$ [' d/ j0 j# g__________________________________________________________________________$ Q5 d& l  D" c1 O
7 s( m+ S3 N  P# s" ~- x
Method 121 O, U3 D( C" Q- q9 X$ a
=========! B. r; ^$ u" g5 z" X- v& G/ G
0 |' \8 _8 @, K0 T! ^
This trick is similar to int41h/4fh Debugger installation check (code 05
8 E. \( z+ }+ ^&amp; 06) but very limited because it's only available for Win95/98 (not NT); w8 l4 v6 c7 ^1 W% n3 o
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.- |3 }6 c% s1 i% E, Z/ C9 o7 o

, l0 o! d' f3 F% W   push  0000004fh         ; function 4fh& Q- |8 y2 z" E2 {
   push  002a002ah         ; high word specifies which VxD (VWIN32)0 D# q9 c: J" ?& e, N1 _
                           ; low word specifies which service. Z# @1 `0 J/ R+ A4 R
                             (VWIN32_Int41Dispatch)
7 u( }  O& ~% X: v   call  Kernel32!ORD_001  ; VxdCall
% u. I3 z0 a; M' P, U   cmp   ax, 0f386h        ; magic number returned by system debuggers. u( o3 b6 R. ^" x0 q
   jz    SoftICE_detected. y/ Z9 n8 M; U* p1 R: K: @

# M, @8 K! @( Q8 ?  @Here again, several ways to detect it:# o5 X: C* Z& m) Q
6 g4 H- M$ r# v% l  R
    BPINT 41 if ax==4f% [8 U2 d- e" A0 B
# }3 g. z6 B. h8 D, |. F' o
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
/ Q# d1 C# {8 x4 o* r
" d$ I! E; \. C0 s* v    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
* L; F% _8 O0 k9 O0 F# n7 t6 O7 N- L, N& H' d! N
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
( z2 S+ T5 [  v; A/ E5 X; e& j8 |- |1 T
__________________________________________________________________________
9 T; t" |# ]7 v' d9 {* Y! W* k+ v! t* ?
Method 13/ t+ i8 `% _0 L) i2 u
=========
2 B; B9 m- t+ X3 T# z! l. i9 r9 u3 n" ~+ h
Not a real method of detection, but a good way to know if SoftICE is; q8 A" ?/ g1 r4 a% S. _
installed on a computer and to locate its installation directory., u% N# n# e$ I' r! g
It is used by few softs which access the following registry keys (usually #2) :9 ?9 T+ d. ~* N2 F
0 Z" g) g3 ?3 C# [
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
8 N4 r6 W& W, X: d\Uninstall\SoftICE( |: R: e+ m; }# @; D3 q
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
& i# e0 l2 z+ B6 y6 r-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion2 W3 V2 }. z( r% M1 U
\App Paths\Loader32.Exe; I! [- M& p  _, P6 {. Z  r

- }' o, c+ h; P8 s% H) y1 t# X
) }+ u3 X$ b9 M- |* ]% DNote that some nasty apps could then erase all files from SoftICE directory
4 T9 E6 }$ g% j+ s. x(I faced that once :-(
% Y4 i7 ?, ]- l- q; s7 @
9 s+ Y5 D3 ^; t9 O3 o* @Useful breakpoint to detect it:! }. N! j0 K, @8 f2 a- ?
0 |% X0 Q/ p: Z
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'0 c/ B% Z: f. X5 L: v  L
& x3 g1 Y5 @* i0 E
__________________________________________________________________________
* K7 d. M; r- S" [" j. M/ D, b7 _
! F# E6 G+ z3 N$ Z' a7 D0 j
, o& B5 t. y: w$ j7 ^; v6 NMethod 14
& m9 n6 Z' n% v" X=========! u; j$ N6 \' Y  g0 l

/ @. h8 U5 f! F) _, q* U$ DA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
$ W2 h  L6 o- g+ V: T# Kis to determines whether a debugger is running on your system (ring0 only).
' H( @3 z. F9 U4 |# v) v2 c: T1 _2 ~3 s! v
   VMMCall Test_Debug_Installed
: L6 g4 L( m7 V3 w+ \   je      not_installed# n- t; Y, J6 ^$ J+ G, q

6 X# b. \4 i) E; r9 m+ OThis service just checks a flag.  c4 {/ x' a: B: x: T) w6 x8 z5 p& V
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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