About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>% L. C" E/ B; }* a: G9 w$ Z
<TBODY>
& u+ M/ f3 f' K7 ^7 }9 h4 F<TR>
3 d5 u/ t; e1 ~- p+ P<TD><PRE>Method 01 ' F! T' D- z2 c% ?# ~, ?
=========8 \' T7 v5 O- H% ]" `

% B# p3 r1 I! L( ZThis method of detection of SoftICE (as well as the following one) is$ I" Q/ @8 ^5 k$ G. [8 _
used by the majority of packers/encryptors found on Internet.
5 l9 ]$ v0 D3 ^It seeks the signature of BoundsChecker in SoftICE
; l0 u2 y7 ]+ I# U! e5 U
8 M! X' J4 n* B6 R# n    mov     ebp, 04243484Bh        ; 'BCHK'
6 K3 ~2 q  j/ G( ]' Q  K' m! F    mov     ax, 04h) v, O$ @$ {' a& R
    int     3      
7 ?1 j8 ^' b% b  w" \    cmp     al,4
# t6 v( J$ i1 c( a! R% o    jnz     SoftICE_Detected
" [0 c  {6 G$ j. y8 \1 M0 B% g1 W9 ]
___________________________________________________________________________* V7 t9 o, J; L' q) s& h& M! y% N
8 P6 \$ c' E: _8 W, Y2 T3 z) _
Method 02
  {& ]% c0 m! D  X=========
8 v, q% j3 n8 N. j% U9 L4 q8 i7 o0 c0 T' Z6 E0 @
Still a method very much used (perhaps the most frequent one).  It is used
" ], @: A) z& W/ h" L* G0 gto get SoftICE 'Back Door commands' which gives infos on Breakpoints,
, r3 Z4 f$ Z8 Q. `9 i7 B) Mor execute SoftICE commands...
9 d8 f- o; T+ D+ rIt is also used to crash SoftICE and to force it to execute any commands
0 |3 i! Y# l9 q8 J) Z+ y( R4 t(HBOOT...) :-((  4 u' m- A* {+ K' m1 y+ D  b
( F1 f' S; l$ Y! v: R+ d
Here is a quick description:( Y: D6 T" D: k/ j/ M6 a
-AX = 0910h   (Display string in SIce windows)
) y0 Q8 _' L% s' h-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)8 \6 {+ {1 \6 z) w4 Z
-AX = 0912h   (Get breakpoint infos)& K, l  @( [9 t2 r% v
-AX = 0913h   (Set Sice breakpoints)1 c% |/ ^6 @. `( t
-AX = 0914h   (Remove SIce breakoints)" W7 e8 D) m1 }
1 X: M! S; N! j" I- ~! b
Each time you'll meet this trick, you'll see:
. k+ k; X$ v  U2 ?& |$ N3 f0 v+ L-SI = 4647h- K1 j& m& e' x1 m1 q
-DI = 4A4Dh$ Q3 t& U. }( E3 b. C% ~" {
Which are the 'magic values' used by SoftIce.( x4 z9 }2 t  B2 S
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.
& Q  h5 ^' W$ o8 S& j7 O
: `9 S0 C" j5 Q# k& _$ I& L+ m- EHere is one example from the file "Haspinst.exe" which is the dongle HASP2 t' r# z( x9 O7 P! w% Y$ s
Envelope utility use to protect DOS applications:; k% `- ^# ]0 h5 J# C9 K$ Q

$ g* S7 u( x! v/ G% x8 N/ z2 n
. k6 u2 U. o7 Q' O4 I4C19:0095   MOV    AX,0911  ; execute command.
6 N) G" h  M8 w# |4 Q) d4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
, i. g, j9 t$ p  w0 ^4C19:009A   MOV    SI,4647  ; 1st magic value.  W8 a4 j! ?# p; O, L
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
1 z! D$ R0 |2 Z9 q5 f3 a4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)8 J7 n7 u2 j2 S$ y9 m
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute" K/ T, P) w4 K
4C19:00A4   INC    CX
3 u: E' D6 |+ c' c5 v( ?4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute* p" J9 R9 Z5 J$ y& U- l& v+ z
4C19:00A8   JB     0095     ; 6 different commands.
9 _: Q0 S6 d* k# U, a9 w& R4C19:00AA   JMP    0002     ; Bad_Guy jmp back.' b# m% ]$ C, u- {! i) y
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)* R% x* |) c1 E; F, `, p
9 T: @- {! _' E. {
The program will execute 6 different SIce commands located at ds:dx, which" d2 D+ P3 p# `+ D' x; n+ X* K
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
: j$ I. \2 d6 R7 J; H" k" V
9 w3 J% z" }' m$ g8 J0 _* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.5 t2 O0 z2 k) T. ?1 s: h# u
___________________________________________________________________________: ?) L  n$ l+ L6 w

