About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
# @# z9 u" Y, g  `! v<TBODY>
+ j/ I. {( _1 X<TR>, C# g: ^4 C8 I' j6 T
<TD><PRE>Method 01 2 c8 D' f/ u" o/ T; E
=========+ w% U. X: c0 v# w) ~3 H

, ]! v$ B9 d0 zThis method of detection of SoftICE (as well as the following one) is8 T' Y0 T0 @- m8 J$ @
used by the majority of packers/encryptors found on Internet.* h7 f+ L: C$ T/ Z0 |
It seeks the signature of BoundsChecker in SoftICE
4 a5 G1 a9 ~# s0 q% F( c
- h& C6 R  `8 @6 |) O8 n8 }& R    mov     ebp, 04243484Bh        ; 'BCHK'/ c/ G) A" a8 B1 D9 g# T
    mov     ax, 04h* E( e8 ~. J4 q/ w1 Q
    int     3      
! {3 G9 b# s( a& O: O9 `/ R    cmp     al,40 f# Q$ R! r6 b7 |; M
    jnz     SoftICE_Detected
# P7 k2 k# W, ?: D
/ N3 V! O9 _" ____________________________________________________________________________
5 s0 n. R$ k4 I  E6 O- r. q6 H- {, [. H. R8 n% F
Method 02& S+ u, D1 e% t& u0 N/ G& L1 F+ b
=========3 L; X% L/ |1 x' A% T- ?3 d! S
6 f6 t' J# o1 z1 a" l" u. E$ S
Still a method very much used (perhaps the most frequent one).  It is used+ g& z4 s5 d' \9 F" b# d+ ?
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,
5 A$ t$ s% o  Q9 _$ z* L4 ~2 r1 M3 ior execute SoftICE commands...% l4 r- h) W6 F* c7 v
It is also used to crash SoftICE and to force it to execute any commands
( I# n  L! _, d(HBOOT...) :-((  9 u0 K* P. D# F1 C

! W$ U  Y3 f' ~/ O7 K8 o: UHere is a quick description:
: v+ v( H9 a1 v8 {! i0 ~( X% ]0 [-AX = 0910h   (Display string in SIce windows)
$ P& |3 f1 b6 l- S- J9 u4 l5 r-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
! }0 a6 `* i* Q" {-AX = 0912h   (Get breakpoint infos)
- c% u2 i- G" |4 L8 C-AX = 0913h   (Set Sice breakpoints)/ s, Z# c5 N! W$ U+ E  f) h3 O; d
-AX = 0914h   (Remove SIce breakoints)
- r$ `3 u# H2 Y/ L( \0 _& j- c5 s# i2 n# y3 ?
Each time you'll meet this trick, you'll see:
- {+ s3 C4 p- t! ]) q( s" u-SI = 4647h
+ ~7 m  }* y. W) Y0 b& C2 A6 ~-DI = 4A4Dh
0 O* Y+ u- c. p1 X/ U' uWhich are the 'magic values' used by SoftIce.
7 c& _# H4 O: XFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.
2 g4 B4 }8 G* H
6 N1 v% J4 n4 ]6 THere is one example from the file "Haspinst.exe" which is the dongle HASP" A# R9 n  B; n" P
Envelope utility use to protect DOS applications:
- Q/ Z4 n& ?8 ]* s# q' [3 R% T
4 g5 I7 @, T" B. D: G) I! h
. N- E2 k$ D! E" j$ i3 l8 e. t4C19:0095   MOV    AX,0911  ; execute command.
$ g6 e: U3 @1 X5 Z2 {5 |4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).3 x" n; i+ c$ w2 u- m  }
4C19:009A   MOV    SI,4647  ; 1st magic value.
& n1 t: G7 n" J2 t6 l4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
6 i5 p& Q& p, M  Z9 a' Q7 R4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
6 L2 f, R; ]3 e1 }* h; I4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute  T/ A" s9 D4 v: L$ n7 ^. i
4C19:00A4   INC    CX
2 H+ M1 G! I& x5 m2 R4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
2 m& U9 Y6 E; e& Y8 }7 @4C19:00A8   JB     0095     ; 6 different commands.
. j+ a. i: k$ s9 C! R8 n4C19:00AA   JMP    0002     ; Bad_Guy jmp back.1 x% `* x: J) g' I
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)) u2 f. `8 B, S) y1 \+ @- l
2 \9 N4 k! D$ Q
The program will execute 6 different SIce commands located at ds:dx, which
" W. P$ z( O* e( z* c5 Iare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
$ E4 h, s, W6 t" W! s. c& Y% W  E6 Q
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
9 r- r3 V% _# \/ R. G3 [" V___________________________________________________________________________
  o+ K! t+ G2 T/ P, C
