About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>0 ~% s) j, Z( O! D4 x( H
<TBODY>3 S3 L7 l. I  m$ X- u
<TR>
6 m( g! C/ x/ n) j; O<TD><PRE>Method 01
1 e+ q5 J( ^3 [0 L=========
: E" R  |- T4 {
5 W2 f+ P0 q7 x- OThis method of detection of SoftICE (as well as the following one) is$ V9 j/ h, b$ n6 A$ r0 H0 X
used by the majority of packers/encryptors found on Internet.
# J: k  a+ q1 s9 {- y, LIt seeks the signature of BoundsChecker in SoftICE& J4 E' k# S8 P
. Q  O3 z7 [0 c+ `& ]( t
    mov     ebp, 04243484Bh        ; 'BCHK'
. T) r, N- N9 I4 c    mov     ax, 04h
8 E& i% o6 |" T4 N    int     3      
# P( ^2 \* V" a0 `7 n    cmp     al,4
0 Q) T$ K. f; }4 o. _    jnz     SoftICE_Detected0 b1 H: W/ f9 a9 E
3 n5 f; F7 i  P- A+ V
___________________________________________________________________________
  d) U/ G9 N$ n- ?8 S9 Y/ N! n1 Z5 H8 p5 A1 G
Method 02- j3 T5 F( Q0 y3 }! c( x
=========
- }. j! c5 H) @$ ]/ `/ w8 f! D4 k4 X( B: b- ?. I6 [' a
Still a method very much used (perhaps the most frequent one).  It is used
% [* s# D$ j! U! |8 oto get SoftICE 'Back Door commands' which gives infos on Breakpoints,- H! h8 }6 j4 @  O; r6 h
or execute SoftICE commands...# d/ j0 z  w2 z  t+ q
It is also used to crash SoftICE and to force it to execute any commands
7 E/ Y+ z: L% @% n(HBOOT...) :-((  
. P3 W. s: X& l7 V4 {
' B" o' n7 a! D% n. p: e% LHere is a quick description:
  _7 W* V. h7 T, t) \5 b-AX = 0910h   (Display string in SIce windows)$ H: k' {; y3 {+ ~* G
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
! H' a. I4 j8 e% |' R7 a-AX = 0912h   (Get breakpoint infos)
# @. f( `; ?; T7 i6 c-AX = 0913h   (Set Sice breakpoints)
$ Z- ?; ^" B# J1 X-AX = 0914h   (Remove SIce breakoints)& z, w& u+ ?) n