2 B6 D& Z$ \- {% `
) p! I4 [& r( g; QMethod 03
* F" `& H6 @" t  Y. s=========
3 `8 r* M1 T  k! L2 b3 Y7 _
8 u" b# W  e8 n  Y: w( U% XLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h/ j: _) {3 r7 g
(API Get entry point)5 p: N1 a' p& T/ j- K& y( k
        
6 @0 m7 r1 L$ M6 H% o, g. G$ {+ |% T+ x8 d9 B
    xor     di,di8 u" H) w' J3 |0 v5 h9 L7 P
    mov     es,di/ S" q2 C' S) g( c# M
    mov     ax, 1684h      
8 G4 M% y3 B3 K% `5 s    mov     bx, 0202h       ; VxD ID of winice
" Q+ Q& c$ r5 X  W( q    int     2Fh
0 i9 m0 r1 c' F+ s    mov     ax, es          ; ES:DI -&gt; VxD API entry point
) D0 F9 W2 `! r) ~- j    add     ax, di
. R3 j) z6 n1 T2 N3 O1 \    test    ax,ax7 m' r( D$ R) B* N6 s/ q
    jnz     SoftICE_Detected
4 s- U& m6 b5 z9 l. Z- S9 w* e& M8 X1 C0 g5 H# B  C* v3 X
___________________________________________________________________________' ^( U; _2 |9 Q+ {

" T& k: T! \; N; {Method 04; L. b& S) ^, l) T) l; M: T# S( @
=========
1 Y/ d/ r, B' d2 e1 ^
' c* D: z- \. O7 v) s8 bMethod identical to the preceding one except that it seeks the ID of SoftICE0 |# S6 _; w8 p6 u3 T# T
GFX VxD.
2 j4 z' l! x9 i8 a
+ _7 a, o+ _# ?    xor     di,di
5 ]( {/ K( Z( N+ [" P' z  r. p    mov     es,di3 [) j) U% Q. N, Z9 T1 C
    mov     ax, 1684h      
  N1 }$ f( G5 \2 E% H+ k0 Y    mov     bx, 7a5Fh       ; VxD ID of SIWVID
  L& i3 h) X" g) U    int     2fh
, Z- z7 n5 S( ~1 i5 g    mov     ax, es          ; ES:DI -&gt; VxD API entry point. y! C% X& m. _5 V1 w7 g/ R
    add     ax, di
; c% n  F# Z0 D) g9 k, w- D; |# `3 j    test    ax,ax
  E, g( w3 a' N    jnz     SoftICE_Detected9 r5 V; e2 p& Z; l$ t4 i) ^$ _
$ X* t! ^* ?4 z& Q6 F
__________________________________________________________________________7 X2 w: Z3 A/ R4 ?$ ?( j

+ k5 y4 ?9 Y! Z3 x3 P6 ?/ C  n5 Y( A: f3 N
Method 05! @6 V8 N- }8 _# V, p& k6 e) [# q8 P
=========6 c$ D" _% d+ K& c% z
* D2 q3 r: O* J% A: A; }$ T
Method seeking the 'magic number' 0F386h returned (in ax) by all system
" P6 N/ T6 r' F; O/ Rdebugger. It calls the int 41h, function 4Fh.! L1 m' v5 ^7 D: m; {4 _* E& v# M
There are several alternatives.  ' Z# x2 N9 {) ]2 T- T7 D: @
7 Y8 y3 Y$ p/ [+ B9 i- y* f' C/ {* _
The following one is the simplest:$ v2 [1 m' h3 Q4 Y  C

7 Q6 F" {" I: c% b    mov     ax,4fh7 b( k% e6 J, w) R% @
    int     41h
# [; ^+ ?) N" m  y) f* w2 K  l) i6 W    cmp     ax, 0F386
- `8 _0 ?* }3 }    jz      SoftICE_detected
% w! d" Q  {) C' Z) @( ^
- h8 t+ E  l4 L0 P5 j( Z8 E4 x( M6 Q6 `. \+ ^
Next method as well as the following one are 2 examples from Stone's
2 ?6 I7 ~8 o* p9 |% Z* ?) g' q8 E"stn-wid.zip" (www.cracking.net):. Z8 ], s+ t5 R- [( N6 H* ?5 B: Q

/ J6 K/ H1 x5 R* c9 r    mov     bx, cs
5 ~. y" C4 v& K2 h& t  w    lea     dx, int41handler2
9 S# M. p+ ?" t+ |: L, b    xchg    dx, es:[41h*4]
2 Q- b1 n- Q: U) p    xchg    bx, es:[41h*4+2]
, W2 \5 g+ q  Y3 O& |5 s5 O    mov     ax,4fh5 g" y, {) n( K7 V
    int     41h
: O7 e. ?6 @, [) _+ \; T3 g7 L- C7 _    xchg    dx, es:[41h*4]
, J6 Q) W( `% `2 M8 ^    xchg    bx, es:[41h*4+2]
. V7 ^3 W3 }1 R) B+ E: e! r    cmp     ax, 0f386h
, m" [  o, p5 B; V' Q: r& x; H    jz      SoftICE_detected
1 A; S4 X3 Q7 @9 C2 P* X- I, n0 w& D0 J) b% t3 e
int41handler2 PROC( Y- C1 r0 S$ K- H  E0 ~
    iret$ g/ S, S  ~5 w- ^* j3 _2 P0 h" u" F
int41handler2 ENDP- k3 p; ~  a! j2 N8 _6 p' ]
* z( U, ]: H8 Y
7 V2 I9 y) y1 m2 Z
_________________________________________________________________________, j# @7 N6 C, h3 U- L$ i9 j0 Q$ o

