About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>( T& s) Q' h6 {6 z" T
<TBODY>
4 ^; @9 v  {4 @# a- q<TR>" q$ a$ ]& _3 i* S
<TD><PRE>Method 01 5 e# |* x, C2 m; e) d3 |" G
=========
% p. p$ }4 O4 v; P5 O, X2 O% J
: G+ \4 X' v  E: |" S7 ]This method of detection of SoftICE (as well as the following one) is
$ r3 c4 x2 c  \* L" @% b, h" Vused by the majority of packers/encryptors found on Internet.
  q4 ?/ S5 S2 ZIt seeks the signature of BoundsChecker in SoftICE+ ?. Q' e- q! V7 X" ^3 X1 X1 [- q
' _  z2 W( ?+ y% v( y' G) a6 B# [
    mov     ebp, 04243484Bh        ; 'BCHK'; Z( p( a0 X+ S/ I$ t
    mov     ax, 04h- x/ P$ t+ K2 I  V! s! G# ~
    int     3       " g- p3 j. ~  w, r" L( z+ I: t
    cmp     al,4
2 N8 K6 _# w4 ^0 E; e    jnz     SoftICE_Detected
3 n9 S, T9 j/ H: k9 g% e
  v- t3 g5 j3 r$ g___________________________________________________________________________
7 i" S5 k- ^2 H
5 ?+ U5 K# a  n4 C' L3 O& CMethod 02- r3 l  }" t: h8 c1 X6 i' K' T% T' E
=========4 q  B3 ~' X2 G2 h8 O# g# D" s

! c5 M% R( `* {! \! ~) qStill a method very much used (perhaps the most frequent one).  It is used
' m8 a3 K% w; v% R$ hto get SoftICE 'Back Door commands' which gives infos on Breakpoints,+ W. u9 t/ g' _. W/ c+ Q" v
or execute SoftICE commands...
. X; j$ \. ?5 P+ R) w( F( s% mIt is also used to crash SoftICE and to force it to execute any commands
, z3 [' S/ z. {( P2 K9 S(HBOOT...) :-((  
( x% W$ E* y) ?- @, Q0 e+ i, J: S4 x4 M
Here is a quick description:
( F$ B; o+ U1 p# T; e. C$ K6 l/ W-AX = 0910h   (Display string in SIce windows)
7 \% w( v- O" {2 t7 f-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
. W# ?: C2 u4 B0 a" y4 G! S-AX = 0912h   (Get breakpoint infos)
$ ^) J6 r+ i) d6 U( L  F-AX = 0913h   (Set Sice breakpoints)5 b7 B. a2 J& d. M
-AX = 0914h   (Remove SIce breakoints)7 y5 j' @( Z, Z  W% U7 {! F, c
$ N; `/ N8 G  B
Each time you'll meet this trick, you'll see:' [- j. ~3 U4 Z. N" o
-SI = 4647h1 _/ c7 ~# i! \, i" N6 d* S" t
-DI = 4A4Dh3 X( k2 a" @9 @: |/ c! F, ?' x% {
Which are the 'magic values' used by SoftIce.1 N, p+ P4 I; {% ^. i
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.
! I; i/ q4 F% ~$ T$ ]6 n+ ^+ u4 S: p+ K9 w8 K0 }
Here is one example from the file "Haspinst.exe" which is the dongle HASP
1 |1 m1 b8 W! K- q2 ?/ J. g  F& `+ HEnvelope utility use to protect DOS applications:
5 u; k- @8 F( J) h: _
9 |; H0 F1 l7 Z. V1 Q$ I0 y4 w- @6 w$ N  M7 K" k$ S4 I
4C19:0095   MOV    AX,0911  ; execute command.% f/ U; k/ }* k0 D* C
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).6 y+ E5 X& s) \& I1 T2 t
4C19:009A   MOV    SI,4647  ; 1st magic value.
5 R% E9 Y+ q2 O1 K- t+ g4C19:009D   MOV    DI,4A4D  ; 2nd magic value.6 m: U  i3 f; j7 F1 ?0 O
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
. _5 a3 [; ^" S, O& T: X4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute7 }6 x$ z- s, P7 A
4C19:00A4   INC    CX
4 u- F& S+ H  g; g& r% n9 u4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
1 P2 n$ l, {8 _4 d4C19:00A8   JB     0095     ; 6 different commands.
/ x) @8 r% e: `) o7 s3 Q4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
5 W. f8 O; F9 q4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)9 q( V% d7 R' Y, R+ `. s4 w

# V6 ~' A8 x4 o8 ]  ~The program will execute 6 different SIce commands located at ds:dx, which
& ^( b6 Q* f4 x, Nare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
* p" R( l4 K2 x& F; O- F7 M1 @5 A9 ?' _2 x; o, ~8 b
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
& p2 w. r0 `4 F- E___________________________________________________________________________
% i6 l% w' f! e( K
0 ?; W' y9 s# R8 G1 q- D& b9 S" ^/ K" n$ B* q
Method 03
/ \8 V# p) p2 w5 C=========
6 a/ v/ ?% k* V3 i: S
* g8 A5 f9 ?5 s( ALess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h- y8 u) H' m7 i( @
(API Get entry point)
% D/ Y1 q# R% r- b7 C' n3 O        5 W% e8 {# j5 n# ]

8 @5 w- T7 c  V5 p& U/ ?$ {    xor     di,di
& P4 h" f' a( j+ C6 }0 |( H    mov     es,di9 \, h6 r/ q& a; X0 w$ H, `
    mov     ax, 1684h      
9 o- d1 i/ \& m; S+ E' r; o    mov     bx, 0202h       ; VxD ID of winice2 o& S6 G' B2 r, I- c7 Z! l
    int     2Fh- \/ _% y& K6 h0 O, M$ L# i1 l
    mov     ax, es          ; ES:DI -&gt; VxD API entry point' ?3 b! ^8 `  X( ?
    add     ax, di5 e) Y# ^) p. j, h: W" k
    test    ax,ax2 w# y9 @$ p: W0 J; E* Q$ j
    jnz     SoftICE_Detected
5 Y! A9 H' ~0 c3 `3 v; ?
/ }# C8 u8 T) q, S___________________________________________________________________________1 B5 K2 A1 A: l: y
4 P1 z% E" V# L, i1 l" V5 }  c& i
Method 04
( j% U3 Z- y: q) G% Z$ P=========
: }, G' v* f8 A1 m
! U5 l/ G+ I; FMethod identical to the preceding one except that it seeks the ID of SoftICE/ h: l5 T7 U5 p1 t
GFX VxD.
8 H& N2 }) q& u' E, Y: q- F; C3 J
0 u$ E  l, O- y+ z4 I# e    xor     di,di
/ ^5 t  U/ p  O2 c    mov     es,di9 O+ \" v/ P6 ^: E# B6 i
    mov     ax, 1684h      