. q9 i, u0 g* ]3 i$ Z% }% m- nEach time you'll meet this trick, you'll see:
1 _# C& g3 ?  y' x9 Z% I3 H$ z-SI = 4647h$ y5 {( `. _) o6 _# q8 C: c2 @2 R7 ~% c
-DI = 4A4Dh
2 h/ C  z) C: X: s0 T' [& hWhich are the 'magic values' used by SoftIce." `0 a6 X  V: X7 n8 P# ^7 Z5 i6 e
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.
! A% F& g' o( r7 J& ]' o6 }3 V3 O2 u3 r& `9 r: b4 C
Here is one example from the file "Haspinst.exe" which is the dongle HASP
8 E( S; d' W* c; zEnvelope utility use to protect DOS applications:. Y1 D" Q7 Q% {0 D$ V

5 A- Y9 q. B! @- `
, o& P, |1 m' I3 a. t$ l" G  i4C19:0095   MOV    AX,0911  ; execute command./ [& W- x0 Z3 X$ @$ i+ I( ~" e
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
' _& Q# a; {7 r4C19:009A   MOV    SI,4647  ; 1st magic value.8 p. F- a9 p& p6 \5 y
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
, B. g3 s* @( w) ?4 U. M; l& ]% l4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)4 G" o6 `2 m. ^) S1 A7 y# O
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute/ `* a1 \- T" e( m
4C19:00A4   INC    CX
1 C) M* J4 r* X  v# L( ~4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
& x1 R" u  Q# z/ B2 q; P% h4C19:00A8   JB     0095     ; 6 different commands.$ ]7 a8 o, B/ I! [9 Q
4C19:00AA   JMP    0002     ; Bad_Guy jmp back." L3 V0 O/ j8 e) |% g
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)& h3 m6 X3 x* O7 j% V

7 O& k) y! ]. S) A) e, ~5 hThe program will execute 6 different SIce commands located at ds:dx, which, l9 F; r, y1 a
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.& t7 V& D/ S4 u; }; N1 |

9 V% n9 c" ~. D  R" F% ?* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.5 ~" m2 M2 b1 N  ?
___________________________________________________________________________
  c+ w! H/ H7 _" b, s  O# j: H+ i& N$ T  o3 U

$ M0 @/ `8 Z4 \$ N- d8 ~7 P0 UMethod 03
, h4 B- Q1 @0 g* t  \=========1 n5 ?; V, a4 P/ h. G5 h
$ W8 m& ~1 {: }. o& L) A( s
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h( z; \2 ^/ ~" f/ _4 K$ L4 @2 q$ `
(API Get entry point)
2 W9 M" E- W8 Z: e" f/ [        
/ X% N2 G0 W# p$ u
& F) j' ^) ?' H  u# c  m1 A    xor     di,di, K0 M& i, o- ~6 |; c
    mov     es,di
5 r1 F" }( _# f4 P0 t6 _! M    mov     ax, 1684h       7 c4 S  Z& Y) |+ @4 H. C
    mov     bx, 0202h       ; VxD ID of winice
7 J6 ^9 ~: W5 t    int     2Fh% n  g: \( M% ?" Y
    mov     ax, es          ; ES:DI -&gt; VxD API entry point2 ?1 H* f- |" c% f$ c3 K
    add     ax, di# p0 ?% n$ e" V5 V" B1 R( Y9 t
    test    ax,ax" Y4 L4 S# P( }$ b+ k. }$ g* x) V, d
    jnz     SoftICE_Detected8 V  P- A0 b' o, o" X5 ?

5 z8 d( ^( A& Q2 C___________________________________________________________________________( ]6 h2 |' r1 f9 ~0 |

2 X) x& K; |, z9 j/ Y. Q1 {* PMethod 04
& o: {: j: b3 a2 S, n: r8 I& Q, e=========& j6 d* m5 G1 x- Z/ G
8 \: S* E1 l0 I. h, {1 I
Method identical to the preceding one except that it seeks the ID of SoftICE
1 r. H. @9 z; w3 t6 }! w& d5 }1 gGFX VxD.
$ c, v# ?; E5 c  e& ^( A% ]6 `/ ~3 {3 m6 g
    xor     di,di9 D: u* L, e4 U3 e5 d, |
    mov     es,di+ ^) l# y2 ^- q3 n3 @2 t! U
    mov     ax, 1684h      
5 {9 }+ C4 T$ Z5 R/ S" t    mov     bx, 7a5Fh       ; VxD ID of SIWVID
$ W: ~! i3 d4 [1 ^    int     2fh: B. b4 G  J5 C  a' b
    mov     ax, es          ; ES:DI -&gt; VxD API entry point( }& U/ p* X- w
    add     ax, di
1 }; r  @& O; u* W9 [+ i    test    ax,ax) I& T1 |0 D! ?& s; w+ K
    jnz     SoftICE_Detected
& k4 Y4 v/ u. Z2 z6 @! ?3 {5 s  O: m) [- h" g1 q+ h
__________________________________________________________________________
" p3 g) B* _  ?* N8 D
2 _4 }0 L9 {3 M# K1 k* \+ s4 p7 B( W) C5 }: W
Method 05
$ f' P9 u$ G! D=========6 D' m$ D1 ?" Q( I
7 W% g  ?; P9 ]$ ^! R
Method seeking the 'magic number' 0F386h returned (in ax) by all system2 E" [0 J, }4 b; U/ P
debugger. It calls the int 41h, function 4Fh.
( \3 d1 o! \4 s/ B. dThere are several alternatives.  
+ }9 ]. {  L3 M9 d- m7 B. E; t6 v! G3 h) `) N
The following one is the simplest:, a* j- Y+ [) S$ A/ V& o

, w7 n1 I+ L) {/ a6 v/ @5 C% p    mov     ax,4fh; ]! q  F! e/ m
    int     41h
( X- s; T. i2 I+ N1 N( j0 ~" s    cmp     ax, 0F386
6 E# _8 Z" T- B5 v    jz      SoftICE_detected  n8 l8 N6 k# p
$ J. g: v; Y$ }7 H$ Z
1 [# W+ W$ h% A
Next method as well as the following one are 2 examples from Stone's 3 H1 e$ z, {" c8 M! T3 e* _
"stn-wid.zip" (www.cracking.net):- B' C4 B- }7 S# k0 v% X! D. a
; G8 A0 \) R# X& N+ w3 ?
    mov     bx, cs
1 K+ D! z* q" k8 D    lea     dx, int41handler2
$ t( a! ?* N5 M! v    xchg    dx, es:[41h*4]
6 h$ w# R3 }1 n    xchg    bx, es:[41h*4+2]
) ^5 l: E" H5 ?: i2 a, e  x$ d    mov     ax,4fh
$ {+ E6 A7 k* e& U4 N& h) x    int     41h: L+ k; f5 t% v2 u
    xchg    dx, es:[41h*4]2 V4 F+ W# e1 x% b' P% _! r
    xchg    bx, es:[41h*4+2]% R$ P. H; z! a% B9 z# c
    cmp     ax, 0f386h4 |3 K8 f' U, l% x3 Z  ~9 Q
    jz      SoftICE_detected8 u- ^+ f2 [$ Q

/ u" s% N9 c2 N" b- cint41handler2 PROC  }# m3 B$ Q. h( e+ j( u8 |
    iret
' Q5 Q" O5 J5 ^int41handler2 ENDP
& j# T% H; [; L+ n# v* `" A$ s' H$ S. E
! A: J8 v" z  y7 u4 g5 h7 A
_________________________________________________________________________
- T; o; t% D* S' v8 S! n4 K3 P( A; q6 }0 X" j
3 r$ {, F+ [8 u. [% c2 b  f
Method 063 ]2 t  a4 P( o$ \% w& f
=========( {3 W  ]* ]4 O5 S; h

8 t3 M$ {& M: z& \  Q3 C# u# M2 d
2nd method similar to the preceding one but more difficult to detect:
; t' c- ]" ?0 V$ K$ j: ^) e8 ]" }9 u+ b% V2 ~1 i& L! d/ t7 }

& L& ^. Y' v9 k, F0 A: c+ O5 j2 ?+ Pint41handler PROC
, n& F7 ^4 k9 Z# r2 r9 f    mov     cl,al  P6 P/ o1 R+ ?8 Q& i# i9 K
    iret
0 P2 @) r& B8 t1 Y" xint41handler ENDP
7 X' v8 n- M1 ^( a% b7 g( {# O7 L# @
1 @; \; w7 [5 C) I) A! Q
    xor     ax,ax; a1 d8 s# C2 [0 N/ |
    mov     es,ax$ B( X# p! h; {: o% ~
    mov     bx, cs6 l$ d" q4 t& v0 H2 [
    lea     dx, int41handler/ Y" i* k4 ]! i' j' e; F* Z
    xchg    dx, es:[41h*4]/ n4 Z6 Z' p2 o+ |, K; l4 p+ x
    xchg    bx, es:[41h*4+2]* t; N5 _3 N1 ^. U/ v
    in      al, 40h+ P2 ^) U. h- ~5 U" Z9 e7 }5 z, Z6 {
    xor     cx,cx2 r. T7 g( h4 i/ ~- l
    int     41h; h9 Z. b4 \9 e* _4 L+ t
    xchg    dx, es:[41h*4]
0 }8 s' n" U7 S- J. Y; K' O3 T    xchg    bx, es:[41h*4+2]
7 P) G1 S7 X6 G% R0 ]8 n+ H    cmp     cl,al) L. T5 c2 R4 ?# ]5 b
    jnz     SoftICE_detected) `5 v# |5 n2 r

( F7 x$ Y& h$ h8 k" L$ K_________________________________________________________________________' W1 j2 w" ~: |. U: j, D

3 A' E3 [/ G/ W# g* Z# IMethod 07
8 o8 r- A3 X. i8 U=========& O7 |. v$ g0 Z
7 `+ m" Y- R4 @& G- T, P7 P
Method of detection of the WinICE handler in the int68h (V86)* L; b: c+ d/ [3 |& _% j
; {- b3 r9 {, I# u
    mov     ah,43h
+ w( x3 S- e' F    int     68h
$ x! o$ X: i; l/ Z    cmp     ax,0F386h% z  i# K- N' H  [3 w0 w
    jz      SoftICE_Detected
3 }3 k$ k* M  Y! ]/ Q% Y
, \, j7 k& g# s
5 D/ l# M2 I6 t=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
9 @2 N( @3 d$ H8 Q1 F; b   app like this:* ~6 A3 T7 G! y' `6 f5 f

1 v1 e  d, T* B: D* X   BPX exec_int if ax==68, _9 L' X1 a/ O! ]: D  R6 l
   (function called is located at byte ptr [ebp+1Dh] and client eip is
5 y/ A$ U" l2 p3 I0 T% s   located at [ebp+48h] for 32Bit apps)' |2 a2 [, c0 f
__________________________________________________________________________4 E, e( c5 L; Q) s

/ a* S8 f4 s  N- B0 H7 \$ X! M
) _6 f* }! c* Y# pMethod 08; I$ Y$ U3 x' K+ r1 o6 m# g2 f. ]
=========( ?2 ?* h! V: v3 t
& [4 R+ k% f* |. ?* @
It is not a method of detection of SoftICE but a possibility to crash the- N5 l1 z, u, W6 g( G5 ^  J" `
system by intercepting int 01h and int 03h and redirecting them to another( r- T. D; y% E0 Q& r- B( V
routine.
% C" S+ }2 ~1 a* dIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points9 f- y5 O7 A& Y! y( g( U) q
to the new routine to execute (hangs computer...)* V' a3 A7 r8 Q; W4 l  v2 y
. V' x0 M* D- E2 h8 z, I/ U
    mov     ah, 25h
9 ?) ]  u3 I9 W# H6 Z; V$ b    mov     al, Int_Number (01h or 03h)
" U9 k" Z1 H# ?3 I: j    mov     dx, offset New_Int_Routine
2 z' v% n5 V0 |! `" p, C    int     21h1 K, t' ]% C  d9 y7 _) K" |8 G7 r% j

* t6 m; t9 c: [6 U( X" E9 ?" Q/ P__________________________________________________________________________
. n# b* \7 W& a# d" X  p. o$ D! F: ~0 O7 F+ V2 [
Method 09
3 G! T$ \4 @, F2 Q=========: i6 I1 \7 f4 Y' H
' K3 q- _$ l/ m, P6 @, Z
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only' x8 }# C  ]& z
performed in ring0 (VxD or a ring3 app using the VxdCall).7 z% o: P+ @0 `8 _; b# n2 v
The Get_DDB service is used to determine whether or not a VxD is installed/ `  ]0 j- T( d+ x" ^  Y$ S, h
for the specified device and returns a Device Description Block (in ecx) for2 `. X4 n5 z6 F
that device if it is installed.
) z: H  I( j1 A0 G8 X& g
8 \1 _$ z& i+ S2 C! Q. T6 F$ z   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
! w; {  `! Y' b! X; o6 a- |   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
/ Q$ Z' T, w% p3 u   VMMCall Get_DDB2 c- F5 w# u4 T% b& [7 O% C2 i
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
  @5 G, p6 B9 [7 x/ o* u) n& X2 f+ F) I* H% I2 w
Note as well that you can easily detect this method with SoftICE:5 |" _; ^/ M* P9 O
   bpx Get_DDB if ax==0202 || ax==7a5fh) X% M' X; j0 Y7 T' ^2 a, ?

% }# y: v3 Z& Z$ P__________________________________________________________________________3 {: u! C0 B2 @6 e( f7 h; M
" I/ E3 R9 B  q, C! L1 f
Method 10
$ Q+ Q. K9 q+ n9 n2 w- g- d=========0 G: |( ^; q. N

8 o" v3 }' D; a# v=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with7 G1 d& v! R: k5 n9 V7 j
  SoftICE while the option is enable!!! w  X" v& m8 w, {$ q+ A+ C

% A. u4 _+ g! |4 B) k3 T- v) }This trick is very efficient:1 |2 e/ K$ [+ }, F
by checking the Debug Registers, you can detect if SoftICE is loaded
5 }+ y5 C. ~- Y6 S% E" s, E$ D(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if9 E, P- T5 p  G4 ]
there are some memory breakpoints set (dr0 to dr3) simply by reading their
5 z9 e$ Y4 g# d. K% k2 b0 T- |value (in ring0 only). Values can be manipulated and or changed as well, ]: }2 k2 X& e1 |  D5 B
(clearing BPMs for instance)
. u) w% U2 A" O' n! P1 J
5 W1 G7 S; P+ l__________________________________________________________________________/ Q/ M4 g2 a0 ?! b, s5 D! S