' ]% l0 T5 t. F) Z. J! |- O$ ?3 A0 v4 n
Method 03
- I7 a, k  n- J9 h% F=========
4 u/ }$ }% p" }7 `1 o  v
. d# `+ S- b- ^! _Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
' |- T; }8 f4 i9 f/ G(API Get entry point)1 A& n: U5 Q5 [
        5 U9 z6 t- ~* \# w3 L, V2 C: f/ d

- a2 ^$ L( _6 ^8 _    xor     di,di
2 ]; ^1 w( F1 g    mov     es,di5 e" ~6 g3 J  N3 W& [
    mov     ax, 1684h       + O) n( N5 M! ^0 j2 {' M, k
    mov     bx, 0202h       ; VxD ID of winice
6 V$ `; j6 ]# J7 S    int     2Fh: T! A2 ]" `6 v( D& @, W3 k
    mov     ax, es          ; ES:DI -&gt; VxD API entry point; t( r& \% p8 x* W
    add     ax, di
) i% y2 o  t% A! Z2 ^    test    ax,ax0 f: O/ _" I) J# `2 @$ C& c2 {: U
    jnz     SoftICE_Detected
" W1 N' g/ B8 p: O( \# z* p1 l% W; H& I! {3 `7 }( W" U$ n. \6 }# H
___________________________________________________________________________
0 R7 u- j; L0 E5 m( e5 U, c5 r( N
" w' ^; I5 g! p/ x8 E: x- e2 iMethod 04* z3 `" C8 S: z# _
=========3 B# b! S# n) H9 C7 E! V; L0 L

) t  L, b6 y: t" ^6 g. _. @Method identical to the preceding one except that it seeks the ID of SoftICE8 A, X1 L, y6 u/ ~' I( x& y  j! _
GFX VxD.
+ a: A' o/ T% p$ U6 K" c
+ h5 \9 H! }& j* N" I* C    xor     di,di, n. `& X9 N8 b) `, D
    mov     es,di+ h0 i/ Q) e" g
    mov     ax, 1684h       ; e! }0 V& t) M4 W: {' n/ }# Y+ A
    mov     bx, 7a5Fh       ; VxD ID of SIWVID
; z" j8 A% o2 X. H    int     2fh
! \% c, j! [, r5 k0 G. g" I    mov     ax, es          ; ES:DI -&gt; VxD API entry point( T$ m, t2 M$ ^% ]( {
    add     ax, di
* w  ~: a5 e$ T; {3 \9 U    test    ax,ax5 F! Q" u9 ~" U9 P, v' D( A* x
    jnz     SoftICE_Detected9 m' [4 F+ P2 c1 S% m2 D0 B, g  x

+ o7 ~' o2 P4 l" k__________________________________________________________________________/ F5 j8 s" D& P0 m& C8 {
1 i+ ^5 H  X, d4 ?2 p6 {5 C2 o

0 x- d, ~$ T3 v8 ?/ cMethod 05
5 P' Z4 k6 n" N1 N=========! c4 P' s( a& I
, ]' V4 c! a" |" K8 Z/ v
Method seeking the 'magic number' 0F386h returned (in ax) by all system
1 @6 T. T/ X( C8 Udebugger. It calls the int 41h, function 4Fh.3 D) K* L7 S- p9 Y( K$ l2 s
There are several alternatives.  
$ @. w9 I2 C9 N3 \3 W: }
) j' ]3 l  I$ e! @) z8 u4 @  JThe following one is the simplest:
2 e2 ?( d& m( j5 C
7 l/ x2 Q; H, p    mov     ax,4fh
6 _: L; u! E; E% M: C$ [2 i# k    int     41h0 c* }' R# P9 y" u* ^1 Z
    cmp     ax, 0F386/ f! K2 y( \1 E
    jz      SoftICE_detected; C) a0 N5 Z9 v+ \3 S7 d9 |

2 K4 A- h+ u" k1 E) F7 z% z3 c
# M# W5 F3 b5 INext method as well as the following one are 2 examples from Stone's
7 ?9 @4 r/ T/ I( G& |* _1 M* p"stn-wid.zip" (www.cracking.net):0 Z$ o/ h! n! i8 S0 D4 @
8 ~5 l* X6 A8 s* j' }, X: {' v
    mov     bx, cs
) m; V+ k8 A" |- h2 e    lea     dx, int41handler2* s4 f0 y: A: G) x5 Y- t- s
    xchg    dx, es:[41h*4]5 `' l* M* {' _1 }$ l1 s! ^- Z4 Y) Q
    xchg    bx, es:[41h*4+2]
$ A# ?9 `& i, v/ B3 J6 P$ X    mov     ax,4fh
# X/ C' J9 v2 w9 Z7 `1 O' c  n    int     41h1 s* A; w8 q+ g
    xchg    dx, es:[41h*4]
8 I; P6 |  {! C4 {9 r5 i    xchg    bx, es:[41h*4+2]
0 U; y  J0 k* ^3 ^+ U# i& M4 ~    cmp     ax, 0f386h# w' r1 r; U+ _  H
    jz      SoftICE_detected+ i  }5 V9 D& P- G, B) T! U$ g

! z7 X# m! L% h9 ?int41handler2 PROC% u7 D2 i8 ^  d- m1 A
    iret
) T' k3 i' O6 {/ |int41handler2 ENDP2 ?/ ~0 e0 P1 ~8 f- t* W% S
2 E/ t7 V( L& J

# z  t0 l- j7 @" c/ A/ b; ?( d% s" j_________________________________________________________________________
% Y' S) P$ w  m; R/ w1 T6 Y. w
% V/ C7 w1 g3 I1 d$ z1 a3 N
+ d. ?2 {' |; O# f5 `8 T& ~1 FMethod 06
. B8 {, f( L& J1 l+ C=========
' A7 y" @0 B0 U% [
1 h# p* _7 F/ z. y5 h4 Z5 r$ ?
0 F; q' J6 A# N3 ]8 `2nd method similar to the preceding one but more difficult to detect:
3 c/ C% l( O# T9 Y; G7 H0 p8 m/ \* @/ ?: j$ f* l

& X% o* S' A5 mint41handler PROC
9 m( a7 \0 {% N2 @    mov     cl,al
  w& i6 Z9 ~5 k& R3 U5 ?9 k    iret
9 |. j/ C& K- N2 i2 C$ Xint41handler ENDP) t8 r) }% U" t, L6 T+ r: \

2 N5 L2 O# M, _  x% E. P5 \( |' ?9 j6 x: @: o: l  B( F
    xor     ax,ax2 Z( @' H1 z* w7 i
    mov     es,ax
5 p7 |# F- i7 m+ P$ w: \    mov     bx, cs
$ ~* |5 b# [8 h, ?    lea     dx, int41handler
3 n0 P; g7 s* ]. E; Q. r    xchg    dx, es:[41h*4]2 C4 J: Q- F1 [9 J( |- C2 c/ u8 `
    xchg    bx, es:[41h*4+2]
4 h5 y( Y& J/ u( Z0 T    in      al, 40h
* O1 |; k& v5 Y5 A* j    xor     cx,cx
  |, H% f9 B- o7 J3 k    int     41h
/ H3 {" q2 y; A( s, V+ T    xchg    dx, es:[41h*4]
7 m. h2 t+ [/ X. i- s" N, L    xchg    bx, es:[41h*4+2]
9 `: I2 J! k4 w' F& Y/ I    cmp     cl,al
  b# j3 {1 `+ i. V% J    jnz     SoftICE_detected
, G- n& d1 V. o+ Z& x9 ?7 K: H& K! _0 d0 V- t$ J
_________________________________________________________________________& }1 J- e- J$ d- R5 g

' p* Q) Z8 n3 t0 S( x+ b( a/ DMethod 07* U: P  U8 N- c# w/ Q0 C
=========
1 \, k) x+ Q- U: W9 q: Q" X$ M* Q6 V3 o8 u4 c1 a5 A% U
Method of detection of the WinICE handler in the int68h (V86)
7 f, A# [* x. o, K6 r( E2 K' ?" `' b4 q6 b, I% t
    mov     ah,43h& D5 N. U& m$ K
    int     68h
/ a" [- o$ C& Y6 S) V    cmp     ax,0F386h
6 k! F8 o: j/ y% e2 S    jz      SoftICE_Detected
: ^1 `* V3 \3 b% I/ g- n) t' O6 ^0 Q7 Y, w! k4 ]; y  h) g! h8 U

( ~: s  u4 x0 T3 d1 X' x5 r' \0 o5 S=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit" m) Y2 L9 x9 z1 _( {, }4 `
   app like this:
# x8 h& q- @; u
4 e6 Q/ C- W7 n9 s   BPX exec_int if ax==68
3 |  ~4 \/ s$ C   (function called is located at byte ptr [ebp+1Dh] and client eip is
5 |1 |1 }# F: N  E" j* l9 z2 e   located at [ebp+48h] for 32Bit apps)6 E$ u- m3 @5 o6 ^! q. c& c3 C
__________________________________________________________________________
" c8 U0 f. Q+ C" m) [$ T# }1 g( a5 K: |, v& ]' ?4 G% k
. i3 u2 {' q  n1 g
Method 08
: d! \; t. y+ S0 R% ?9 |=========
8 W- q. u0 X( z" j# e7 L, `3 V# G! U3 x; o' o. E
It is not a method of detection of SoftICE but a possibility to crash the
/ I6 s! T3 D4 j" C$ t! J7 Q0 jsystem by intercepting int 01h and int 03h and redirecting them to another* u, ~# t8 o  Z
routine.
2 W0 d3 B" S- J5 _It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points" B- |  b- H  @/ y8 h3 W
to the new routine to execute (hangs computer...)$ I! y& w2 e3 ~0 g6 \
" q( v5 @. Z) `3 Z* ?
    mov     ah, 25h, b( C% n* e* v8 a
    mov     al, Int_Number (01h or 03h)
2 V" x* U$ U0 X    mov     dx, offset New_Int_Routine2 h: C) [& c* G
    int     21h  w8 ^# X) H( V  F0 A3 o
# Z( |$ \3 I! q/ |0 P) s
__________________________________________________________________________
9 r2 N/ o% u; c, |+ j. k. u% a9 C$ P! P% G9 u
Method 09
! A# \7 c: F- R=========. D5 N9 ~  v9 A: B
0 r  L  T" j' Q
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
, R* |* |" d1 i5 [$ [2 operformed in ring0 (VxD or a ring3 app using the VxdCall).- O# i. ?4 A/ m) v( s4 k6 n
The Get_DDB service is used to determine whether or not a VxD is installed- G( h' O8 B) N" k: S! O" ^4 D
for the specified device and returns a Device Description Block (in ecx) for' o5 X( _" {9 g+ W- {: @
that device if it is installed.
* e* I( K% d( Q9 A
' ~: I  y$ T0 C7 N/ X   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
3 p. A8 P! z- S3 U- H7 n2 w   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
- d' [; e6 \5 W   VMMCall Get_DDB& H6 t) T$ J. {1 v, l+ [  d
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed1 v: {  n: M/ l# G  N4 b
; Q& x- U8 ^+ e  b7 W+ a* z
Note as well that you can easily detect this method with SoftICE:
  K+ v0 X6 q4 F, e  Z4 v. y2 m   bpx Get_DDB if ax==0202 || ax==7a5fh1 g5 f6 n; `; s" \$ M/ I: x' Y& Q

. q1 R5 x& J, K) `& J# ~__________________________________________________________________________
9 {+ u) _6 M4 ~" t/ r, j# ]  P1 ?* H6 d' T
Method 10
' n. N( P3 h* q2 N=========
  ~9 A# E' W# j( G/ q7 i
$ ^% E5 h9 M4 u+ z6 y+ Z% Y) Z=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with: p2 C9 H1 _( |) E4 S1 A
  SoftICE while the option is enable!!
7 j8 @6 b) `+ _  h( O3 y- ~( W; O. k8 W+ [# T5 j5 v
This trick is very efficient:
5 K4 s$ y4 p" c$ C: Z6 fby checking the Debug Registers, you can detect if SoftICE is loaded
0 l+ o/ K2 Q% d- F, }8 a(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if/ P- ^+ t2 p) w0 c
there are some memory breakpoints set (dr0 to dr3) simply by reading their) G4 H; ?+ b$ g1 I4 g$ g  e
value (in ring0 only). Values can be manipulated and or changed as well- |1 J1 x. }- ]' U# H
(clearing BPMs for instance)
: w2 h$ J2 V3 z
7 |; B" v; a& `__________________________________________________________________________8 p8 J9 I8 I/ B" P. t" I! k
  j7 d& I4 v0 J3 z( {  z
Method 11
+ H1 u- d/ j+ _" `1 N=========" J# L6 [2 A% B7 F, H+ v
: l( R1 T. L* x( V
This method is most known as 'MeltICE' because it has been freely distributed
! C8 n+ ?' e9 X% Bvia www.winfiles.com. However it was first used by NuMega people to allow/ ]7 l1 h/ N. N- ?) ~5 n( Z6 L
Symbol Loader to check if SoftICE was active or not (the code is located3 O, }# q; J; t
inside nmtrans.dll).
: x6 J# }3 ^/ b
& A, G1 {# a/ O+ z4 X+ lThe way it works is very simple:
5 V% l, H3 k9 L) e+ d  TIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
. N  r8 z! Q! I4 ]WinNT) with the CreateFileA API.
! f2 J8 q' K, q! P3 ^  x" w/ C( f( A1 ?7 S* [* Y; `
Here is a sample (checking for 'SICE'):" s. p: Q; T# q- ^9 l: T3 v
( F* f. \3 f3 T( Z' m
BOOL IsSoftIce95Loaded()
0 Z6 H& J# q1 G4 A9 ^{
+ B0 |( t$ x* V9 |) F   HANDLE hFile;  
4 \2 Y9 w, E. V1 k) q   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,' ?. F7 W- c+ f: V# \; \
                      FILE_SHARE_READ | FILE_SHARE_WRITE,( B' z  d+ Y8 Q1 M- T/ J3 t5 X! j7 i5 |
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
2 L& Y3 _$ `& Y1 r8 i  k   if( hFile != INVALID_HANDLE_VALUE )
4 ^0 `- W( P2 X   {6 x7 b/ I3 G# ^/ t/ C
      CloseHandle(hFile);
4 ?/ Y2 Y* ^5 P! B% i! n      return TRUE;
  f* {# J" h$ K   }) M. N& G. |, l( p
   return FALSE;% e4 H) c' h8 f7 B+ [
}
8 V6 |! V/ Q3 K5 I. V
1 g4 F& l% y* `Although this trick calls the CreateFileA function, don't even expect to be5 L! _. K, r9 d. y# g, c* D
able to intercept it by installing a IFS hook: it will not work, no way!3 i  f& h# ~" m' a4 w. K
In fact, after the call to CreateFileA it will get through VWIN32 0x001F
) v- K0 |' \8 m3 x3 B# k1 Y" _, Dservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
4 J9 l3 d, I" L2 E' Z3 Nand then browse the DDB list until it find the VxD and its DDB_Control_Proc& Y; h/ j$ K. B
field.5 i  x2 T* q$ }% ]6 ?% A
In fact, its purpose is not to load/unload VxDs but only to send a 5 G- }8 a" j* a  J
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
# v" w- i% O- |. `+ Y& [' dto the VxD Control_Dispatch proc (how the hell a shareware soft could try
$ C8 g: P, R9 b: jto load/unload a non-dynamically loadable driver such as SoftICE ;-).
+ ?( m( V; p% c: IIf the VxD is loaded, it will always clear eax and the Carry flag to allow+ ]' W) j$ J! [3 X" t# K
its handle to be opened and then, will be detected.
$ c: t& E: v' I9 o7 i# J2 x6 ?1 I/ bYou can check that simply by hooking Winice.exe control proc entry point! ]% e7 m% y! j# H: Z4 f' R; \
while running MeltICE.: \. H, U( ?4 _' s

2 E+ G8 N( z$ N$ ?* @0 w3 X
3 ~3 ?) p. p! u5 g9 I2 M' |  00401067:  push      00402025    ; \\.\SICE- d4 D- a8 N% M: G2 z
  0040106C:  call      CreateFileA  ]3 e2 g- P& K4 |5 D4 O
  00401071:  cmp       eax,-001
& `  f) ]$ C0 `  00401074:  je        00401091
- X* [" M8 Y& ~# c! d% V5 }: p% _) E7 {# t" T; F5 A) l/ r
' N. F) ~6 I% D* Z) m1 j. d! z1 k
There could be hundreds of BPX you could use to detect this trick.
: r$ w8 `5 k" k* c% r-The most classical one is:9 E" E& L8 F- {* p- G& _$ ]
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||# h4 ^5 W. F8 I9 I  Y
    *(esp-&gt;4+4)=='NTIC'
! u) [0 U: y) F9 J2 q
$ @  [3 \. f1 Z( N+ I% s-The most exotic ones (could be very slooooow :-(
! ?$ f4 L% w# V' t/ y9 X   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
4 c* b3 X$ T$ o9 }  s* p     ;will break 3 times :-(
. E- O( G- g# b7 b
+ J' r: \5 R# d$ }: p/ h$ ^-or (a bit) faster:
$ S2 H$ ~3 n7 C   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
+ M8 g* E( ~) s1 O- E
5 r9 j! |* D# k( ]: U/ W" I   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
; q( |6 P4 G9 T: T# j! Z2 g( p& ~     ;will break 3 times :-(
( f& _; H- J9 ~4 J# B. e" w2 i: s9 k5 G+ `; n
-Much faster:+ ?- |! D7 v% N6 E7 o1 n: p: |
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
/ S& Z/ b0 P: U: X% @" Y/ c7 B# `
+ ?+ r. g4 h. K) JNote also that some programs (like AZPR3.00) use de old 16-bit _lopen
& g* y9 x' j. V- Z' U3 \; xfunction to do the same job:
# V2 A; h8 c& n6 c+ q* _5 k- Z& O$ [) {- c( T7 L/ F- ~
   push    00                        ; OF_READ
8 Q. L$ c  |. a   mov     eax,[00656634]            ; '\\.\SICE',0
" D  z5 H8 q$ N6 y9 [! h   push    eax& I! [- U# s" F" O$ ]% o2 f
   call    KERNEL32!_lopen, `- |, c2 @7 C4 z
   inc     eax# g0 x$ a* _# B2 I9 \
   jnz     00650589                  ; detected
4 F4 m* `$ c& ]* ]* h& S% h   push    00                        ; OF_READ
& f0 m( j- x. e( [4 U! c' @9 Y7 V5 z   mov     eax,[00656638]            ; '\\.\SICE'
* [# s2 n4 j/ g1 N   push    eax
  @# T- R8 y) d   call    KERNEL32!_lopen
, g1 R8 d- e. o5 h4 Z/ _; J4 U* G! I   inc     eax/ d' `! _6 i+ z8 K6 h9 q
   jz      006505ae                  ; not detected9 ~( H& D3 Y& ?% k& F$ s0 Z0 i3 f% K

* E! F- z9 q, M5 e, _- \, D; t4 j! Q7 L! h* R: M4 T( e: k# O* K
__________________________________________________________________________
8 }0 Z: o& ]. g- E( A) K
. P! M  V, Z" zMethod 12
6 l4 b! g% d4 e7 G  A; _; P=========0 X" w" p1 n; G5 e& r1 }& {

$ q1 J5 R( i: F2 E' a6 N) rThis trick is similar to int41h/4fh Debugger installation check (code 05
1 D' j  s" F; _$ G) j7 Q&amp; 06) but very limited because it's only available for Win95/98 (not NT)  D2 o0 n8 S, c$ I2 q. c7 e/ V  N
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.& f, l/ e5 l+ E  t% U7 x
" T6 n( e3 T2 ?- y& ?
   push  0000004fh         ; function 4fh
2 j% P. z  K& n6 n6 p   push  002a002ah         ; high word specifies which VxD (VWIN32)
# n/ V5 O/ N- J# P7 k1 {                           ; low word specifies which service1 F* X+ I- A4 y& U; {1 s
                             (VWIN32_Int41Dispatch)
% L" A7 N7 A1 R+ ~8 \   call  Kernel32!ORD_001  ; VxdCall. h3 z* a+ f5 I, G8 s+ Z" J
   cmp   ax, 0f386h        ; magic number returned by system debuggers* i- x, h# c3 B8 k) G
   jz    SoftICE_detected
9 r* |9 D3 Q7 s' U/ ]! e; L. J
8 ~6 X: a9 K- a( B' P$ yHere again, several ways to detect it:
2 R( K7 t. P8 M4 m* G" n9 r" Q8 h8 M. j! `: d. k
    BPINT 41 if ax==4f" p# E, w- A$ C, x- K8 Y
0 e; m) V7 J% ]+ H3 c, A, h. [
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
+ @1 Q, d+ K+ U  }4 p" Z$ @( B, p' P3 f& l
; O" V2 F9 i6 J7 L    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A4 I1 W5 P; E/ W, B- V8 j" A
- ^! @! R! t3 U! {6 @
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!! f) x+ v" I) U* F6 X7 }4 k
( x5 G, {, @! Y( ]
__________________________________________________________________________
' p% v! o  G9 d9 Q
- K, N1 h% U- y1 r( _6 b+ fMethod 13
& F* k  O% d  Q' `=========9 z- m2 Z8 y6 z8 z$ }* H3 B4 g

' {+ J/ P0 H4 UNot a real method of detection, but a good way to know if SoftICE is
" b8 ?, A& D6 [  m$ b7 Z! {; Vinstalled on a computer and to locate its installation directory.
% b% `4 W% u1 L* ]0 ]) aIt is used by few softs which access the following registry keys (usually #2) :
! l  V6 C' L2 B  _6 N; ?1 j, W2 k( O, B" d- D3 T$ M0 D# c  b
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
8 D, I  j, I. @6 [2 R\Uninstall\SoftICE
, H$ q$ p0 n+ I" Q-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
# A3 V' P. w6 F3 ?-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion! q5 s2 M' g1 I# s) a  C
\App Paths\Loader32.Exe
0 `5 Y' r' r1 J6 k" T  F- |$ K+ m" Y- D1 [7 @

# Z9 F/ s) o! O7 }Note that some nasty apps could then erase all files from SoftICE directory# b1 y+ g9 Z( a2 ]8 i
(I faced that once :-(
( j4 n. A/ L1 ^! L  M$ b! \  \3 Q7 u) `1 c; w
Useful breakpoint to detect it:" F" X& h3 H  Z. `0 d
$ t3 B/ j) f- h
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'- g* D, r9 z9 f  M5 ?

& E0 }( P' ]; P# P/ L" N__________________________________________________________________________
" l2 ~: p0 |4 J' T, t9 t
  H$ ]1 a1 {8 `# T  s# p0 z: M% `( {9 m! Y5 J0 l  N6 j$ ]; ~; J2 _$ q
Method 14 - v4 O6 k& Z1 S- s( _8 p( Z5 c
=========
9 q  C+ ^" h2 z8 o" M+ S$ o+ X: k
  v$ `5 {9 m9 T5 C. AA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
* Q& ~# h6 n# h2 w9 s( uis to determines whether a debugger is running on your system (ring0 only).2 U/ a5 j9 B- @( Z! `

/ |" F7 W. Z( I# Q' Z   VMMCall Test_Debug_Installed: d- ^0 B# x. f+ J  K
   je      not_installed9 }  C2 i; c: u7 |& E- b
3 T+ C+ |0 O, E' j# r5 }
This service just checks a flag.0 c8 B9 n4 ~2 W" g7 u& v: r$ K9 _/ A
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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