8 g8 v& [( J, ^# o( v. y( N) b! s    mov     bx, 7a5Fh       ; VxD ID of SIWVID9 r5 Z, F7 }8 e5 k* R; j+ y
    int     2fh
0 E  K* [8 [" d3 e2 L3 R    mov     ax, es          ; ES:DI -&gt; VxD API entry point8 j) q9 u1 a( R! w5 I
    add     ax, di
& N- X( L* m/ h6 Z: k- B: a    test    ax,ax
  P. T, G! u6 C& x/ Y0 N, G2 ?$ F1 [" x& n    jnz     SoftICE_Detected1 C- @) h7 |0 Z

; `/ o- B. p: E. A. X8 S6 {8 V__________________________________________________________________________
1 B8 `' U  }1 u; j7 o( j+ C- s) L) h* G9 F+ N6 z" E3 O6 p

6 ^. A$ @% f  ]! a  ^0 [3 l0 V) ^Method 05
+ K' v; }% D5 [  C. J=========4 p& @9 f. A1 _( Q/ u* n( x" ?/ g3 Q
  }+ ]1 o  P  t/ H8 F! j
Method seeking the 'magic number' 0F386h returned (in ax) by all system
* l0 I0 H) k$ I* \  N' y: Adebugger. It calls the int 41h, function 4Fh.
. ?; _3 L; @' a% U. jThere are several alternatives.  
. P5 l8 r: T  f, C0 z7 \9 r) H$ _) Y( r
The following one is the simplest:& Q3 I4 m9 H$ z) J* I; S/ o
$ O+ q. X- N! a4 L( H
    mov     ax,4fh: M: Z3 H9 K2 x/ [" {
    int     41h
2 R- v: Z9 u+ C1 _    cmp     ax, 0F3861 i9 X5 ~$ Q$ n- t4 E8 M
    jz      SoftICE_detected
0 E: J! }- e7 r. W+ @! C# }
( h, O8 w. o  P0 r
$ k" A& }, L" h4 {& C, `Next method as well as the following one are 2 examples from Stone's - W) P3 p! I6 P: k- _: f5 m9 r
"stn-wid.zip" (www.cracking.net):% g  e' H9 l: M2 T8 n4 C0 L
- s" F, K$ o' T+ `- C) L. A
    mov     bx, cs9 O: G' x9 v  p8 y
    lea     dx, int41handler2
+ S1 n. m0 a' p% |8 T+ L6 n3 V  D9 h    xchg    dx, es:[41h*4]) z5 B) g3 G- h% `5 G8 ~/ @
    xchg    bx, es:[41h*4+2]
1 z: m6 Y* W( ~3 [4 Z( e    mov     ax,4fh* T- H; c* X% \
    int     41h' m1 b# F/ V+ ]; r6 c
    xchg    dx, es:[41h*4]
; l9 c$ k6 M; i6 B& I9 w    xchg    bx, es:[41h*4+2]
' l4 P  b0 d2 u5 g% u5 K9 m0 B" m    cmp     ax, 0f386h
/ I3 n; R- y- R0 C    jz      SoftICE_detected( d2 a7 D+ E; P4 I

; m* ^  T! D: o% r. _: ~int41handler2 PROC4 @# c- I$ ?" v: a) g9 q! {
    iret' P# d% P4 S& c; H! n# U% \
int41handler2 ENDP, g4 e& e1 s/ y8 h
2 {1 Q7 Y* w  y, X; V1 O
$ T( j% R" N; |7 C8 X/ H! F/ N
_________________________________________________________________________
" n4 ]( c: c* c* w- t: E7 A; n3 Z- j2 Z) l1 |. Q7 O; P$ b

* B5 M2 o3 Z4 d, l% BMethod 062 T6 c) X5 K: B* i' b9 R: V
=========
- n3 ?6 r- L1 |
0 V( x' E* D) J/ Z- U* ^: E( G" K6 F, V" B$ h
2nd method similar to the preceding one but more difficult to detect:
) i7 e! U0 b! F6 D4 q7 k/ w- z
% ]( [. H* z3 n4 {4 o' C! K$ D$ l5 p' u8 p0 Y( C
int41handler PROC3 ?) W8 j; _! K8 I6 h8 c
    mov     cl,al- \+ d! V3 ]9 G6 \4 w0 V( {
    iret
+ b8 p* u5 Q1 U* sint41handler ENDP
' N$ r$ s% b, ?' m3 b0 Y
; _8 h: L: k) H: ~0 l, i! x% W4 n; a2 d+ Y+ a
    xor     ax,ax- F! t3 }% b0 G; Z$ M
    mov     es,ax- T* R* C, t2 w
    mov     bx, cs! O3 A( S: P8 c; a0 }
    lea     dx, int41handler
5 H3 s; b7 i, F- e    xchg    dx, es:[41h*4]
, Q3 V7 \( L, q! C$ ~  N1 ?, ^9 `    xchg    bx, es:[41h*4+2]
+ r! s# }" J# v$ ~    in      al, 40h6 h+ D( K- T( U
    xor     cx,cx# i+ d6 _" x" m
    int     41h
( K' }6 |# B$ n' a$ J2 _* ?    xchg    dx, es:[41h*4]7 n  `7 P1 V; G$ G, _5 }+ X. q
    xchg    bx, es:[41h*4+2]: o- E! ^: T( d+ B5 }7 y8 X+ c
    cmp     cl,al' e+ ?* M' y4 H3 M, }4 g  h
    jnz     SoftICE_detected
. k9 x$ w* M7 `. N/ Y- v% g  c# s0 y# U# q8 u; f. _2 R
_________________________________________________________________________
+ Z0 I7 J% w5 a" R2 @
& T7 R* l7 B7 {4 }# a2 _, _Method 077 a# b: J9 X& |9 V7 v' J) u
=========, c( `& C" O1 r: a
3 G! e3 J2 |7 _. l+ R9 j
Method of detection of the WinICE handler in the int68h (V86)
5 d- R- }' O/ ~+ N( e
# K! ^  ~4 A% C) O: o, a! L    mov     ah,43h
  X) k7 C7 v+ b    int     68h: R# _1 D6 N. L6 i3 B1 y
    cmp     ax,0F386h
# K$ a2 ?2 S" _  x! P! U7 F3 I( b3 a% A    jz      SoftICE_Detected: ?1 U) ^1 Q0 l3 V( `1 f0 }

3 h- R0 A! Z% `% t3 P8 ^- T' C' t; h+ R, u
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
, W1 [/ f5 P) {8 I% I   app like this:3 ~, v3 e0 T7 H0 r4 E  X) n
% Q, B* G) {; l
   BPX exec_int if ax==68
2 z: ], S, E, d* B1 B- _2 Z   (function called is located at byte ptr [ebp+1Dh] and client eip is0 K# x: E' C4 U) H
   located at [ebp+48h] for 32Bit apps)
5 n( }5 u; p7 ]# ?__________________________________________________________________________3 W8 v0 F, u0 g4 z" X4 D; c

5 r3 d6 O& \6 R1 [8 {# Q& o9 F2 x4 s4 P9 }2 v$ j2 Z: f
Method 08
+ y; U2 L% g/ o* O! W# p=========
! v' Q! O" Y! ]' ~- k( E+ ^6 t  P: z& v- P  L
It is not a method of detection of SoftICE but a possibility to crash the  z6 d" Y) F+ C) T" `' ]9 ?
system by intercepting int 01h and int 03h and redirecting them to another, p5 z) K) u  |, F  i
routine.
2 |! E0 Y) }6 }$ m4 W- L/ WIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points  n; s( T0 J( h9 n# m- l
to the new routine to execute (hangs computer...)
6 V" f  D5 q* r- N/ _, r. H
* Q* ]# [$ c* h' ^! P$ A' |  z0 U    mov     ah, 25h
5 u- O+ W9 ^6 w* T6 N( V; D    mov     al, Int_Number (01h or 03h)1 d. Q+ {1 U- k. S: U- H6 J+ u
    mov     dx, offset New_Int_Routine
2 s0 s' o, A4 i) F( _    int     21h" d; \5 @% }" _$ \" ~

" t/ J, g" j* Y! ^5 U: N" r__________________________________________________________________________6 Q+ F% f; {, |% y
$ c8 G. t/ U5 p. g- }7 B; l# }& [
Method 09
$ T* K5 f4 q2 h. p$ y* @=========
6 ]) p1 ]3 y' {8 t% P( Z  {
' W) d) ?5 x9 e1 }& l7 Y$ AThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only- k, B" s# U5 Y0 `
performed in ring0 (VxD or a ring3 app using the VxdCall).
9 i  f3 W# R* f$ F8 d1 zThe Get_DDB service is used to determine whether or not a VxD is installed4 ^$ T' Z8 Q$ U; ]: D6 V4 H
for the specified device and returns a Device Description Block (in ecx) for
, t, u# o9 G! \2 pthat device if it is installed.
5 ?2 b1 ^  i  u( B5 y0 t  B
2 B, ~' h4 v2 B- J   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
( @8 W' ^7 H( _3 T5 h: z   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
5 N1 z: H/ y. Z   VMMCall Get_DDB6 L; G* z- T0 z& F
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed! x: ~  g9 o4 R( H7 y

+ i; w4 s2 F# F' K$ a* XNote as well that you can easily detect this method with SoftICE:
* y5 V3 F2 i& M& I' |9 F+ p   bpx Get_DDB if ax==0202 || ax==7a5fh$ H& k* J) d. C
0 B: M& R' i$ K5 m- G6 `6 Z; s
__________________________________________________________________________
0 W" h' N0 `* G3 l7 X  M) P; T2 a
! h# f4 O( t9 T- u; r3 `Method 10
+ V: r8 Q) P9 b) X3 L- {( _=========
4 L! V% N+ v* g3 C4 ?, ]7 I+ ?; g+ C" c2 m# D
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
& T8 C) I. S2 n8 C  SoftICE while the option is enable!!
% T& {  A" s! J% p! D7 d% B% g  k7 `5 z( U! m9 N4 M2 V7 @) `0 t+ J
This trick is very efficient:# g: d" C0 T. O1 d" }
by checking the Debug Registers, you can detect if SoftICE is loaded! q) E8 a" I9 v- T
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if3 o, a1 h* |4 ?) N1 y5 H
there are some memory breakpoints set (dr0 to dr3) simply by reading their. `3 D: W* n8 ]; T7 u* I& Q5 p
value (in ring0 only). Values can be manipulated and or changed as well
/ F4 c7 N# e. W8 P/ V5 W(clearing BPMs for instance)8 T" P9 g, k$ G( S6 X" N+ _

5 W* M) K! V: W6 `__________________________________________________________________________. z0 [# [9 ]1 E, Y5 H9 h' `

3 v1 R" a/ y5 E% O. N2 ^4 nMethod 11: E% v  s# I5 y
=========( u# i' R( {1 {: {
% l/ `; S8 l+ x
This method is most known as 'MeltICE' because it has been freely distributed( m; [; l& |9 j# p- k" b2 \
via www.winfiles.com. However it was first used by NuMega people to allow
( i* e; ?8 l$ z+ g; p( YSymbol Loader to check if SoftICE was active or not (the code is located# Z0 l( d# W/ T. ]7 x8 \
inside nmtrans.dll).! |9 a) p8 B1 \7 r& O

- v( Z! b: w8 e* _5 K2 ?The way it works is very simple:
+ C) _$ v1 u7 r/ h+ D6 gIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for' Q; p, L2 a. F" m
WinNT) with the CreateFileA API.1 m) F- W2 D) ~( A+ @' B& O- N' E3 _
) M4 q& z# l9 B" Z+ [1 W
Here is a sample (checking for 'SICE'):
) G+ o8 ~7 y8 N" p
; f' O  U; `6 u; T0 EBOOL IsSoftIce95Loaded()
) W7 o2 G% a- ~9 ~{  p7 b% ]3 J; K$ h  P& B0 V2 z, }( ~
   HANDLE hFile;  
; N. k0 x2 R* C3 R' p. W) A   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,; y4 f% s: G" }
                      FILE_SHARE_READ | FILE_SHARE_WRITE,
/ ~- w  @' c* c1 w" [. Z( @                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);" d4 B( T# n7 q) c4 h
   if( hFile != INVALID_HANDLE_VALUE )" u4 c$ q) Y" i+ l, @
   {- S8 \/ e, v, A. |! R' T
      CloseHandle(hFile);- l. \" Q5 j% g8 ^/ M" Q. f
      return TRUE;  J; X$ V5 ]+ t: r
   }