# e; s: H! d) {* B2 S9 @* N2 VMethod 110 L3 b1 m) L- M
=========. d7 R/ t1 m. Q8 T6 L# b+ w3 p

7 F) D" t$ a1 d0 `" V4 @& B: NThis method is most known as 'MeltICE' because it has been freely distributed
3 }& W6 G9 I; ~: y3 u6 J3 y  [  vvia www.winfiles.com. However it was first used by NuMega people to allow
& a! b  R9 t3 S5 H- K9 D+ _Symbol Loader to check if SoftICE was active or not (the code is located) i5 ]8 K+ s$ d& K" }' \) @& O
inside nmtrans.dll).
4 |+ @8 m8 \+ m/ d5 t
: M! {' N- @9 \" F, cThe way it works is very simple:: M6 T( Y, [4 S& i1 W+ o
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for" H  K( O" q  A% J$ ?: e( h
WinNT) with the CreateFileA API.
: A7 ]8 G4 D: c1 H
  `9 {7 I! R7 I) n' xHere is a sample (checking for 'SICE'):
2 ^- I% M; e, H1 Y' G+ t  {* ]1 y. p2 s2 C' @" G3 C( j
BOOL IsSoftIce95Loaded()- R) U/ y. v6 E7 a
{0 w' x( P. q$ ?+ _* L
   HANDLE hFile;  $ S5 d* C' A& ]7 Z/ N2 P
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
4 H- V* o6 x7 L6 }, a0 J8 s6 z                      FILE_SHARE_READ | FILE_SHARE_WRITE," C9 O' S, r. N9 G
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
. \. O* U% Q9 M1 P' l) ]4 l   if( hFile != INVALID_HANDLE_VALUE )* Q2 ?6 ?$ ^: c3 C$ I5 e, ^
   {
5 ?# {5 G( `% b: D& Z      CloseHandle(hFile);0 s7 m4 D) T. u
      return TRUE;
) f8 J; X9 R& v" o+ _0 i$ ^" Q   }
, q" g! D  S/ N# H9 t7 `   return FALSE;
8 Z3 E7 b0 i' Z( `: d}
4 r  B4 y' o  ~4 }9 t
# o5 r( u' V: W5 ?( iAlthough this trick calls the CreateFileA function, don't even expect to be7 a* M+ d5 k8 E: j/ o! ^/ A
able to intercept it by installing a IFS hook: it will not work, no way!
. u" H/ S4 L4 G( FIn fact, after the call to CreateFileA it will get through VWIN32 0x001F
' y# l. _- {* |" w8 Nservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
& T" i* u7 g- P6 P: z8 A# [and then browse the DDB list until it find the VxD and its DDB_Control_Proc" v5 `" F' \" d9 n5 F
field.( [5 I& V7 q) c7 g/ C& k% |; H
In fact, its purpose is not to load/unload VxDs but only to send a
+ m2 N2 E1 P* j9 s& kW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)( y' ~3 m, X- j% i1 y& u
to the VxD Control_Dispatch proc (how the hell a shareware soft could try
: X( k4 l* Y+ a  rto load/unload a non-dynamically loadable driver such as SoftICE ;-).6 T9 |1 W# i, Y/ c  j
If the VxD is loaded, it will always clear eax and the Carry flag to allow
& |) k9 ^* i7 q; s+ U5 Zits handle to be opened and then, will be detected.
3 Z$ t& D! J/ E- r8 D( c7 ]! q* r& e" xYou can check that simply by hooking Winice.exe control proc entry point1 o' H# B$ ?% h$ u& @9 `# k
while running MeltICE.
* n8 @. G2 j- `' i& K; H# J1 N  W* a" r6 m  @) d. x( x
5 d4 z% _0 w, R
  00401067:  push      00402025    ; \\.\SICE
: w1 K2 O) T: r  0040106C:  call      CreateFileA
' v3 F! @  t7 k  J  E1 V8 Z: h  00401071:  cmp       eax,-001
# n& X* ^  q9 r  00401074:  je        00401091
  s" p! o4 J; G2 e) ]0 x
5 [- a0 M- z5 G2 ^5 n
6 z6 E$ V& J* q+ D% `( kThere could be hundreds of BPX you could use to detect this trick.* X4 }) c- o' z$ j8 Z8 x8 {0 q- ^
-The most classical one is:/ [' ~+ d. v: f
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||- }- t2 g! Y: {6 I
    *(esp-&gt;4+4)=='NTIC'" G+ y( k' d6 B
# z% }+ t# ^, H/ Z. e  M2 _( O
-The most exotic ones (could be very slooooow :-(
; ]- e+ Y- a9 }. H2 D* |   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
8 F3 ^' x( V+ f: ]     ;will break 3 times :-(
0 ]& L$ b' H- `, U( s0 G3 g0 J* v' ^
-or (a bit) faster: $ V" ?2 `4 O+ j, o- G  K" r
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
: N% R: X8 \" e& B
' _2 H9 F  x- Q& _: z   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
: `" B# X' Q$ I) x: N1 @, C     ;will break 3 times :-(3 k- r( T. V6 H
4 d4 M$ \6 R, O9 u
-Much faster:
4 `# d" [/ e( j7 H' M0 F6 y   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
' B: z* U! V1 r" N
) N' R+ P% d; pNote also that some programs (like AZPR3.00) use de old 16-bit _lopen9 ?: q: ?: q/ `% i+ j! {' w$ a
function to do the same job:* {0 m! S% k5 Y2 C8 D

; z; @5 Z8 V7 Y- ~   push    00                        ; OF_READ
. V9 _# p! G7 b. d% \: o+ \   mov     eax,[00656634]            ; '\\.\SICE',0% X' ^& ~# i- v( Y3 L' h3 H5 U
   push    eax' G  B" H1 m" l4 H7 l6 v. F* S. Z
   call    KERNEL32!_lopen
+ D  |( h2 h; E8 R   inc     eax4 q- j/ \/ }% ^, z
   jnz     00650589                  ; detected
, O1 R- U) a6 a  l7 K: \   push    00                        ; OF_READ
7 j" I) j5 \7 x  b   mov     eax,[00656638]            ; '\\.\SICE'
# Y+ G, E1 d- ^* A0 \: k   push    eax. Z* j. K0 g  K) |5 ?0 ~2 S
   call    KERNEL32!_lopen, Y- B6 }- ~- V2 }$ D. O! H, C9 G5 Z# x
   inc     eax; j. E  t8 M  I6 N2 Y
   jz      006505ae                  ; not detected) X9 I( u# h" V$ J1 {

4 m! h# N( h* {- e% D) t# v8 k8 i2 ?3 s- M5 \
__________________________________________________________________________) j1 \8 r. y+ [# C* w3 d

  v0 H! c3 r: n6 Y$ ~9 JMethod 12: Z3 P" s' h3 b, R" l  F+ J# s
=========
; o6 Y- C* G4 A8 i; k; A$ \& v: p/ |! E& ?+ X0 L" l0 s
This trick is similar to int41h/4fh Debugger installation check (code 05
. h" T% X: R2 Y% a&amp; 06) but very limited because it's only available for Win95/98 (not NT)" @/ y+ B5 M  H' f* s- C5 R
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.  L, o7 C& y% e4 O4 ]0 G/ y' C* S
5 `' d9 |- Y1 |2 w2 @
   push  0000004fh         ; function 4fh
0 p% J1 k% j' e   push  002a002ah         ; high word specifies which VxD (VWIN32), ?5 D: h) d  y- ~6 e# x9 u/ k
                           ; low word specifies which service
) a  t3 N! R& i  H1 F$ J                             (VWIN32_Int41Dispatch)
2 l; f# y8 X, n6 ^# T; a   call  Kernel32!ORD_001  ; VxdCall0 i. e% B  f& `& |4 T  f
   cmp   ax, 0f386h        ; magic number returned by system debuggers
; q3 e# F! E+ n2 k0 k; t, _, ]   jz    SoftICE_detected
" ]6 u" ^. ^5 _" C% c% S& ]' D9 P8 O: {
Here again, several ways to detect it:
8 W; z# p4 b, g/ \* `, ]4 D- e' [- A
. I& G- F7 b! F    BPINT 41 if ax==4f& C! _7 {  E. h" {- v6 n

+ }  T2 M$ @$ X0 ]. r7 J    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one2 T1 J" ^) X, s: s& Y2 ]
3 k7 g3 F+ V* h. |
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A( o* {4 o* ^& H- c7 o- u1 w' ]

# W/ T+ L1 v( P0 ]' B% ^    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
' @* Y5 S4 O* z5 a( V# l# J) ?" V6 B/ H$ G0 n0 {
__________________________________________________________________________
4 M* ~0 f3 m% a2 y; Y" T" I; N; g) Q4 J
Method 13
: u3 w2 s3 E% p9 P; A2 w=========
0 f2 A0 X* @: y+ h0 X4 w# B' J: \: Q. e
* |* h. J& h. A" M9 [0 j6 U. INot a real method of detection, but a good way to know if SoftICE is
" O5 D1 B. Y* z) qinstalled on a computer and to locate its installation directory.
' M8 x' h) z. S. ^2 p( t0 k1 DIt is used by few softs which access the following registry keys (usually #2) :
/ M; |2 z- g0 F% S
9 ?+ ?! J9 {. W0 j4 F  `" R0 F-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
' [9 `% C$ B; j! a\Uninstall\SoftICE
+ p5 m) w7 {! k+ w1 x& _5 W-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE: J) ]- r4 Z, Y8 D) D# Q
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
+ N0 x. i9 |. C; u\App Paths\Loader32.Exe
) d+ r" g% Y7 v; f5 U3 A/ @
" c- f% T4 t" d: c' ]( l% ]  a( o3 n, _- ?. l  j1 B( v6 M
Note that some nasty apps could then erase all files from SoftICE directory
2 C; m/ y8 q- s4 @% k6 v. a8 n(I faced that once :-(
0 R; }% v) m' z- x
! a- j8 M: F' ~6 a5 ^- `Useful breakpoint to detect it:
/ A6 m* O: k" A% t" w. N5 ?4 `+ {# D; ~; I3 [
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'- ~- f5 Z5 w1 S4 s4 ~& [1 ?. P

. K) ^9 K' [8 r9 X) `$ r. i) o% |__________________________________________________________________________
5 _9 }) {' T( D/ j! }5 e. Y: L* F% H( ], y- t4 f5 v
( C# H, U; l" C. \
Method 14 / T3 b7 _7 r, j' v5 j" b* k
=========, S7 Q) L* {  [) b+ z
& ?* W3 Y' r0 F9 T
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
8 l5 \7 U5 Q: Y* ]+ t/ r( his to determines whether a debugger is running on your system (ring0 only).
* g& z" Z6 Y; x0 H/ Z" w% `" u
8 [+ g4 H. Z; j1 E/ ]) s% o   VMMCall Test_Debug_Installed* F6 k0 m* W' e; X6 \: E& q4 N; Q! N$ g0 J
   je      not_installed
. Y! y( n) ]/ b3 d) N
5 ?. g" Z+ |# d" mThis service just checks a flag.
; r1 F) ]( O3 Y- h7 E' T, {$ x</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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