$ p! q  S4 n, u  D" l$ V5 H" ~: T/ h4 D
Method 06
: h( n8 R% ]6 L0 S+ S! J5 w$ Z+ {=========" R  L0 y! T! d6 A, }7 S) ?5 a

  ]5 c. W. t7 I3 D* k+ c$ F1 u; S- n
2nd method similar to the preceding one but more difficult to detect:9 ^6 t( u: n5 N0 E3 e
& `- K/ _% {) x
" q: q8 o' ~1 q
int41handler PROC# i3 e3 P: k1 `
    mov     cl,al6 q/ v+ k0 p4 P5 Q, L
    iret0 u# f0 L9 T3 [, @/ y0 e
int41handler ENDP
3 p* M( c& h9 a% a1 ]0 M" V
& X# i# S- I( n$ @6 J+ K
4 p# @( y% n) ]& O& z* X( @5 k0 Q    xor     ax,ax
* _* k. s# Z- X& k3 j) U/ z0 c! \    mov     es,ax' r: }8 }4 K- Z! D2 }, ^
    mov     bx, cs0 |5 {0 \, B/ A4 [
    lea     dx, int41handler; ]" p7 s6 q& h* I* T0 Z& L; ^" I
    xchg    dx, es:[41h*4]% x& z' R" Z# A9 K+ ?( J
    xchg    bx, es:[41h*4+2]
( E' h: m8 S- F# z" @1 C: F( T    in      al, 40h
( R* K$ A1 Q+ M    xor     cx,cx: j) a. E/ {3 y, a
    int     41h
9 \. B6 q; E$ @3 o    xchg    dx, es:[41h*4]
# |" l  p  U9 ~2 h2 H    xchg    bx, es:[41h*4+2], P& [; j& n* t+ p9 O  G  j
    cmp     cl,al! ^) b( y: @7 j
    jnz     SoftICE_detected" P! h! Q7 Y7 \3 z& p% b$ ]' K8 m6 D

* V7 e8 ?9 E7 Q* u0 L_________________________________________________________________________
1 S+ q1 U. p2 J8 @, s" B2 V  [5 ~  h( S1 [8 R  d
Method 07
( Q* o; O' K8 M8 U5 ~; d=========
( y' \/ `* ]7 F! o; q0 N1 X# r6 ^" S& v9 V9 o& ~
Method of detection of the WinICE handler in the int68h (V86)+ I: o' d; v# \' F1 U* G' p! C
6 R1 t& h' w6 Y, z" r9 M: T
    mov     ah,43h9 S9 T1 p: q" b0 I, |' D, r' t5 T
    int     68h
: \0 \; S7 @" c. O6 w3 Q# q: e& }    cmp     ax,0F386h0 |( j5 _8 _' M7 E% b
    jz      SoftICE_Detected+ g& t; L/ y9 A/ _' ?7 _4 h' ^

# ]: q- S8 S% _* }/ {& X; r0 a/ V. L
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit, m: s% d2 j, E! d+ S
   app like this:/ C) i: P- e  x9 [# {$ A' a
; l9 Y( U6 ]3 Y: Z
   BPX exec_int if ax==68
1 \" Z% L; U9 a4 W   (function called is located at byte ptr [ebp+1Dh] and client eip is. ^, ^1 o8 ^8 K: r$ B# E8 |% u
   located at [ebp+48h] for 32Bit apps)* @. F1 H1 N# X8 N9 v, v
__________________________________________________________________________9 d% Q( b# e2 L& ~
1 K5 _; T8 p3 ~% A

- \* t* q9 x, |3 \$ y% |Method 08
+ N- u& K* A# f& u=========( B( {1 m. u0 b) J7 I
' U3 b( e  C9 L) ^
It is not a method of detection of SoftICE but a possibility to crash the
  N9 d4 h' }! i# `* n" f. q8 Qsystem by intercepting int 01h and int 03h and redirecting them to another* H: Y5 n  d- G9 _% Q
routine.
$ I$ t: H5 y$ k; ~It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points0 A  y% K5 [1 y2 \! ?
to the new routine to execute (hangs computer...)& ?! p4 R* w% H  a$ x4 ]+ a( N" y
( f2 f6 u! ^  A/ s8 s5 Q# d2 d7 |
    mov     ah, 25h: }$ p- q' E2 ~' m) f! I
    mov     al, Int_Number (01h or 03h)
" S$ ]( v! a1 ?. j, B    mov     dx, offset New_Int_Routine
6 C/ ]) ^7 w1 B  g    int     21h- t6 b6 l, L  {" L0 s0 a  j

0 M3 l1 R/ m$ x" n/ f__________________________________________________________________________6 f# k, H) o9 n0 D; Y6 N

. o" p6 ?1 c' s9 _' c& @& I2 {Method 09
2 @+ K8 j; V+ z6 P8 ~/ M=========( ~9 B/ s# V$ A( w2 e
) f  o8 d  z7 ]2 Q
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only" X% n/ @3 B! M4 p
performed in ring0 (VxD or a ring3 app using the VxdCall).- B$ p% h" z8 ~/ [9 U* F8 E
The Get_DDB service is used to determine whether or not a VxD is installed( }& c% `7 l0 \! j
for the specified device and returns a Device Description Block (in ecx) for
( g! ?! r- E& h. z5 W6 ?- ]that device if it is installed.
6 F& w; @% K5 N! F; ~
- n5 Z4 t7 j+ z% A   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID& S& o& a# k4 m% ?
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)$ L" w" s' e+ f0 ^
   VMMCall Get_DDB
2 k+ p* }+ B/ T4 o$ G6 y, x" e, r3 @- J  H   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed8 s! h) Z, G) G& U8 P* V7 f. u
9 G. n7 V# _" w1 d
Note as well that you can easily detect this method with SoftICE:
0 U" G- A7 g: ]: S# U5 S: j; t   bpx Get_DDB if ax==0202 || ax==7a5fh
1 g( A1 W+ F8 A0 S& N: J+ j2 k! t. `7 S$ M
__________________________________________________________________________. [2 e0 Q% R- J

2 G; v9 I. N. N8 L- [/ J7 \+ z2 }Method 10
, Q6 M0 ]7 \# b  x=========
2 n1 H. _/ g% V! S1 p+ G% }( f9 q: e$ [5 J/ D- J6 {2 \# L
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
% f+ K) Y" A$ D& G9 c  SoftICE while the option is enable!!! U2 ?0 F4 g- p; [" a2 V' O

  x) i0 A9 k" z9 p+ B& kThis trick is very efficient:: E1 k  u' Y1 U# f7 ]8 ~
by checking the Debug Registers, you can detect if SoftICE is loaded( {. e# V+ C7 i
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if3 o3 g( j& s+ M+ T8 Y
there are some memory breakpoints set (dr0 to dr3) simply by reading their) Z/ H) c/ _& d/ v
value (in ring0 only). Values can be manipulated and or changed as well
2 K9 G: }& {8 a4 a(clearing BPMs for instance)
, s/ \% b2 C- m* X+ s' d( m% k
7 a  L" P# Q' A% B2 ^/ z' `__________________________________________________________________________. q0 M9 r0 y( ?2 t* o& s
9 e: b4 s$ n' w" c6 {
Method 11
; [3 b# F( v$ b# U=========* G2 h! v" Z9 ]: ^! N& A

. _! K3 z) T* l* N- ~  h! ]This method is most known as 'MeltICE' because it has been freely distributed7 `) d* \' T, d$ i9 d
via www.winfiles.com. However it was first used by NuMega people to allow
  }) S0 y, J5 h" E- w; c3 MSymbol Loader to check if SoftICE was active or not (the code is located
8 x4 U0 f, H9 O  oinside nmtrans.dll).  |' F: b1 `6 _: N& o) a  a& [
( ^4 ]# s( u8 q6 ^
The way it works is very simple:4 T4 z* Y7 A+ b' Q. T* S
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
% P. a! P) I2 zWinNT) with the CreateFileA API.
! }# O: x1 A/ i9 g. o/ L
9 }4 T9 m% j6 b4 S  z# h. HHere is a sample (checking for 'SICE'):
( k# C% D4 ?; G2 c; G  s+ c. g" Z- D
BOOL IsSoftIce95Loaded()
+ J7 I% l, C$ I' _6 \0 ?0 N{3 I2 Q+ r( ]# b
   HANDLE hFile;  
7 {3 q5 ?; _+ ^- p& {   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,$ ?* k& F8 P* Z! v0 }; e
                      FILE_SHARE_READ | FILE_SHARE_WRITE,
, t5 {$ V6 U8 U                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
$ F$ c; x7 N4 p6 A0 b   if( hFile != INVALID_HANDLE_VALUE )1 W' U& K' l# ?1 V8 W" t
   {
! j' h) c+ B; @. @; G      CloseHandle(hFile);
- Z+ j2 y/ {! `      return TRUE;3 C6 R3 [! m0 ^7 q' U% g9 b' O! D
   }) e3 u+ ]& n& `3 I& ?$ X
   return FALSE;9 i9 O# \4 N2 w( U% n) i) N4 P
}
& L" k/ A% {8 y$ u2 L9 i9 o& F2 _" w$ [
Although this trick calls the CreateFileA function, don't even expect to be
3 S/ W" J+ b. b: T! Bable to intercept it by installing a IFS hook: it will not work, no way!$ \( \- w  h5 U4 i# g( t! t
In fact, after the call to CreateFileA it will get through VWIN32 0x001F! Z, `- n0 c1 K, n+ I4 i
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)3 T: G4 T4 Z9 z4 i0 j, ]) {) n+ [1 R
and then browse the DDB list until it find the VxD and its DDB_Control_Proc$ x$ {7 T/ X4 T2 }9 I- a6 G$ j
field.
  A* [1 X) e, p5 o$ e" b; `' a% JIn fact, its purpose is not to load/unload VxDs but only to send a
. `5 T* I/ i8 \, v/ W& G+ QW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)# ~9 h6 B# ?; n) f/ C' U
to the VxD Control_Dispatch proc (how the hell a shareware soft could try9 F) r$ G' y* O8 I
to load/unload a non-dynamically loadable driver such as SoftICE ;-).
8 m# c- W3 d, [) [If the VxD is loaded, it will always clear eax and the Carry flag to allow
3 E5 t9 `9 Y4 q6 ?2 iits handle to be opened and then, will be detected.7 Q) _( M* t# \, Y/ X  Q
You can check that simply by hooking Winice.exe control proc entry point8 p+ j+ O9 i/ N5 D# ~& M
while running MeltICE./ K: n. ?0 N' z

) t  s/ J3 T. M' F5 G4 o; z( W; v7 m& ?6 ~0 o5 z) M: [6 w
  00401067:  push      00402025    ; \\.\SICE! u; U6 g5 @  M4 e
  0040106C:  call      CreateFileA
5 c! K! ]3 @2 J7 s, Y+ P  00401071:  cmp       eax,-001/ e6 i9 s/ G0 L- d# b" _
  00401074:  je        00401091
9 f; h2 `8 j" E$ o4 [9 K
, y$ I  c# p% {3 y4 z. M, F* K3 z& X+ t$ b/ j6 P" l7 w3 J; L
There could be hundreds of BPX you could use to detect this trick.
6 V2 y- \. i% U: O" K-The most classical one is:
4 O/ O( H0 d8 ^5 @, u' H  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
! H5 m) f9 x* D/ A9 b% B; ^* u7 |    *(esp-&gt;4+4)=='NTIC'
. _3 Y8 n7 M5 V9 q2 e
7 u7 e! w3 B, R: M-The most exotic ones (could be very slooooow :-(
7 L. P5 }. m+ C& N( k& V   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
" c, t1 w6 J$ h! m! }9 f8 @     ;will break 3 times :-(5 d7 y8 ?6 j0 w+ W0 L

; n: a/ G8 b! K. V-or (a bit) faster: , r& B: Y7 i% e; j% @
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
3 o9 \: _8 o& W7 f' @; M* r' i! X8 ?7 d! V* I+ W3 J, Q  W  o9 v
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
" t, J. j! j: f1 f     ;will break 3 times :-(1 f" v! }% }8 E. s5 Z
7 Y+ H* `! \7 B2 }8 o( `, a! ]9 p
-Much faster:" a6 Y0 |) s: J( j5 E6 R
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
& S* l1 V* S7 T" [3 y
$ X1 X: B. F. T6 h5 w7 k( C; M& ^Note also that some programs (like AZPR3.00) use de old 16-bit _lopen4 _% y, i! I: s6 D5 A, A
function to do the same job:: e5 \3 T& x" b: I% @/ a+ Y  N
. M/ K, G5 |' O
   push    00                        ; OF_READ/ m& f3 k. k) O( y
   mov     eax,[00656634]            ; '\\.\SICE',03 i# G+ ^, t0 `  e9 P
   push    eax) F/ v1 }! ^5 P2 W
   call    KERNEL32!_lopen
& {; y+ F5 w! v# x2 p/ F* S   inc     eax$ i3 O8 v$ O6 H1 K: X, d3 W' l
   jnz     00650589                  ; detected
4 p$ w; ?; C# u5 W4 h   push    00                        ; OF_READ* J$ l1 S6 ~. x% S' Q* k
   mov     eax,[00656638]            ; '\\.\SICE'
5 q4 {  O& p$ n$ ^: [3 c+ P% Z+ {   push    eax
9 {' F5 _8 A9 ^; _) L7 L+ x5 U   call    KERNEL32!_lopen
3 P, U6 ]/ ~; C6 v/ U) Q- r   inc     eax2 s) l* M9 a4 _* z8 ~. l$ O; w
   jz      006505ae                  ; not detected0 B" h# L$ G: k& a& g- n4 J
$ a( P9 ]) u( ~* l, P$ {1 @4 f8 Q6 P
: h  e5 b$ p: L. [6 r
__________________________________________________________________________! H! @: v9 n7 P7 b% I
+ W5 L/ l5 h' z7 K
Method 12, [/ U9 i$ C) u* B8 u7 d
=========
, C8 s9 y) p  f- f+ u7 x3 T% o" W. h* W8 Z# C6 F4 X6 m" _/ q
This trick is similar to int41h/4fh Debugger installation check (code 05  X' e: l: b( g
&amp; 06) but very limited because it's only available for Win95/98 (not NT)
; r# z% ~. C+ g; l; {: t' W# Y$ Gas it uses the VxDCall backdoor. This detection was found in Bleem Demo.
; I7 I$ G) G  y, H8 I" @  W7 A6 Z3 V4 x( l5 ]1 {' R5 }8 j
   push  0000004fh         ; function 4fh
$ J' d" s# X  q% G- U* r1 P" P+ T9 d   push  002a002ah         ; high word specifies which VxD (VWIN32)
! o5 L! m" f5 |% A# m4 A" w                           ; low word specifies which service
  e( }4 P. H! u                             (VWIN32_Int41Dispatch)3 x2 W) B& W: K" k, ?, B
   call  Kernel32!ORD_001  ; VxdCall
& L7 D0 A3 q9 m  T6 `   cmp   ax, 0f386h        ; magic number returned by system debuggers
2 H. q: B1 i$ t; k' `; z% E   jz    SoftICE_detected6 l% _+ C2 _! `! K

+ Y$ a* k9 ?% fHere again, several ways to detect it:: O. |: M! t3 `1 B! p

- K& a  }( D+ d. f; ]8 L0 O7 M    BPINT 41 if ax==4f
# T: T# U) d) ^5 B( ]: K! Y9 k1 M  h
( z3 @1 u% I9 R    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one; e/ k- \. ?8 v' I  b. y

1 i" g3 v4 e( ]8 k8 ~$ `5 X    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
: X  l' d1 e( X; n: z
2 R1 m6 e3 M# O    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!$ v8 T: v1 U; u# n3 F" {

, c  |# c1 p" J) L; p__________________________________________________________________________
/ G" L5 G8 u1 V3 R; J" [4 Z1 H- _: x: a" K& Q2 }; E
Method 13$ C$ Z1 S: J0 |% P7 z+ ]" u
=========* y+ Z# p; m! b. V  K! Z$ G

! w. @% [# s' @Not a real method of detection, but a good way to know if SoftICE is3 f$ u( l$ Y8 s; \9 f2 l; N
installed on a computer and to locate its installation directory.
. l# i7 i. S2 @) I6 E2 nIt is used by few softs which access the following registry keys (usually #2) :
3 V/ ~8 u* Z" b$ w) v4 W9 M+ z: h5 v1 @  k3 K0 p# x+ P: `( I
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
$ @3 A2 I# I+ d4 P# o1 O( s2 @\Uninstall\SoftICE
, |! r4 L' |& k4 d5 \-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
. w& x# w1 v& \9 g; K, `-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion$ m" Z" C1 e7 u7 o6 f# \
\App Paths\Loader32.Exe" _  n' S9 x- A7 H: B  K
# d; T9 _3 c$ v

: ?3 O9 g. V+ C$ \7 W- FNote that some nasty apps could then erase all files from SoftICE directory
7 T$ J9 R+ K: x% X(I faced that once :-(
, Y3 C5 }) g( }- t( G' s! V8 U4 l5 L9 q* m( @
Useful breakpoint to detect it:
+ P+ d+ H: s( I' z9 J+ r7 ], r. d& X  ]' X7 v2 s1 Z
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
' X4 v9 n, Q5 A2 {$ {8 Y9 V) ^0 M+ i2 q9 ^* G5 f( k5 x
__________________________________________________________________________' _7 J" v- w' C; c& C
9 d4 v8 R7 E' j& L

0 C* [0 o  F- D* X+ TMethod 14 - x3 N5 q: {1 T% E: U. g" V; d' E
=========
7 W/ e% j5 Z4 X9 R5 _" R. U0 f
' C& m/ ?1 x) o- f4 JA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose9 ?3 y) @, V, D) m" D& x
is to determines whether a debugger is running on your system (ring0 only).
+ G$ U  k2 R% k* O* `; f# G% p; X) b% O
   VMMCall Test_Debug_Installed
3 U+ `5 |* K& }, g2 d, |   je      not_installed
( i/ I. @- B7 n& s/ f# ^8 l( a* T# e3 b0 ?- A; B3 \8 Q' V( r
This service just checks a flag.2 c( c( M5 k  Q1 T! X' E4 m. T
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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