About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>; l" r  B4 F$ Y; E
<TBODY>
; U1 u# t& t' v8 N, v: |& S<TR>& e5 s; D2 x, e% ], g5 b
<TD><PRE>Method 01
( f  p9 l2 e/ C5 F=========
& I/ ^! J, ~& [# y1 t2 n
1 G7 V# _0 o1 {5 V' G) W) U3 c: HThis method of detection of SoftICE (as well as the following one) is* P: d7 S% {, @6 S3 R, {
used by the majority of packers/encryptors found on Internet.+ ]5 U: }: k& Q4 T/ e
It seeks the signature of BoundsChecker in SoftICE
# j9 C" M9 K" d/ v: P6 n% \4 ]0 R) b2 X# z# N( O
    mov     ebp, 04243484Bh        ; 'BCHK'
1 r* H6 N& \5 N- V    mov     ax, 04h
" u. e) m# ]9 r- G7 H- G    int     3      
. [! D* Y4 R0 w1 j    cmp     al,4  u2 j/ O6 o. h  P
    jnz     SoftICE_Detected
# `9 K* y( r; p' P+ `8 A- ~% o- C0 J
! Z1 d- |5 ~. q___________________________________________________________________________2 f% s3 P, M1 v7 Z2 m5 k' x: y" ]
$ e% u' s' d% G, c
Method 02
' U$ l7 K( Z' E; L=========
9 L. E7 x. q1 J7 ^0 f# o$ Q% h& v0 y' S! j2 l9 B' |
Still a method very much used (perhaps the most frequent one).  It is used
8 g" j) P% `4 @' [$ q! M3 t0 Kto get SoftICE 'Back Door commands' which gives infos on Breakpoints,# z2 K2 u' l' g+ c  q
or execute SoftICE commands...# L" t1 P) p7 p; b3 ?
It is also used to crash SoftICE and to force it to execute any commands
( m6 a: d( m+ g(HBOOT...) :-((  4 |7 U9 Q* f4 N, p6 y+ x  S

! T; ]7 A4 ]; w! i: QHere is a quick description:! p6 L' p+ s& J" t
-AX = 0910h   (Display string in SIce windows)
, _7 C0 c8 {& b$ V; P6 r/ O, Z-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
( q- S# f4 ^: t* n& M( ]! M-AX = 0912h   (Get breakpoint infos)
! Q& F5 y/ F# V$ I5 v-AX = 0913h   (Set Sice breakpoints)
, e" S; h- r3 y9 Q" P+ a6 T8 @-AX = 0914h   (Remove SIce breakoints)
% ?, Q8 Q( P# G7 G; D% t) \, ^2 g
Each time you'll meet this trick, you'll see:
; Q; l) C7 ^7 }" q% h! \-SI = 4647h0 C+ D6 t# a; I4 C+ h* ~
-DI = 4A4Dh
. w" |& p9 N3 o: j( oWhich are the 'magic values' used by SoftIce.
! d9 q0 F' T9 x! vFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.  f) R" v8 j" M4 F4 Z

$ `+ ?2 g7 h/ t( oHere is one example from the file "Haspinst.exe" which is the dongle HASP( I9 T2 a+ V8 Q# \) h  m9 T" u
Envelope utility use to protect DOS applications:
& h# W& M, t% b) z# Z7 C- J. e+ ^* e

4 |. k' P2 R' P0 n0 t; h) r4C19:0095   MOV    AX,0911  ; execute command.
) U* N1 g+ R, P$ _5 e) Z! E% d4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
  c! ~0 e4 o7 x. Y# o4C19:009A   MOV    SI,4647  ; 1st magic value.! s1 O+ H- \# _; K, D( D( j
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.  i& b# c+ z$ w% t; S
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)+ [$ J9 w. m+ f; l3 r. L1 [
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
& o! d- z( D. N4C19:00A4   INC    CX/ F+ w8 c( s, ^" E, w, |. S
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute& J6 X9 h0 o" I( W% k( k1 Y3 n
4C19:00A8   JB     0095     ; 6 different commands.5 E) D/ B$ b/ C
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.5 L8 K6 X% a: ^" z
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)  W4 U$ W. a" H; q9 y
' _6 K& V8 v; }; W! U4 P
The program will execute 6 different SIce commands located at ds:dx, which3 M" |" m0 f5 O; D/ P
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
7 t4 ~# y$ d3 O( G8 Q  ~6 t7 h( l# R0 Y) _
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.# V; d7 Q, [! l5 h4 ~5 M
___________________________________________________________________________
1 n& o9 k7 ~* {+ x
$ x  z# s( |2 L4 B
- a7 p' L$ j, d7 JMethod 03
# C7 k* u: f) t! `; _=========- D9 s" b0 \( \" w* H! Q; B: D2 i( F

. `! U% a! z/ fLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
9 D% \- p# j* H(API Get entry point)4 A( H0 Q9 Y  N
        ; }: K2 k2 Z, ~& [" {: S

; O* C* W. u$ v3 F- ]; P9 X    xor     di,di
& Y  i9 |/ e$ ]: N/ @    mov     es,di
7 V# p* j- j2 k0 Y1 W    mov     ax, 1684h       3 V$ r2 W' d' }  \% h" t( R
    mov     bx, 0202h       ; VxD ID of winice, v* b1 R+ y2 C' ]% [
    int     2Fh
8 m9 ?! c  a9 @- S7 Z/ a2 D  W    mov     ax, es          ; ES:DI -&gt; VxD API entry point
3 B' P. c$ n5 X" `& i" j    add     ax, di
7 h" D; l5 N; J( G& r  P/ C    test    ax,ax: E6 s! K% K& s. Z' B4 r( x+ p
    jnz     SoftICE_Detected
$ w0 B) o6 v4 h$ z+ v' P" w0 [3 Z: n8 u- T7 g/ U. x# |! M1 K
___________________________________________________________________________% ~+ x, y6 n% J. ]+ K
8 D/ M5 p' W* P1 B7 ?/ @; a
Method 040 H5 t3 b! B1 ^; @# c  h& g8 o$ R
=========7 p7 S8 {) v: ?, k+ b$ ?# v0 i
6 _* T4 q6 g9 `3 b2 N2 n/ g+ \
Method identical to the preceding one except that it seeks the ID of SoftICE
/ C8 q  I, _2 d) X1 h0 eGFX VxD.! u0 v* {( Z& u5 X
! L5 C3 z3 ^( f" a5 u
    xor     di,di
; Y+ v- Y* Z- x& @* t$ c! \# B6 V    mov     es,di8 ?* y* q7 H; p
    mov     ax, 1684h      
- c7 b, r' w  s3 y& S0 O1 ?- N2 {    mov     bx, 7a5Fh       ; VxD ID of SIWVID
" q& t2 i( G; v8 }+ P6 o/ C& j7 E    int     2fh
# j# k$ X4 F" h$ u& l    mov     ax, es          ; ES:DI -&gt; VxD API entry point% B: r$ K; T& Z! Y
    add     ax, di  Y+ c# S$ _1 ]0 `( E3 a
    test    ax,ax
+ r. k3 K! l8 @: L    jnz     SoftICE_Detected
: ~& I$ R4 k3 c
4 y1 L& Q  ^/ u) r__________________________________________________________________________
; u0 Z) ~; L, Y2 [0 D- |2 m# b3 p# Z" c# i! v, P
- ?# i( Z  `" ~% G- Q
Method 052 c0 `* G: ^/ F7 c$ D; c
=========
  A( f, B1 z; {) X+ m+ f4 R
) L/ \5 \$ ^/ `" }& d3 VMethod seeking the 'magic number' 0F386h returned (in ax) by all system
+ ~; ?- h0 \/ J5 S+ [) sdebugger. It calls the int 41h, function 4Fh.! O- k( K6 w8 [" I7 J- I9 {  I
There are several alternatives.  , u$ T/ T! C: _9 S7 f, k

- l$ \. x5 s, s8 D. M7 {0 RThe following one is the simplest:7 O# X. d* v! g" w1 V: y8 k
  J7 |8 l  @' b' w3 H% W# N
    mov     ax,4fh! a! d' j3 G2 g; ]0 R
    int     41h; ~* N& \: D* v7 A
    cmp     ax, 0F386' U* ]/ R+ r3 a5 V, ]; ]% x
    jz      SoftICE_detected* v: s# ~  C1 [6 I& F* P2 A5 V8 p
1 p# E. Z6 [0 k. \$ @' D$ T) V  V

5 }" K* c8 L: @9 j! Y' }+ h9 VNext method as well as the following one are 2 examples from Stone's
5 V# e2 d  `  o6 w+ _8 u# v. ~"stn-wid.zip" (www.cracking.net):3 T9 d( a! c9 j  H6 @7 J$ S) `

( z+ P1 F0 R; A( G    mov     bx, cs
; e4 W& q' x7 r& E0 o1 t3 X4 M    lea     dx, int41handler25 v6 |! C# F6 I9 z5 p
    xchg    dx, es:[41h*4]; n9 [( f' k0 N% N$ G  R
    xchg    bx, es:[41h*4+2]
# f' l2 z( `! @; E8 q+ d    mov     ax,4fh
# A/ s. Q/ c. K" j    int     41h) W5 L, {3 X: a" F
    xchg    dx, es:[41h*4]4 B5 c1 B) f% M/ d( m8 i9 i
    xchg    bx, es:[41h*4+2]
* |  }' M& z$ B, c: V" [    cmp     ax, 0f386h
3 _7 K9 Z9 ^) _5 t" a7 i    jz      SoftICE_detected
9 F* D* c( O& S1 e2 z  {& R! h8 \! i" m1 t
int41handler2 PROC
4 L; N; A, [- D, G, J1 J    iret$ U! ~/ y$ p5 G0 \
int41handler2 ENDP) {# Z0 v% w2 ^/ E7 ^( l& ^

' ]& f" |5 q3 B) ?4 y; f
! q' O' h- H/ V" e% P_________________________________________________________________________
/ f) U+ k; r: c' k# c; [4 R7 Q& a
$ c* a2 \4 F) t
! V) O$ L6 |% j) \0 J+ uMethod 06
7 s6 U' L( D/ Y/ R  h=========- B1 N, l2 O* I/ Q+ A5 T7 j

: @# A' V6 s1 F9 i5 Q, \; Z& t4 q3 M2 \! R
2nd method similar to the preceding one but more difficult to detect:
9 w% X* `/ @' \
. H: G/ ]2 C& `: H7 a
( i1 j$ L5 E' ~9 H9 G; wint41handler PROC5 s- w" ?! W" B% v; q
    mov     cl,al$ {: O! j5 C3 ]1 _: i( t
    iret$ L: h; Q/ f# _
int41handler ENDP
* M' _; N7 [4 i* s
, @0 y% i/ H& Z
8 \- q$ k. t% @3 ]) D    xor     ax,ax+ [2 l: l' W6 h
    mov     es,ax  {. D) Q: y! U3 {1 U" v1 c9 i
    mov     bx, cs
5 a* E, _5 K5 m/ O3 t5 _    lea     dx, int41handler4 p# x# c3 g, I# O! N- W8 M0 ^
    xchg    dx, es:[41h*4]
6 E( g3 r! h6 z8 e' v    xchg    bx, es:[41h*4+2]
7 A/ ^: v/ [) D2 R' }1 n    in      al, 40h) e* h7 B8 Q2 o5 q4 e# G. w
    xor     cx,cx) a8 `! E  _0 C9 e4 l8 [
    int     41h3 L6 n8 s* ^! X8 p$ S9 N/ O* Y7 z: Q
    xchg    dx, es:[41h*4]
% ]8 S/ x9 Y: O; o    xchg    bx, es:[41h*4+2]2 c  u: I6 I  a( r# J
    cmp     cl,al& L  L& n$ _- t$ E+ W2 U
    jnz     SoftICE_detected( ~0 }! A# p9 w' H5 \+ z* i7 p4 ~

$ m' ~, G/ f& m_________________________________________________________________________
. x/ w: t4 ]3 r2 E9 u1 n$ @
- x4 @9 t. t! P! |Method 07
; F- T/ e: q  I1 c5 r: ]=========
8 B% Y  u/ Z+ J  f# [3 O6 |2 M/ L; K
Method of detection of the WinICE handler in the int68h (V86)7 O+ K( Y7 _1 Z7 U! D

" N; [& s- B: _8 w    mov     ah,43h
7 p6 F. Y$ R' U    int     68h) I7 C: B" {- h! R
    cmp     ax,0F386h  z- R2 P* Q2 }3 K! A
    jz      SoftICE_Detected+ e" c" }2 i! u
/ f1 `6 f+ K3 ~+ j( \4 O

9 g# q, z9 i/ I5 Q/ I=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit1 R0 k& X" P, S$ {8 N: {
   app like this:: p' p1 `% M1 J' U# z" P

: X5 W' c# k; g! K   BPX exec_int if ax==68
3 z3 v, v4 K: c% p; d$ V1 V3 |   (function called is located at byte ptr [ebp+1Dh] and client eip is5 M6 Z3 R  j2 V9 g  M
   located at [ebp+48h] for 32Bit apps)
" F8 G9 ^: ?$ ^' s, S__________________________________________________________________________
/ Y4 U3 N; c$ R6 ]' ?9 C6 \- _2 `
$ _( f" Y( |& b
4 r5 ]$ Q" q5 t  H7 h  w3 ^Method 08! \# Q. ^# J" P; \; D: t
=========
7 a5 p2 j5 D. N+ k) B" [3 I7 C' r( L# ?- K8 K( V7 ^" G
It is not a method of detection of SoftICE but a possibility to crash the' P5 q# m3 z, n: c: K/ Z8 o
system by intercepting int 01h and int 03h and redirecting them to another
. \0 e! R5 f% uroutine.$ H" u& Y: p+ ]5 b2 x
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points9 Q& p: E4 w3 C' q
to the new routine to execute (hangs computer...)
8 _1 A" ~- n' }  k/ \0 u( c: M9 B8 x; f- O. E$ L# {
    mov     ah, 25h
4 U* R' v' D' Q4 a0 \* j* r    mov     al, Int_Number (01h or 03h)6 Y6 p: q& O: O, v# m5 A' [9 W) Y
    mov     dx, offset New_Int_Routine
, i+ D& X, N5 B! N/ }% S- G    int     21h0 i" v7 m6 h9 q' r, P  H
+ m' C- j' V' b& {0 [
__________________________________________________________________________
; C) N' r  Z2 D) @: @0 `5 w$ ?' P, c0 e, F- ~* [
Method 09
  n. T0 m" X2 }=========
6 ?; h# u# h( t! ]3 _8 Y2 c" _- B# G" y, ]4 [
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only: w! u+ k% G: n4 U( F8 `
performed in ring0 (VxD or a ring3 app using the VxdCall)." F9 W  H( |. X6 q9 f2 q4 N) ?
The Get_DDB service is used to determine whether or not a VxD is installed! E1 R# A9 l, T- }# D
for the specified device and returns a Device Description Block (in ecx) for
5 t* i+ b# y0 A: q0 m3 ~/ Nthat device if it is installed.
! O( k$ n7 A4 @5 G. U5 j
# n* [( ^- g( X8 N; e   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID+ v7 ~0 a5 w' ?  g& l3 A
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-): L9 R, |+ z! R1 C. m3 s
   VMMCall Get_DDB( M* Z! b9 p! i1 `- e7 @, d  P9 ~
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed/ V5 v- ?5 V, c, D3 \

: P, i+ I  j& q( VNote as well that you can easily detect this method with SoftICE:6 o. e0 {+ H# m: r" w" u" \1 F
   bpx Get_DDB if ax==0202 || ax==7a5fh
' m2 r! i0 d6 N
9 C- ^/ D" d1 h4 F__________________________________________________________________________
. B3 A5 J, \+ r' w* Q
6 x3 j# _9 Y8 u6 a8 u: K6 ^Method 10
5 Z  y: a: f# ~) Z=========9 v$ w  p: y8 x0 p8 _2 }& f. {

" [1 p% G$ s1 j; k8 p8 j8 h! U=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
/ I% z( C/ B: v# k# r1 d  SoftICE while the option is enable!!8 u+ w$ R9 k( H" Z+ ~( V4 _- R

, m$ f& d, b# `6 G9 K- _# ]This trick is very efficient:
+ O# m" r0 i8 P2 \by checking the Debug Registers, you can detect if SoftICE is loaded
5 j* Y3 m' K6 d1 x(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
$ q' u1 I6 V8 F/ z' dthere are some memory breakpoints set (dr0 to dr3) simply by reading their$ V7 c* ?& u4 N& ~  v, T* m- f1 E! S
value (in ring0 only). Values can be manipulated and or changed as well
5 Y2 U; Q6 y9 t) G(clearing BPMs for instance)2 r8 D4 }! \! D2 M8 E
+ d" X  w( k2 x6 b
__________________________________________________________________________
. P- {6 Z' b6 q4 l. {
, @3 M; J/ i" r- e( yMethod 11
0 \3 G6 d9 M4 Z: e=========
9 l' _) @; w5 H; x' Q
. ~6 R) [* H6 J$ J. \This method is most known as 'MeltICE' because it has been freely distributed
1 c- p+ `: d" e' L# e% M# h6 mvia www.winfiles.com. However it was first used by NuMega people to allow5 O* Q7 ?% E" H9 Z) |
Symbol Loader to check if SoftICE was active or not (the code is located* |+ N5 @! T' r
inside nmtrans.dll)." r6 q( z* V- f8 M7 F# y( [$ X: q' n4 j

4 w# }& b% o4 L9 n. K+ [The way it works is very simple:
2 G( f. }$ |/ R0 t! \/ rIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
) p( V1 r3 d1 N( S7 uWinNT) with the CreateFileA API.
- T; Z  W1 d( }) ~- c& R
4 U. N& e7 [- s' ]/ w$ f: s8 LHere is a sample (checking for 'SICE'):2 J, X/ R9 P7 i  b+ B6 k8 E

  ]9 S3 D' X7 t3 @3 Y8 jBOOL IsSoftIce95Loaded()
5 b; j% H; w8 u8 k% F{
$ n+ g7 ~5 A5 Y* u% K( N   HANDLE hFile;  
" z$ ]  F, M% K0 I$ F' I   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,& l( L3 s& Q* @& r5 [
                      FILE_SHARE_READ | FILE_SHARE_WRITE,) F# u* g6 W! d; [' D" L& e
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
2 \3 Q# _) }) O$ Y9 @9 P   if( hFile != INVALID_HANDLE_VALUE )9 m' n- I# |  j! ]6 l, @; j& T: h
   {% E8 ^) V9 w6 T1 i" r4 ?' p
      CloseHandle(hFile);
: @( X- F% q- t) Q4 ^      return TRUE;
8 V4 o7 l* X# P- v' t3 Q6 O   }8 p% i* s4 x$ k
   return FALSE;
( i* o2 a3 x2 [) X+ s4 |1 T7 G}
2 w9 f( E+ c$ T* b! T
6 ~6 D- a1 z6 N2 `9 L* oAlthough this trick calls the CreateFileA function, don't even expect to be
& w0 ^+ I* A3 x8 N' H+ A9 @) @able to intercept it by installing a IFS hook: it will not work, no way!
5 g! r& _  f( [1 C1 v" q7 H; L7 x# TIn fact, after the call to CreateFileA it will get through VWIN32 0x001F  g1 k9 r8 B, R8 _
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)8 o5 `8 z/ A% A* ]2 |( u
and then browse the DDB list until it find the VxD and its DDB_Control_Proc
" z1 d7 R9 Y+ R3 Tfield.
5 L" b" o0 b" T5 `In fact, its purpose is not to load/unload VxDs but only to send a 7 P  J& b/ {& E1 v% C3 Q
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE); d" z4 @" k$ D! x  E/ S8 ]/ \6 r
to the VxD Control_Dispatch proc (how the hell a shareware soft could try
, v9 Z8 Y# s4 b3 cto load/unload a non-dynamically loadable driver such as SoftICE ;-).1 F: D" a( _. e0 p& c  p5 I) L" a
If the VxD is loaded, it will always clear eax and the Carry flag to allow0 A& p6 F0 @6 U" j/ p
its handle to be opened and then, will be detected.3 W/ ?$ n( {/ T' q
You can check that simply by hooking Winice.exe control proc entry point! K' {( |" D% w) n7 O
while running MeltICE.
1 O1 S$ |5 n* a
( k, r) e1 S1 ~. m; U' k: G. @) B% R3 N& L1 A# B) u( @3 D) T
  00401067:  push      00402025    ; \\.\SICE
" T/ u- k6 U1 j( m$ o1 S  0040106C:  call      CreateFileA
6 j0 Z3 l8 _0 J; V  00401071:  cmp       eax,-001
) T  T8 \' E) Q$ N) b  00401074:  je        00401091
- g( y( u6 }5 z$ t
- A; y( G* `( l
) n  h& ]. Y4 U4 q, |/ NThere could be hundreds of BPX you could use to detect this trick.
& j' x" h8 o* k6 z1 z; n-The most classical one is:
/ j( C- {% W) }. f  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||8 M/ @, X3 H" n1 a! N
    *(esp-&gt;4+4)=='NTIC'
  ?3 Y9 O- ?1 V( }$ ^" \4 b
7 P" h- V% W, D) n0 r-The most exotic ones (could be very slooooow :-(; Z6 y1 E/ |3 c6 v& ~( C9 u
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
8 C" P* N$ ]- s( U     ;will break 3 times :-(* d) g1 x; I( H: ?: N

" `, y: l0 |! b, F$ L7 ^% b-or (a bit) faster: ! N2 @" F. u; K3 O6 `* K$ s7 e2 z
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
2 G+ S; H0 L. L  Y4 W+ _; p6 p' b& ?2 c/ a3 j' {
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
7 Y) p4 L, d7 z3 C, U6 J, ]1 S( V7 l     ;will break 3 times :-(4 ?, ~( J% X: ^3 A9 R1 G
: p, r; W! R5 x& M5 t* Q- v% ^
-Much faster:
! i6 U1 `2 M1 {3 w  ~: Z   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'0 T: r: g% B( \! i/ v, G

7 c1 {) k' t* w6 KNote also that some programs (like AZPR3.00) use de old 16-bit _lopen
/ X7 n0 B1 y7 {" S( M# @function to do the same job:* p! L( `$ @7 l( `1 D. a# E
" |- Y+ W4 ~% J. B0 S" f
   push    00                        ; OF_READ$ N5 T+ X' m" @3 J3 \3 b- D
   mov     eax,[00656634]            ; '\\.\SICE',0- Q! L. w- |& N, {1 R  i( J1 {
   push    eax: K6 T" T- E/ j# m
   call    KERNEL32!_lopen
$ D* F* ?( E0 ^. B- C& _. [   inc     eax) K8 L# g3 Y' L" s5 a! A
   jnz     00650589                  ; detected
6 Q# Y3 c) y2 J! _+ \, I   push    00                        ; OF_READ
6 U5 v" q: V% I' c% H   mov     eax,[00656638]            ; '\\.\SICE'- j; K# V* C/ z
   push    eax
  g4 h: T" ~% s   call    KERNEL32!_lopen
% P* D% A, m3 o& t+ g6 @   inc     eax" L* P" O9 A* |8 U5 {$ T
   jz      006505ae                  ; not detected: n2 @/ Y: B! d# c6 T$ v, W6 w# o

; c9 r3 R/ Y0 m6 B$ B, b
4 T8 Q6 I* M. {! U( R__________________________________________________________________________+ t) n$ x4 ^# u$ F- a# ~! y( x' d
: K. F' C/ n( k
Method 12
5 z/ i1 p+ p4 m; P! A4 V9 Y=========
- d" y; m- \0 C! ?/ E2 S( W/ x* Z) g% ~9 `
This trick is similar to int41h/4fh Debugger installation check (code 05
& Y1 e8 l' o# h! e# w! d4 j0 u&amp; 06) but very limited because it's only available for Win95/98 (not NT)' Z$ U( c8 R/ e7 b4 z* b9 P
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.9 i' k- Z1 C  e# z3 @

% F$ L' k) V/ }6 Z, c1 O   push  0000004fh         ; function 4fh
$ D7 z+ E# b9 }* Q, h   push  002a002ah         ; high word specifies which VxD (VWIN32)
3 I. u! L3 \6 J9 j. `                           ; low word specifies which service- `; _+ {+ M. m/ d. j/ o
                             (VWIN32_Int41Dispatch)- X/ D+ H7 {5 O( T
   call  Kernel32!ORD_001  ; VxdCall
9 L! `1 a; a. c+ T( c   cmp   ax, 0f386h        ; magic number returned by system debuggers) h! `6 i+ ~+ _
   jz    SoftICE_detected% }8 M5 s, e1 g+ [; n

  S$ m$ Z' X4 Z7 UHere again, several ways to detect it:
2 u8 Z. c; s6 w6 H$ @; B* ]# S3 P( Z8 e, K
    BPINT 41 if ax==4f/ ^: g  n: ~5 G* s9 o

% `* n4 R$ Y, Y; H' G) p' \+ t    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
9 h+ D0 i! H; M7 r4 D8 I2 g5 y! @! I9 o. b
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
- L$ v# T- v$ y( p" Q1 c* l
$ S0 _' H* U  P% U    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!1 B, R( t4 J. Q! m6 B$ |

+ Q# F6 V4 a; h6 R4 \__________________________________________________________________________
1 G+ e; Q! N$ R7 C$ W" y  ^" e- `3 D+ X' j6 k+ x  j
Method 13
& ?, ~( r/ E; R6 L0 N: e=========6 F) {; I- k* I4 Q
! [8 i$ o5 W1 U6 M( I7 j/ A9 f# Y
Not a real method of detection, but a good way to know if SoftICE is
+ l5 ]3 i7 o' [* k1 q5 D+ Linstalled on a computer and to locate its installation directory.% y: W  H! C3 l
It is used by few softs which access the following registry keys (usually #2) :
; Z1 `1 s. J8 Z: |0 j
! Q  b. S/ I7 G. }% i' F-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
+ j  k5 H. [" p& _\Uninstall\SoftICE
9 b' `4 [* |; D# V-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE$ ~0 L/ t% a, d" X, f/ q$ D
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion* V9 O& ^2 p0 O: H
\App Paths\Loader32.Exe
" C7 V  F* O4 `8 h9 z& H* X
* R6 K! l/ X* B6 }" q% m* u9 D( |0 w" m& Z
Note that some nasty apps could then erase all files from SoftICE directory8 h5 A+ V6 {3 B# C
(I faced that once :-(
' L" Q+ ?6 \- B' F' R* P! L! B! S1 L1 c2 ^' b9 p
Useful breakpoint to detect it:5 F; Q9 x" g0 f" H
' r. R5 |* H; M2 M( y0 S. s
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE', \2 b$ o4 F/ g; i* ~
. \; s5 c  X8 G6 `7 e: y, c3 }) Q
__________________________________________________________________________
5 z# J& |  C  {; ~3 G% d
2 k! v& `% V! J$ I+ Q( @8 w' J( ?5 K
Method 14
& J1 @5 j1 [" p" N=========
& V# Y9 ^" m; h, {0 c) ?3 ^* n+ B" H. S; G# b1 h6 v1 `1 }  o
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
* ]# X' ~8 k& J: H) t/ Q8 Cis to determines whether a debugger is running on your system (ring0 only).
2 A* N( h+ t9 r7 ?# I1 V3 E! a; X$ e: P3 |6 T7 y9 a- `' z
   VMMCall Test_Debug_Installed
, u  `' M  y! _9 o# `6 n   je      not_installed
6 A0 k" |/ c$ d9 ?: d6 R6 _
1 y! n" j1 Y$ b  S" t, ^7 LThis service just checks a flag.
$ |' x3 S( ?! h; k% F# b1 x</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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