6 u: y9 H5 K' }% `7 i8 a   return FALSE;
: `1 G0 @7 y  |+ Q) D1 K}
+ @' ^9 r% R( u: W0 k6 O$ V
0 f& ]) q; T; L# KAlthough this trick calls the CreateFileA function, don't even expect to be0 w' C9 G# `- d; [% _1 ?* m
able to intercept it by installing a IFS hook: it will not work, no way!
' _2 H3 l  a5 F5 J! v+ fIn fact, after the call to CreateFileA it will get through VWIN32 0x001F9 i  X  {8 i/ ^" b
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)' [' I& V8 T$ ?6 b, a- E1 x
and then browse the DDB list until it find the VxD and its DDB_Control_Proc; f" `. K; f! A0 Q8 I
field.( S& Y* D" ]  a7 a# N: G
In fact, its purpose is not to load/unload VxDs but only to send a ! T$ v1 N. Z7 i: w3 l; _
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE), z6 F* s: ?' j- j5 L1 Y) f2 S6 h( B
to the VxD Control_Dispatch proc (how the hell a shareware soft could try2 ]5 r9 L$ c+ U) J: V7 ~
to load/unload a non-dynamically loadable driver such as SoftICE ;-).2 x, q6 {6 |/ v3 l
If the VxD is loaded, it will always clear eax and the Carry flag to allow3 i% l; @0 L  w
its handle to be opened and then, will be detected.& K1 j% N" l5 C
You can check that simply by hooking Winice.exe control proc entry point0 D5 n' Q4 V8 r1 f' S( d; z- k
while running MeltICE.
" d5 ?: e0 P  ~; o/ y  u% Z
# S8 B# ?* ]  ]# g- `) j; ^
0 c% o' q! ^' X, X% I  00401067:  push      00402025    ; \\.\SICE
4 O1 `  }+ E* P; M0 B1 ~) q) K! s& c  0040106C:  call      CreateFileA
' i: V2 V) K9 o$ J8 [2 n+ _" H  00401071:  cmp       eax,-001
5 d! L! x6 a: ]2 d8 s  00401074:  je        004010915 Q; j' J: E: R, f$ f6 h; b

9 R' N( o8 g2 d' P
9 `9 Q2 e: T$ {8 e. K5 h! p( [& pThere could be hundreds of BPX you could use to detect this trick.
9 m6 d! S+ X6 h4 m; E$ l-The most classical one is:. }+ h$ D9 L5 h* Y: ^
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||4 F6 @- _/ Y& q" A6 C0 |! ^
    *(esp-&gt;4+4)=='NTIC'
/ ]& O- T6 r" \  N
5 w- q: n& l5 T7 k& h8 W-The most exotic ones (could be very slooooow :-(0 P7 C/ D& R) Q) d$ o
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
+ X. d& X9 X; l     ;will break 3 times :-(
, d# b9 D0 |. Q8 W9 N5 f3 b6 p1 K2 u! r+ v& T8 ]
-or (a bit) faster:
0 }1 W+ \& d/ ^( d   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
' L- ^0 t" R8 \3 ?: z3 C2 a3 g; b
: g/ g# a( e  p   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
% U1 n% H/ @) x1 X# k% ?& e" z     ;will break 3 times :-(
8 v$ e& i6 N9 ~( _9 x
. h% q* G6 a' ?-Much faster:
7 x4 @0 P* w6 a4 N8 U   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'$ K% y/ G. g8 r$ E& Q

: F9 w# m3 e; t  I  t) zNote also that some programs (like AZPR3.00) use de old 16-bit _lopen
9 n5 b4 ?' w0 n! \function to do the same job:' }! e4 Z! t( K4 t' \

. a4 V3 g+ D4 E6 i   push    00                        ; OF_READ
8 Q  G5 S: V9 c8 T( ^+ [( ]   mov     eax,[00656634]            ; '\\.\SICE',0: A+ k6 R1 b& Y: R* u; U  R7 w- j
   push    eax0 C1 j/ ~; g* ^8 f( c  B2 Y
   call    KERNEL32!_lopen! A& w* i8 H3 u6 I6 X$ t
   inc     eax1 x8 o8 v! M; r" @& _8 ~8 [# o9 r
   jnz     00650589                  ; detected$ o% e5 j& D2 y, P6 w
   push    00                        ; OF_READ1 ~4 X% C' q  L& M$ R
   mov     eax,[00656638]            ; '\\.\SICE'' R, o& w: |9 _
   push    eax
' E7 h# B/ a; [! |   call    KERNEL32!_lopen
, A0 Q. T: U' g0 l4 `3 K0 S   inc     eax
3 h* V7 q& G! H6 i4 ^   jz      006505ae                  ; not detected, Q& i1 b  j7 s" B% j
. t' n! U1 ]3 G2 y5 \; r* @6 R
& R5 [) n# Z4 I' P
__________________________________________________________________________
8 U9 v9 q5 [6 w, [8 N/ C
' W9 w. X5 |- t3 g2 J% VMethod 12/ F( [& S5 b; R6 e. h$ \; j
=========$ x7 d  n$ C7 V' Q

4 |7 x# [* f1 [9 r2 K7 {$ aThis trick is similar to int41h/4fh Debugger installation check (code 05
7 U$ {3 [2 j. e* m; S0 j3 J&amp; 06) but very limited because it's only available for Win95/98 (not NT)
& J; K# S, Z( q1 i8 gas it uses the VxDCall backdoor. This detection was found in Bleem Demo.9 S1 ?+ ]6 K6 `- W) y

" U  u) b% n; |4 V$ f   push  0000004fh         ; function 4fh
0 I) A& @4 e2 Q! ~/ y   push  002a002ah         ; high word specifies which VxD (VWIN32)' _+ N7 w" U7 b  }  o1 P
                           ; low word specifies which service' w& x/ T2 ~2 I6 f
                             (VWIN32_Int41Dispatch)
' E# e: {; O, d8 w7 r, V   call  Kernel32!ORD_001  ; VxdCall
. g( E. W/ D/ ?" R  e' |( m' h+ @   cmp   ax, 0f386h        ; magic number returned by system debuggers
3 J( S* L; v+ d   jz    SoftICE_detected, S# \4 @5 l& }$ e/ {! j
! w8 X) N3 C' O. j+ H* }0 N! v
Here again, several ways to detect it:
: X( |# d* Y, A, ~6 }1 K$ u9 E( d/ K9 v2 Y5 h
    BPINT 41 if ax==4f
* }4 @5 R( Z2 P8 h6 e+ \: V5 i! v% m$ E# J+ a% J8 [# t( |; k, P) x
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
: z" Y0 I6 D5 A6 s$ q) @6 |" k% c9 W, P- Q: o! g  f- t
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
1 ~. I9 S' u- v- l( @+ ]8 a. T+ A& U1 L* `$ y, G
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!0 N4 a/ s; Q" U; d" E2 K1 \7 H
4 y5 k. Z+ h4 J  q5 U
__________________________________________________________________________
! R/ t5 c; \5 l5 T, Y2 b. x0 ]) x  C0 Y' P
Method 13- k! l9 s! ?, }; d4 n( D$ [
=========
0 _' t3 K7 D$ G+ [; ]5 c7 v9 v0 [* e2 C# z7 z. B0 x1 Z
Not a real method of detection, but a good way to know if SoftICE is
+ w3 [3 y' ^, Q  Einstalled on a computer and to locate its installation directory.
3 y$ Y1 L% k" \$ V2 l' g0 f5 V2 |It is used by few softs which access the following registry keys (usually #2) :0 d/ [1 s6 G7 U# t% w
1 O! B' Q3 f% ?% G, B% v
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion' _1 e: E3 z# a$ S/ Z- Z* r! M( ?
\Uninstall\SoftICE+ }: W1 q2 I. D  q( Y" m
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE- m$ v, ?7 X2 o2 g7 V
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
0 A, s; u- A8 u, {% ]/ |\App Paths\Loader32.Exe7 Y: N! f* n$ ~& [. h3 r, Y% k

) n/ [" s9 D; \# P+ ?) R* X( G# y3 T# f) X. \% P
Note that some nasty apps could then erase all files from SoftICE directory
  C; T& T+ `1 ~0 n! S(I faced that once :-(
" I  k+ P# C8 G) ^
! F' ?2 y: o# F6 \5 ^# K" R7 tUseful breakpoint to detect it:
- C2 U* X+ d$ G% ^6 ~
0 ?" X) S0 f( Y0 o( `6 Z     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
' x9 h9 p: d! @' r
6 ~1 K" C5 S$ A; e* W" ~- J__________________________________________________________________________
$ y, u, ?3 [' k# ^6 g
2 `2 o/ A9 t: }$ t7 B9 V6 L, J& s& q( m2 P! ^. U" A. @/ m' q
Method 14
3 l7 V; B" X$ e: j, H=========
+ z9 |: Q7 w$ W
/ Z9 B/ a& C( yA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose2 x: Q1 a5 ?6 }! N
is to determines whether a debugger is running on your system (ring0 only).# f1 J1 S! ^/ N

4 M) Q3 i! J' E   VMMCall Test_Debug_Installed# m6 p& {: O$ x$ T
   je      not_installed
3 I/ }7 Q. n& w* J9 b( d6 |: J) |0 H  I0 R4 P5 V+ Y" f3 V% S
This service just checks a flag.
0 G! Y; ?- t! @! v; Y  _( g</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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