About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>3 e, W6 s5 [9 p1 g2 T2 @, z/ Y
<TBODY>
( |; E) i; s* A# ^, b4 z4 D<TR>( n8 c  d" W: |9 q2 h
<TD><PRE>Method 01
; S( T. f5 A2 T6 ^=========
2 S5 f' _8 W1 L( Y# j# }  Z
. P; _; O( o% J9 eThis method of detection of SoftICE (as well as the following one) is% F% G% r( L6 q, @& h4 _: D& Z
used by the majority of packers/encryptors found on Internet.
$ C# }6 t8 E: v) NIt seeks the signature of BoundsChecker in SoftICE
0 T! F+ E) z- Y+ o# G
2 t  B! R3 H: p$ {' B    mov     ebp, 04243484Bh        ; 'BCHK'3 d3 K& c) @. m) e) ]& }" k8 H
    mov     ax, 04h3 F" s& W; Y# J  [
    int     3       5 _0 ]  R/ Z* X9 N: o
    cmp     al,4" t( O  Z* s" W2 k
    jnz     SoftICE_Detected3 c. r% @% z0 P0 f/ H2 w  K
* d! E# ?% J: A, Q& R3 s2 ^' b5 l
___________________________________________________________________________7 l7 Q/ V2 K, W3 q# Q* ^& X4 V
; f% X* z% j# ?
Method 02" @% ]0 _( y8 S# |7 r" K  t
=========
. p7 \) S5 x. S( R7 Y, N' G* y$ s9 ?' h
Still a method very much used (perhaps the most frequent one).  It is used5 i) E+ _3 q) [7 a
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,
( w, _# M5 Z  }: Cor execute SoftICE commands...: v5 e6 @7 \9 p6 l- y9 _% V0 O" ]
It is also used to crash SoftICE and to force it to execute any commands7 B* q# y9 S* Z$ L4 O, a1 C
(HBOOT...) :-((  5 l% o$ v4 ^/ B6 v2 H

$ ]3 D! r8 k# s# F" f6 w; THere is a quick description:
2 M6 ?0 w3 S" U) r) {  x-AX = 0910h   (Display string in SIce windows)
& j+ T% c( G9 Y9 X8 V, P  F. k" L( I-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)0 E" R: u/ }7 J$ }. ~5 }& Z
-AX = 0912h   (Get breakpoint infos)
7 T, v* Q% k3 I# r6 {. |5 f& ?-AX = 0913h   (Set Sice breakpoints)! D! E7 u' \, E! J) L) ]+ a- A( y
-AX = 0914h   (Remove SIce breakoints)
- w* H$ M0 x: s& Z& u/ W
, y5 d2 S: q% Q5 q$ e/ H; wEach time you'll meet this trick, you'll see:, n5 p4 ]9 _8 K7 P/ y" j! L
-SI = 4647h* P& p. M$ c/ s( ?
-DI = 4A4Dh
9 u5 R; Y$ K& F( w  u' z+ U8 lWhich are the 'magic values' used by SoftIce.) l5 y4 e; f/ c- s( ~' m
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.7 X' Q5 Z, q7 \

  S: C" Q5 s7 O. pHere is one example from the file "Haspinst.exe" which is the dongle HASP
. C, R( |+ ~+ e) W2 HEnvelope utility use to protect DOS applications:! y- g  D. ]+ A6 x% c

9 m3 R, ]. o, \8 ^# k- X2 A& H. T0 ?: o# W: p0 r# \
4C19:0095   MOV    AX,0911  ; execute command.* z- E6 _& \, I# V' ^7 ^0 Y! d% d. a
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).- P( {! j$ N  E
4C19:009A   MOV    SI,4647  ; 1st magic value.
* }% H, y. J$ C6 r9 d( q: s4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
4 [+ z" [- s% {/ U5 Z9 m4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*). g! a3 x% |. n8 A- D
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
& V2 k- @; ?7 V4C19:00A4   INC    CX
; Y/ q  I: V/ g+ I% P4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute, a; b- d! o5 [  [
4C19:00A8   JB     0095     ; 6 different commands.
: @; G8 s- J& e7 O  z+ {4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
- w) C( j8 F. p( b6 s4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)* V( Z5 e5 E8 {4 Z7 l0 M7 _

- Z) I$ G9 {5 @0 Q! I, t( cThe program will execute 6 different SIce commands located at ds:dx, which
& @# l( j* g2 [" G1 J2 F6 mare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
* P3 m- T$ I& r4 a* b2 H* i/ R" V7 w5 Z
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
' r) d% p8 e. X___________________________________________________________________________2 W( M; z5 z# V. v1 ~1 \
% P1 [* L) ~  j
! h  F# {( I7 d' }: B
Method 03
/ E( h. d' l* w( g7 i=========
4 y0 f5 E" ]1 t' _5 J; j( O- }4 Z) K2 @9 ?  A6 c# i' i0 f9 B& W, Z
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h! |; X% q9 J# P1 P
(API Get entry point)2 N% x- O( z: l
        
: S( f- Q2 s6 k* _, b0 S' W
5 P2 e; t& D3 N9 U6 T& V    xor     di,di
# n% e/ `: M$ Z( e8 K8 A    mov     es,di
' {2 c! Y! l2 o4 C* C8 l4 V    mov     ax, 1684h      
7 W: m) u# _/ `5 m& K2 `9 ]9 J    mov     bx, 0202h       ; VxD ID of winice) ~$ h9 L, l! l1 w" q- M! D
    int     2Fh
" ^: ]& a: S6 r. n9 z    mov     ax, es          ; ES:DI -&gt; VxD API entry point
4 }5 W$ \( R& u8 K* ?  {    add     ax, di8 ?7 h/ F2 ~" e* M
    test    ax,ax
* L' l. |8 ]: h" C: A    jnz     SoftICE_Detected
% ]3 [4 k$ i. e, o- v9 R- t6 k0 e! ^8 z5 V
___________________________________________________________________________
, r, u( g  Y; |% n( ^: d& N& p1 {* @4 ?9 j9 w) I! m% V1 ]- ^; h
Method 040 f/ O/ [4 Z: \- P* |- o
=========
' z7 N. C% A9 J$ Y# r8 V# t2 F
5 F1 U# _& O/ X) m+ _Method identical to the preceding one except that it seeks the ID of SoftICE1 w9 r; ^: r$ s/ m* F, r6 O) I
GFX VxD.6 B* N, G& y8 G" @

, P6 Z) U6 v5 s6 |    xor     di,di+ p  ^, e+ p6 \: ^1 l' `6 ]
    mov     es,di
& D, w7 i9 V( v    mov     ax, 1684h       " D9 @+ f: r0 |! J" `$ O6 W) R9 Q
    mov     bx, 7a5Fh       ; VxD ID of SIWVID
" Z) n8 c8 w/ a6 p8 W* F    int     2fh
- _5 M3 t6 q4 u' E1 D( m' b    mov     ax, es          ; ES:DI -&gt; VxD API entry point
; x4 R  N- \, t; q2 C    add     ax, di% J. i8 u* E% ]. t. q
    test    ax,ax  D$ f) I; @" S( n
    jnz     SoftICE_Detected' {: n7 E2 {, ]; w2 w& k

4 O7 ~, ?/ `) N; K__________________________________________________________________________, H# ~  t& s$ d; t/ v8 l
: W6 F% W& Q9 Q' d
& h3 k  ~' }5 y+ e
Method 05
- g8 o/ S3 U. ?+ B( E=========
* Y- f5 v3 u# U0 m% v- |) o% x, l' W. ^" \+ I
Method seeking the 'magic number' 0F386h returned (in ax) by all system' ?: H1 J2 B" y/ s+ I- F6 P$ J$ u$ |
debugger. It calls the int 41h, function 4Fh.- d3 f9 E- |9 b" u$ R: E
There are several alternatives.  
% x  }+ C2 D3 N8 h/ T7 @2 a* c1 v7 j
: Z7 w3 n7 J% R0 q% }0 OThe following one is the simplest:. z" U1 Z  C4 n5 G7 C4 L# U! [
6 X$ g5 [: l1 t0 H) C
    mov     ax,4fh
0 t& z4 J% k. \( V* x4 k$ f    int     41h" A4 o1 H% N" p0 Z* [9 N
    cmp     ax, 0F386
, h1 P  i( j! }6 h    jz      SoftICE_detected. M& G% S: x6 a# H/ {2 Y2 K
  p& t2 g' Y9 o) p

% O1 u/ `/ j! _  A  ENext method as well as the following one are 2 examples from Stone's 4 I. I. a* v( c( b6 g7 w# ?
"stn-wid.zip" (www.cracking.net):9 ]- X( t" v. d  r. h# t0 h
; S+ }) F4 m# p8 d
    mov     bx, cs) J9 D- K% |8 e9 u7 r- _
    lea     dx, int41handler2
, z: H) p9 n+ u& S0 @$ |, M: G  H+ i. ]    xchg    dx, es:[41h*4]
& N6 o/ b- z% I$ u) s5 F  J6 |    xchg    bx, es:[41h*4+2]: k- F! p6 z: T& k7 h
    mov     ax,4fh
* u/ ~0 I; S# d, G5 N8 E    int     41h6 C' H  M2 ?# o* Q+ H: ~
    xchg    dx, es:[41h*4]! U% R% A5 p, A- c
    xchg    bx, es:[41h*4+2]
9 T3 l" C, h; X    cmp     ax, 0f386h9 T2 k1 Z& T! k8 e4 L
    jz      SoftICE_detected( D' G0 L. l2 ?- O& Y

$ s5 T  W, a7 P+ x3 q) c3 Qint41handler2 PROC
' }* c9 M$ E0 F: q    iret
9 u. ]; ^/ ]& Hint41handler2 ENDP+ D8 @% y. I; A
4 v! j4 K; q* A2 h

" f) {" K- K  \6 s: ~( K_________________________________________________________________________* X! k. H- C0 u% y# b% x# Z

0 p8 Y% _- f( `6 }/ X4 a. i# V  r/ W( i) m- `. W# U( U1 M
Method 068 R  S0 l2 X# b4 j: z. @
=========3 I- z( r% m. b$ b

; O3 w: Y+ M9 n* {; Q
0 y% M; @( Y+ R  ]. W2nd method similar to the preceding one but more difficult to detect:
! W: Q" e; ?0 ^% |; V, T  {; L% P, ^. O' F
1 _8 Y& @3 s4 [4 P9 F% u4 y% D
int41handler PROC
  |6 K* z  I) F! y    mov     cl,al7 G" P' z+ y- e; Z# n
    iret: @$ f' C  c& t% d7 P6 S) a( n, n0 e  f
int41handler ENDP1 H. e, c" ~6 S' |

! M) A2 f% c0 y: S' U2 o! d% n! E) W$ }8 [/ `3 {
    xor     ax,ax! c/ f& B+ M! j3 Y! ^! s' A
    mov     es,ax
: h5 @, b( N' \! D6 x    mov     bx, cs/ N% L) {) s; l) N9 m7 R1 t: w
    lea     dx, int41handler: U8 Z( \& O* l2 V1 ^3 j; ]
    xchg    dx, es:[41h*4]
+ p4 P4 m5 S' D- q8 @$ Z0 l    xchg    bx, es:[41h*4+2]
2 @5 Z6 F6 p3 U& G# j    in      al, 40h
- d8 o/ Z4 }2 @8 y; Q/ Z    xor     cx,cx7 X  f7 l8 s1 N( M5 v- I
    int     41h
$ ]; \4 u8 O1 E" C3 x) ~! V    xchg    dx, es:[41h*4]/ m( Y4 v- D. s. N! K/ i
    xchg    bx, es:[41h*4+2]
8 q" Z. P5 y1 F3 C* Z0 @. I    cmp     cl,al- ]' R0 L( ?4 F$ H0 n8 [
    jnz     SoftICE_detected1 n: A3 ^- M) `$ |( r( ?

5 g5 ^" B+ k/ R9 R; ?* K. __________________________________________________________________________+ `7 @' C- |+ J* ^* K8 X

  T" Z, a2 B! }# X8 sMethod 07
2 j/ }# H4 b0 ?4 u* b=========* {0 f  u2 P+ |  E0 W
$ w; Q4 L7 \$ G
Method of detection of the WinICE handler in the int68h (V86)
+ k# ^' Z8 S, o1 Y5 s) }: E0 c! h$ K! {# I6 ^. U
    mov     ah,43h
# s. f2 X  A7 e% H2 [" l) c    int     68h
/ {) x2 _. L' R) B* M5 z; d+ T    cmp     ax,0F386h7 n* J- W+ r; \: |4 V
    jz      SoftICE_Detected
5 l) [# N3 _. E: v: L& j: u% w5 o) D+ A
: r( `1 ^  |1 K$ m8 t
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
( y3 |% q: R/ Q- K   app like this:
( H, E6 r/ k0 q# E- n7 a% ~' Y- F5 r  ^' h
   BPX exec_int if ax==685 ?/ j- J# `# S8 B- x5 S. E
   (function called is located at byte ptr [ebp+1Dh] and client eip is- u5 u) G. f  R: m2 ?1 Z
   located at [ebp+48h] for 32Bit apps)3 r7 p8 X& ^4 j/ ?
__________________________________________________________________________, R) M4 x5 m: ]# X. u; v: u

* F: }6 E( J! f6 p& `/ X& r* _, n, Z
Method 088 Y. B  |5 E3 |7 g7 P
=========; G$ {6 T; S* l) b7 G
+ z1 c# U3 p; T+ V
It is not a method of detection of SoftICE but a possibility to crash the* _# Q+ y# l2 k2 X) \
system by intercepting int 01h and int 03h and redirecting them to another
* M1 L; e& y( q5 C8 W  ^- `: \. b1 groutine.1 h: o; T3 v: u/ ^" d
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points5 W! k# R% ^% k+ ]
to the new routine to execute (hangs computer...)
0 _" F! J: f9 F% ?6 K
5 ^4 x! n0 d6 Q    mov     ah, 25h
. b) H3 N" \3 }3 b9 G    mov     al, Int_Number (01h or 03h)
2 t5 ~: V5 j- n$ t    mov     dx, offset New_Int_Routine6 s( b9 t& c$ m  K( p8 N* M
    int     21h
# R; U- q! m2 i( `  v7 p. w! k6 V9 A# ]% C5 w/ S
__________________________________________________________________________
) ^& i0 M  n  x+ h7 a; c' B! ?& G6 ^' X- s8 _
Method 09) Q! S/ N! r4 Z9 @% g  y+ e
=========9 i" V1 [9 g, m+ ]1 c6 C% X
# c3 X" F( ~' s
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only' v% k. J# y1 V# {: y5 }5 E% B
performed in ring0 (VxD or a ring3 app using the VxdCall).
0 T" H- _- \! x, Q( F, tThe Get_DDB service is used to determine whether or not a VxD is installed
; |  D- r( {/ {! p: z2 C* _for the specified device and returns a Device Description Block (in ecx) for
3 d1 l# v/ ^: N" V1 ?# q7 `8 Fthat device if it is installed.% S4 u( W$ h5 D4 m* `9 Z6 C5 Y
# R' s9 s) }* k  Q0 ~" Z/ o
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
" K  x# `! F/ C( I   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
. _' _& u& O) k6 X3 r& _9 s2 o7 f   VMMCall Get_DDB
% p9 ^- T6 `2 d/ \5 N   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed2 |( x9 ]: e, u$ }

3 F! e( B0 w1 r$ h0 _/ B4 xNote as well that you can easily detect this method with SoftICE:
  W% |, U0 E7 }% [: ?   bpx Get_DDB if ax==0202 || ax==7a5fh. s+ t/ P' t$ t- p; ^
  |0 F! ?% S- h$ o
__________________________________________________________________________
% H+ Z& G: h; D
7 S' ^) O* M' ?8 V2 a* uMethod 107 ^6 z% ?& ^3 W+ ^
=========4 Y8 M+ x! }+ m0 ]; d9 r
0 T3 e1 K3 c9 n; O
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
( z/ i$ G) O, C5 v. k' A* O  SoftICE while the option is enable!!
7 _( X2 }5 H1 V" z# n! V! V/ F/ `; x$ x/ c
This trick is very efficient:" n( y4 E. |5 i5 Y! o
by checking the Debug Registers, you can detect if SoftICE is loaded
- R7 [- u9 }$ q3 Q(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
) o: h7 R; a# ^there are some memory breakpoints set (dr0 to dr3) simply by reading their; v9 E3 [; w4 L3 d2 N
value (in ring0 only). Values can be manipulated and or changed as well
* e! Z# F! L1 [# `2 i1 L/ ~( h(clearing BPMs for instance)( S4 v7 p/ D3 U: j8 x3 t8 j

3 x) t; b$ B' _4 z  |$ B__________________________________________________________________________! A9 J% `% Z: ]0 q% ]  i4 J
/ V5 C4 r/ _$ X! D( c8 [" T% j
Method 11- F: S2 [( D+ X$ J. r3 Q5 I- _
=========  I: p& H$ o' T0 s% x

6 h7 G; G. L9 K$ @  }( gThis method is most known as 'MeltICE' because it has been freely distributed
/ D  D+ {& b6 I2 xvia www.winfiles.com. However it was first used by NuMega people to allow# y% Q; P. w9 S' T" c2 B( g6 K
Symbol Loader to check if SoftICE was active or not (the code is located: F; L  g3 J1 \. Y3 W4 \) G; }
inside nmtrans.dll).
$ `4 p4 y& B5 t
' r+ X! y: M: E( Y& |The way it works is very simple:
2 I$ }* s- F0 l6 kIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for; ]. a! C9 n$ F; n% V) P; S
WinNT) with the CreateFileA API.
5 j! s. ?6 _9 [$ j9 e  Q% P+ |* D7 U) E
Here is a sample (checking for 'SICE'):4 `" Q: l8 B/ c* R& I$ K0 y$ _2 H! [- P
, D+ }1 t# j! w7 ]% f5 X8 l: G
BOOL IsSoftIce95Loaded()! L( V2 D/ f' u8 x3 D  x: b
{
$ `+ T9 L' l% J3 A   HANDLE hFile;  
* h* A9 z  W, g$ V" P   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,) X$ x7 }% V- ~8 a, q
                      FILE_SHARE_READ | FILE_SHARE_WRITE,/ s, G7 j$ D) q0 ?# J
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
$ ^2 e. h7 Q" F. R8 R- c   if( hFile != INVALID_HANDLE_VALUE )7 d' p: D( F4 s! ]1 p. E: o& F
   {) d$ U2 N  T0 m
      CloseHandle(hFile);
' U; v9 C# g9 t7 k      return TRUE;* T4 @1 M( s, w- O% c
   }5 h: k& ?2 J7 P1 J
   return FALSE;8 b1 }: N1 w, ]1 K, q$ o& a5 q! [) S
}8 s/ l$ [( w0 M( n! ?. R
! o# I* b- o4 l; @8 u
Although this trick calls the CreateFileA function, don't even expect to be& i, E! {' x3 T0 a/ {6 W
able to intercept it by installing a IFS hook: it will not work, no way!
. ]" O1 u0 b1 T) k* dIn fact, after the call to CreateFileA it will get through VWIN32 0x001F
) G3 p$ L, p% A1 ^# X- vservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
3 x% G! W3 K0 B" ?and then browse the DDB list until it find the VxD and its DDB_Control_Proc
$ g7 M6 V3 H; D3 @# T+ e, M( tfield.
3 ?9 j/ E- f# ~In fact, its purpose is not to load/unload VxDs but only to send a
* }) f, m) ~  l" |( p7 t6 oW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
/ \- j* V5 z* o$ y0 k1 I" vto the VxD Control_Dispatch proc (how the hell a shareware soft could try9 b! y4 b4 _3 ~1 D% {
to load/unload a non-dynamically loadable driver such as SoftICE ;-).
+ b& {) ]: Z8 G( DIf the VxD is loaded, it will always clear eax and the Carry flag to allow
+ c% P" T8 h4 `5 t2 Mits handle to be opened and then, will be detected.
5 n0 M2 Z7 R, T. WYou can check that simply by hooking Winice.exe control proc entry point
. g! E9 N* A  j2 Iwhile running MeltICE.# l& G! K8 U6 X" [$ L2 n! m
- J5 T* J; M: l6 O

& Q  X  H1 ~6 u  m  00401067:  push      00402025    ; \\.\SICE
! M) i% Z9 }* D  W1 v  0040106C:  call      CreateFileA( C0 R  d% ?2 [* z' r' |9 |
  00401071:  cmp       eax,-001
7 }+ o& P6 ~. z- B  n& A" y  00401074:  je        00401091' U# i2 {( I) s
5 I. A" }6 J) C! z! r
; \% {7 h& Q. H4 g0 N# x
There could be hundreds of BPX you could use to detect this trick.1 p1 M- K% ^& f5 K+ G+ K% k
-The most classical one is:
3 @- {7 U- o' r7 w8 Z1 R" b0 }# w+ b2 ~  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
& r7 P8 Y+ ]  w0 H4 t    *(esp-&gt;4+4)=='NTIC'7 ~' z! \) }3 L2 E+ b$ H' i

- S1 M7 Q( g' K: {' J-The most exotic ones (could be very slooooow :-(! N& T9 g3 x: `* E
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
  j3 _( B- F2 q4 h     ;will break 3 times :-(
. D' J; L. A& ]; y4 m1 ?1 n5 z. G5 j9 Q8 Z# z
-or (a bit) faster:
- a" t+ L! X/ M* c: I   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')$ L9 K" D: E2 g# q3 D8 x
& h+ t( n5 f, v! v- K
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
) r) @( E! r  {( u& l; H: U5 F4 Q     ;will break 3 times :-(
9 W7 y, ]% r2 T4 E1 r; O
( S5 p1 W3 }1 }$ |-Much faster:+ u4 h' Q& Z( i. k
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
. ~% s1 r/ j, M* Y5 G! i
& J% ~0 l- a4 W8 ZNote also that some programs (like AZPR3.00) use de old 16-bit _lopen
' O- U( M1 F) Z/ }3 D- C- V4 sfunction to do the same job:! X" J4 o9 s6 y

" u/ H: {$ H) B1 N3 Q  l7 A- y   push    00                        ; OF_READ
+ L& g+ [2 [, H" i/ f6 L4 \   mov     eax,[00656634]            ; '\\.\SICE',0/ S7 F- W0 a: q0 \- u
   push    eax
! o8 g/ t; B/ X6 D2 b   call    KERNEL32!_lopen
! [6 `8 V( b# O$ Q$ Z9 f. K9 K) l   inc     eax
4 c8 h1 L1 F, \& p# H   jnz     00650589                  ; detected
* x7 d4 G! [2 \# z   push    00                        ; OF_READ
" Z, M0 P. G+ u: M   mov     eax,[00656638]            ; '\\.\SICE'
0 Y; g# N& z* ?# i4 N7 X   push    eax
5 _' N5 A& r$ C: l   call    KERNEL32!_lopen
' M& i/ K5 l" ~+ N0 h/ o9 E   inc     eax
9 V+ h! V: w* V" w+ M0 A4 }$ o* {6 o+ [. O   jz      006505ae                  ; not detected  ^9 L1 T& {( Z+ a! }" N; z

6 A; q7 ?, J( g5 V2 D/ p  d, O/ u! @: n5 l7 u$ c6 H4 s
__________________________________________________________________________
( |9 L; c: x3 T& e3 q/ d5 N6 H7 {; V. K
Method 12+ Y, G+ B9 w0 ]# i% K
=========- K  ^' ~8 t0 ?# R, _# l

5 A% {4 H9 k2 h; Y" xThis trick is similar to int41h/4fh Debugger installation check (code 05; s, t$ Z& k2 u. D; z1 _2 {# P
&amp; 06) but very limited because it's only available for Win95/98 (not NT)8 r, R+ A& ^+ P
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.
# U1 `. ?2 X: c  T7 w1 I3 m! g- ~3 Y- G' D1 R
   push  0000004fh         ; function 4fh$ ~! c8 e9 K+ _: ]! v6 Z# B
   push  002a002ah         ; high word specifies which VxD (VWIN32)2 z6 I# y6 x  }( Y
                           ; low word specifies which service& ?( x4 S% Z& J* P* P7 T& b
                             (VWIN32_Int41Dispatch). |7 }; |9 m1 U) Z$ G. \7 G
   call  Kernel32!ORD_001  ; VxdCall
8 `! i0 C! s, _2 o0 H8 T- @: v   cmp   ax, 0f386h        ; magic number returned by system debuggers  r* x! S. h3 `2 a2 F
   jz    SoftICE_detected
* l: B+ W: \9 M1 _& `. c
- y. ]6 d2 b! q3 z* `6 R/ o* g# ZHere again, several ways to detect it:) j9 T0 P" g1 q! i1 E, v7 l( V
" o4 G4 @5 F+ o$ {$ x) L' G& I, O
    BPINT 41 if ax==4f- @& `, i, r! P+ I9 q& T
% t% c7 c, g' @
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
/ m: \; U, U/ G  ?/ e' Z' M2 `5 z: O% u5 I+ T% v7 y
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A5 l8 H1 U1 ^6 _1 U: z" Y

5 P" a/ b. m4 J& I# ^* H    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!. j3 f1 C: J3 }; ?; t1 y6 ^) k2 D
  Q8 F, B  r* ?0 h8 a( X& D4 i# J
__________________________________________________________________________! W$ ]1 V1 o" h& S* u& J' r9 H9 I
' `( f$ i& u2 K  e0 ]7 a% T
Method 13
1 _4 c$ d) r9 e=========
+ q* x2 Z4 y$ ~% K  r5 U6 p" A$ j; c4 n" C* y
Not a real method of detection, but a good way to know if SoftICE is, L" n6 o) L' f( l2 I' B* O, d  ^( S
installed on a computer and to locate its installation directory.
& ~- U1 F  g/ x: B: f8 U9 t' n" |  _It is used by few softs which access the following registry keys (usually #2) :
- U8 D7 E6 c: _9 N% h$ L$ l
! }0 x& H7 h1 u% n6 T-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion! W5 v- E1 B% x3 K; H
\Uninstall\SoftICE1 d' y( ^0 r! k( q8 C
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
& J( H/ V  R9 C. p+ C-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion' P0 C2 t+ v6 k$ }- d6 a0 s& y
\App Paths\Loader32.Exe
4 W7 k+ W$ t6 d
% \( G3 _( M5 u2 D2 ~+ G/ u  I0 f
0 f* G3 }! j! k. u8 wNote that some nasty apps could then erase all files from SoftICE directory
4 z6 q" Q2 T6 c6 g(I faced that once :-(7 ?& a% _7 f* B6 f
! ^% @( b8 A  X! `
Useful breakpoint to detect it:% e. [& r) i  u. n2 {% Q

4 r" D4 f, S4 ~5 b, ^# Q     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'! E& Z0 d" r& R5 K1 j) X0 }" P" O6 f

; K( x" E& A0 W+ C$ J, Z" A3 ?: Y__________________________________________________________________________$ X5 B: w, b9 C& l! J5 ^
" H1 B/ K' j1 m- N/ M3 t" E. W/ r
! K; X. G+ a$ p$ D9 s
Method 14 1 Q& Z5 G$ W; P4 z# e
=========
* o- ]- g9 i: a6 x0 f+ e% @7 \
+ d) `$ h2 Z; }% k7 x4 oA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose+ X; V  i9 P! ^& \8 K. y
is to determines whether a debugger is running on your system (ring0 only).) x% y( R6 x3 y0 t# m) k+ ]6 l
4 X: J' q& c# c; `8 k" N- u" g
   VMMCall Test_Debug_Installed+ a  `& _% K5 l1 t
   je      not_installed1 X8 P6 H9 A# H$ C2 K, R

0 q, Q4 i2 T% X2 h: a1 k4 G& }% MThis service just checks a flag.3 |5 [1 w* h: s4 Y" a! p  o- e, W
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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