About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>. |' d" c: b* |& c1 e/ p4 o
<TBODY>9 C7 V3 M: m. O" p
<TR>( j8 N0 d' H* D
<TD><PRE>Method 01
- X, S/ N% S  U6 d7 F=========0 c1 i9 b8 }1 @8 V

9 t* I; ?$ F, n% x; K8 i( |This method of detection of SoftICE (as well as the following one) is/ F6 c4 r* E( n0 f
used by the majority of packers/encryptors found on Internet.% b# V5 t+ l2 u$ [0 `# k, B
It seeks the signature of BoundsChecker in SoftICE
8 }1 y" u' N/ q% _* ^+ P0 \
! }4 h- h( l6 r    mov     ebp, 04243484Bh        ; 'BCHK'
1 V$ L% q$ N) P  j& L% [9 }    mov     ax, 04h! R& ?% z' R. I2 _& W
    int     3       % Q" f) O, N( O  P- A& N+ ^
    cmp     al,4. c: F) v: l' T  f7 y6 w5 j- N
    jnz     SoftICE_Detected- X5 w7 c" G( B  f

. j4 f0 z* w5 Z. i7 W$ U# W5 j___________________________________________________________________________
6 t1 v6 J- I$ l6 [9 t/ M4 V1 F& q7 r
Method 02
! w0 N7 j, G9 g+ i; l=========
5 J8 n1 E, |0 P; }2 k3 j' C2 J% f1 @* w5 G, {, ]
Still a method very much used (perhaps the most frequent one).  It is used' B! i/ m/ N3 n# I
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,
( K* D; l) N. r' x% }or execute SoftICE commands...' ^' f6 h9 U' m
It is also used to crash SoftICE and to force it to execute any commands
2 E+ G# n6 N, p2 F. o' \(HBOOT...) :-((  
- ~. P. u& c. Q5 O$ x) q4 s5 O" E* R/ V
Here is a quick description:6 ?$ N1 A- n, h* m
-AX = 0910h   (Display string in SIce windows)4 G" O& A! K! I
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
  k) a# m% Q3 v2 c-AX = 0912h   (Get breakpoint infos)- L7 J1 p+ o, I& b9 K" G
-AX = 0913h   (Set Sice breakpoints)
& A! [7 Z+ z4 p3 l-AX = 0914h   (Remove SIce breakoints)
# e. x3 J- Z- X& S7 Y. V, z
9 G  j" N* ]; e- l# ^+ ^Each time you'll meet this trick, you'll see:- h1 V  R- l+ @7 X3 w
-SI = 4647h% I8 K: Z2 e4 ]) i4 k% F
-DI = 4A4Dh8 Z6 j/ m5 Y7 Z5 h
Which are the 'magic values' used by SoftIce.
- }4 h, E! i2 W5 @  f5 bFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.4 q2 t  L4 ~6 i( [8 _4 p. r

& A/ H9 d6 p0 C$ Q0 e' [; @! X  fHere is one example from the file "Haspinst.exe" which is the dongle HASP' k* h2 T( U; e) {& C" h* o/ X" p
Envelope utility use to protect DOS applications:; |& S$ Y8 n6 y* G
( u2 |! }4 A; G( b

3 `/ x  G+ ~% I+ E4C19:0095   MOV    AX,0911  ; execute command.
. p" v" V4 h2 s) P  W! J' N4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).) D* \) H' \% J
4C19:009A   MOV    SI,4647  ; 1st magic value.
9 o7 G- c; }7 K* F2 r, E  J4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
- a1 T$ J" U4 l9 k2 P4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
) j% e, v8 n* ~: I4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
! ^: R2 v. I* V  s9 j  P4C19:00A4   INC    CX
& t9 A0 t! L$ J% @* ?4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
* D) K7 S1 u) g# u4C19:00A8   JB     0095     ; 6 different commands.
0 g: P0 v: _) q* J4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
- f* ?- }3 d4 F8 ?: Q4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)1 C9 P$ T8 _6 L, m, ?" g4 L2 g( O

( ~* _2 m0 w0 V7 p/ ~7 kThe program will execute 6 different SIce commands located at ds:dx, which
. G6 E: W$ h  U+ dare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.% b% h+ R$ ]7 ]. i+ s. U
( l0 W9 I9 @; n) {' d
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
2 Y  i! ~$ D8 f  u0 D; m* H2 X___________________________________________________________________________
& M: M/ {7 C. m% `: u
3 ~4 Y( }0 \3 ?. q
3 y; ~7 A* @. G/ EMethod 03
1 V# e; e, L" d2 O=========5 H* \+ m- @3 K3 a
7 J2 z- k/ B. r+ b; R+ g/ w
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
4 q" K( c& U+ Z. M" X% m# x+ w(API Get entry point)) B1 v  r) O9 N( k9 p
        
) l8 ?! T7 n' h6 l1 Y
% p& l4 k& Z2 j# Y: S    xor     di,di5 q8 e' v9 I( `# ?0 V4 n+ F$ O
    mov     es,di" Z+ W6 ^$ J8 V& k9 L
    mov     ax, 1684h       * t% v7 `! j4 Y9 |
    mov     bx, 0202h       ; VxD ID of winice9 t- M9 k9 {3 h* u+ D% a/ m
    int     2Fh  c0 f6 L3 M; P
    mov     ax, es          ; ES:DI -&gt; VxD API entry point, j$ Y: p5 S: B& A" ^
    add     ax, di! A/ B% S' K/ d4 O$ r* ~. D) [7 h
    test    ax,ax
) D% x: U6 I; c- a, ?" r    jnz     SoftICE_Detected
6 a( b4 ~( R5 c3 _: I/ W. q# }
6 L5 q5 e+ a2 r/ J___________________________________________________________________________
- ]- s3 u* C5 h, V& J/ V
. s1 w$ R, [* _# `5 f7 [Method 04# G* u' O  m( u( B+ i8 a( q8 V  d
=========
6 h& `, ^, q: m) s2 P' r- J# X9 \1 ?" ]! k+ k- r' B% y: W: s1 O  M
Method identical to the preceding one except that it seeks the ID of SoftICE
. o. V  g" V, @* m  b. f% [7 OGFX VxD.5 m, Y; _' n/ b, D
* q& x! ~. w0 i* k" {7 Q$ U$ B' L! m, e) {
    xor     di,di
2 C0 |& f9 F9 d    mov     es,di
0 R; u- ]! J- B    mov     ax, 1684h      
: X% c$ \7 n2 n" q# G    mov     bx, 7a5Fh       ; VxD ID of SIWVID
) V* g* X8 [+ k; ?    int     2fh! \1 K: r- o, r9 \4 l
    mov     ax, es          ; ES:DI -&gt; VxD API entry point" A. M. s$ u5 J
    add     ax, di& E- ]0 ]& {! S: |2 V
    test    ax,ax/ O- P- i2 ?) M' S
    jnz     SoftICE_Detected
2 m: z* a$ o8 s3 q$ k0 a
% J# E# E1 F$ b! ^  \__________________________________________________________________________
2 Z1 [! z3 f( Y6 [6 w4 x8 t" @; M4 R& @( L9 b4 ?! ]) c+ A) z
5 z4 }" |1 J. q! w7 o7 l( X6 {: f4 d
Method 05
8 ~% _3 S8 m5 N1 [=========
9 h! G! s9 C# g. {7 B: u1 c/ k' U; m6 l
Method seeking the 'magic number' 0F386h returned (in ax) by all system
5 M' t, L6 i2 N  C8 Q  sdebugger. It calls the int 41h, function 4Fh.
2 Q! F- D/ U6 ]There are several alternatives.  
& X+ K  Y5 u: n+ d" ?$ ^9 k! K, \7 F7 Q) a- k7 Z9 Z
The following one is the simplest:
, ?8 y* x0 n, p5 P) y# b% w' n- ]- R' _+ M
    mov     ax,4fh1 b) h' ^: g- [0 o4 p
    int     41h
# w+ W# ?7 p) y( ]* O    cmp     ax, 0F386: |7 J' ^. O+ y1 I! y
    jz      SoftICE_detected; f' p6 _* t- Y8 ?7 Q: y

' x. N; I( ~- c. |) k6 {
. J3 ~  S& o; y$ j! [' E1 FNext method as well as the following one are 2 examples from Stone's % i( F8 D- B7 o7 h3 ?# a5 m
"stn-wid.zip" (www.cracking.net):
- }! a; ^$ |+ Z
8 z% x' X7 m. j& x- [0 M$ a    mov     bx, cs( u) H, j3 R3 C3 \8 I- j' i( C1 t
    lea     dx, int41handler2
" I- Q$ J* q0 w* N# u8 q# g; m    xchg    dx, es:[41h*4]! y8 \* [4 \. h+ |$ ]
    xchg    bx, es:[41h*4+2]
! G% b/ \6 T7 U) I) }$ e, L9 g4 E    mov     ax,4fh9 F. r- V& ?/ h  T" a* F2 h$ i$ l
    int     41h
( x+ T2 j  ~% Y- a* n    xchg    dx, es:[41h*4]0 y4 B/ j' v; }0 ^9 l% P9 o
    xchg    bx, es:[41h*4+2]
! w: J9 K! O! ~% d4 u% _5 r    cmp     ax, 0f386h5 L4 O5 j& n, Z/ s- R& Y
    jz      SoftICE_detected/ ^* g" z: W& k8 p1 v: q, Y% C

; u2 s5 l( D: j5 v$ `int41handler2 PROC
+ L+ l0 ?4 O" D" B1 |$ V1 l    iret5 z) E) ~  @+ Y# `
int41handler2 ENDP
4 }- F1 o% L$ h! A* o2 b9 R/ X! i. x4 \( S. r5 \
7 e  A4 W+ T  W( l4 {- p
_________________________________________________________________________3 i  h0 L. ?) h) M# u% t

- w% h3 n# a% Q( ^3 A  S. \6 ]6 C) s1 T* U3 k; r4 B0 g: G
Method 06+ s5 x' J! o& T# d% R( U
=========0 r' I$ n! y8 ]  t5 L- p

1 C8 R! x. B  a1 e  }9 |  L
: ^$ a! S3 M" z( T, k2nd method similar to the preceding one but more difficult to detect:* A5 l% V+ S0 L( |$ }

9 u2 [2 N2 Z' V$ J8 K! ]$ ~. X9 S: r( x
int41handler PROC7 C7 \& {& ]. ]7 _7 u3 b
    mov     cl,al! c8 d# V2 F* @, D8 e- j" t
    iret, j" }3 A4 _& k  E3 A1 _* ^
int41handler ENDP
4 j3 I; @/ f" ]5 d8 [: _2 H* j- J& p6 L" E
+ {, e; X- a, V( T6 C
    xor     ax,ax& a. M2 P4 ~& E/ V
    mov     es,ax
0 _# e8 }9 W: Z' c% K! B    mov     bx, cs
2 C4 J' g2 E' V. C( V# E9 k7 _    lea     dx, int41handler
4 M8 ?# R! v7 ?$ c1 ?7 Z    xchg    dx, es:[41h*4]
/ `4 v4 z  o/ X2 }- r" T8 F3 H9 }    xchg    bx, es:[41h*4+2]) L0 R7 R0 O6 V8 l8 ?, @2 ]  M
    in      al, 40h
6 O8 z; Z% h& P5 g  s3 D$ x0 o    xor     cx,cx
, i5 B+ F- |8 P# P' x2 [5 W0 J    int     41h
5 y( b1 _; p. W% B    xchg    dx, es:[41h*4]+ ~0 t4 f! t; j. m2 C" y
    xchg    bx, es:[41h*4+2]! T. D3 A0 V. l! b; l. c
    cmp     cl,al/ W/ ^1 y: {% I$ o/ {& p
    jnz     SoftICE_detected
1 O0 J$ c' F2 [) J
* Q7 u: D( [% [2 N4 T$ L5 G, D_________________________________________________________________________
$ @& n; u: `- v  \& C0 x" x# F  s- w3 @# c( y
Method 07
8 f6 b( B9 P$ h7 d3 S( w! I: g=========
2 _5 P% C, G. j  C- C- l/ c; d3 k3 f' A$ a+ N- d  q. R1 ~
Method of detection of the WinICE handler in the int68h (V86)7 u% q3 G+ I& u, H- ]/ I

- d1 M: V; q' W! m* X    mov     ah,43h! ?) v6 U6 {- ~: I
    int     68h
$ a! v0 ?0 e- T4 _& }1 ]1 D$ A    cmp     ax,0F386h$ Q9 N0 S7 ^, \0 w! P
    jz      SoftICE_Detected- U* ]7 C" k9 B5 F* j" @

2 e' r0 ~5 r& E. O
3 R6 k. s( M/ }+ i: g5 \=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit& ^! I3 \* l* k& }" a* v% x
   app like this:
7 m# b& {8 H. ~8 ?& d9 n
$ V; \0 _/ q* r   BPX exec_int if ax==68- w$ Y& O9 u1 }" M/ v. @! T
   (function called is located at byte ptr [ebp+1Dh] and client eip is
$ m" }+ A1 g% R2 W" v/ c4 x   located at [ebp+48h] for 32Bit apps)
9 P) Q9 D$ H4 Q- F__________________________________________________________________________5 j! t/ T3 c) O) G5 }: C
* C( W+ R" _5 `8 q- r
0 O7 Q# X+ u! `% _" P( a
Method 08, n' U; F; h7 Q5 C# V
=========% u/ g1 D6 @8 L3 T- E/ W+ H1 W

# f$ J( h1 l$ k7 t  y5 EIt is not a method of detection of SoftICE but a possibility to crash the
! v, g+ y5 i5 e, e- u" V. Z1 Msystem by intercepting int 01h and int 03h and redirecting them to another
; L( \* s& f4 k7 W$ G0 Z8 N' U/ aroutine.
. B7 U3 J2 }% e5 V" FIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points% `3 \; Q3 T' i! Q% ]( f; m
to the new routine to execute (hangs computer...)
, @* l2 @+ o& P/ m7 K# s1 A5 ?
1 o, c' {: A0 o! j9 }+ `    mov     ah, 25h
& C: k0 ^; z  c( y8 H( J2 H  K0 k    mov     al, Int_Number (01h or 03h)
' a' E0 Z5 A) v6 |( p    mov     dx, offset New_Int_Routine
5 ]  T! H, Z* v* E    int     21h
. |! n' Y4 p$ H4 D9 r) ^% I! D$ K4 I' |  a: F& Q
__________________________________________________________________________" c, q4 J" B6 k, g, h! ]

* x( N& }* e0 Q" Q: \  v! M- P1 yMethod 09( ^4 H- D0 n0 o3 @
=========# `/ O: I  O# X3 h' V
* J0 X/ C( u* ^7 _" ]& D2 l
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
3 g$ p0 F; [4 `  a: \performed in ring0 (VxD or a ring3 app using the VxdCall).
2 g1 o$ a7 k6 jThe Get_DDB service is used to determine whether or not a VxD is installed
+ @: @# e9 J( t7 E% Bfor the specified device and returns a Device Description Block (in ecx) for# H- O' K1 u3 [; S$ F' G: M) [" S
that device if it is installed.* J3 g+ R- J4 f$ |# i

! c% t+ h0 w) ^- y* U   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
' @6 M, b. Y6 h4 s8 Y   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
& d! n5 T$ q0 J' ~" Z! ^- B* X   VMMCall Get_DDB
9 T# i: s- p0 k: v3 F   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
8 \6 a# F1 c: ?8 e$ w0 l: ?; G: t% ^- a
Note as well that you can easily detect this method with SoftICE:
) ?- d  c  i$ Y% |1 c   bpx Get_DDB if ax==0202 || ax==7a5fh# G1 {# Q5 e# }* l

$ `3 n9 _- [+ U& u__________________________________________________________________________% g9 P$ _$ P* S8 l; I2 N# U( J" v) o
, R$ U# f6 d) i# ]8 G0 h' H
Method 10( c# i; r% H. m+ v5 Y9 z
=========+ @5 g5 S, q, |# U  E5 c- E5 x1 c& c

  |6 u3 v; m2 U, L=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with% W( x1 R9 k& ~% w
  SoftICE while the option is enable!!
0 ~$ V# L( b! i$ l7 x
  w  Z( ?4 k) q  SThis trick is very efficient:0 _: `8 t$ G3 O. m+ X- j
by checking the Debug Registers, you can detect if SoftICE is loaded
4 x* [0 w1 z- v+ o(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if9 i. J! `2 \9 |- U
there are some memory breakpoints set (dr0 to dr3) simply by reading their
% s# h8 O0 @4 l7 R' W9 E8 }& [value (in ring0 only). Values can be manipulated and or changed as well
4 I2 k6 s3 u7 `" A(clearing BPMs for instance)
7 w# g7 W4 T' x" M/ E! Y- C( C4 C
__________________________________________________________________________
# i- V, e/ c) L3 J4 w3 u! m$ d; y, I- g# ^- e. n5 W; e) A
Method 11
9 U: K9 C  U) U4 K% C=========; \: ~3 y! L8 q1 W

9 U5 r3 y% H6 h2 f2 w$ R5 |$ |This method is most known as 'MeltICE' because it has been freely distributed
+ g- j) F) z  |; G- r& {7 t+ |/ Wvia www.winfiles.com. However it was first used by NuMega people to allow/ X5 \# \5 [, L/ A1 H6 A
Symbol Loader to check if SoftICE was active or not (the code is located
/ t$ {8 @. t# t; minside nmtrans.dll).2 Q! e" r; P+ x1 t$ M9 ?5 w
& Q9 h: p# S* G
The way it works is very simple:
& @+ V, v, q- M: k% {# F2 jIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
0 V3 n3 c; j9 e( IWinNT) with the CreateFileA API.9 X4 i$ \; v, V8 t4 u. ~

" [. x7 \# \5 _$ i; ~5 j9 v, KHere is a sample (checking for 'SICE'):
/ E4 |5 ~7 D, y8 W
4 F! j, A& A- IBOOL IsSoftIce95Loaded()9 u+ Q! F# m/ `# y
{+ B, A" x8 D3 x- b; m+ j- x
   HANDLE hFile;  
. z7 a- P  R( L/ Y$ t   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,  A8 T* t0 V, Y, Y1 S3 i
                      FILE_SHARE_READ | FILE_SHARE_WRITE,+ E; h* ]: h7 c% y; ]' `+ C  p' ^
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);' K3 c+ {3 B" z" t) |
   if( hFile != INVALID_HANDLE_VALUE )& \2 \- D# n, |# W' G# @
   {
3 f6 ~! A1 N! S/ T1 f      CloseHandle(hFile);9 m6 s3 P8 \" `6 F3 x
      return TRUE;
: b' t/ G4 g2 s3 V   }
5 Y* w- B$ O. \, P6 g   return FALSE;/ m  _$ }+ x( T0 `3 Q- @$ G6 m
}! O( k  ~6 ^" u; u( B# y# o
/ v6 W% x% y( ^0 m
Although this trick calls the CreateFileA function, don't even expect to be
% W# A5 y5 y, J3 `6 ^4 xable to intercept it by installing a IFS hook: it will not work, no way!! D# ?, k2 Y' Q% F0 k
In fact, after the call to CreateFileA it will get through VWIN32 0x001F; ]7 d) X. _* Z2 @6 _
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)+ h$ Z7 ^* C+ `& `% x" @6 ^
and then browse the DDB list until it find the VxD and its DDB_Control_Proc
- U0 A( i) m- k, r* Efield.
4 i0 Z6 c- G' A* _1 G$ `0 Z* t3 `In fact, its purpose is not to load/unload VxDs but only to send a
# V3 S4 M7 I& h' \1 vW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
4 K* X! _- {7 ]" _6 @to the VxD Control_Dispatch proc (how the hell a shareware soft could try
' U2 W8 K  _! `3 l& e7 S( u4 y3 ato load/unload a non-dynamically loadable driver such as SoftICE ;-).
1 b# r! n* |  c) t: l* |/ f' VIf the VxD is loaded, it will always clear eax and the Carry flag to allow' ^0 B- l7 y  K0 w' V- q
its handle to be opened and then, will be detected.' t/ b3 O! r3 ~; Z, W+ e
You can check that simply by hooking Winice.exe control proc entry point4 h& p9 @* O& `5 j( P8 @- Q3 I0 A. c
while running MeltICE.
$ v1 o0 T6 }. `; o
$ k7 b* Q* t7 `& N7 D+ c
$ L$ H( l* c8 }( a: B& i  00401067:  push      00402025    ; \\.\SICE+ ]' I7 H( p" {5 U8 v7 t
  0040106C:  call      CreateFileA
3 B9 C; S6 o! h1 F8 u  00401071:  cmp       eax,-001
" K% P$ p" M+ g# p3 L  00401074:  je        00401091
( K0 m$ }( {! l5 u
6 S7 B4 Q( ~! ^6 u+ E
1 j- ]% M4 X  i3 l4 ?5 {! R- lThere could be hundreds of BPX you could use to detect this trick.7 S/ f- l# f' ]% f7 n# y
-The most classical one is:- H- c) ]0 x; u/ _. ?
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
1 A" }1 S/ }+ P( X) a  `/ }    *(esp-&gt;4+4)=='NTIC'
4 K& h  {* v7 m! T+ h% c/ \# h$ ^8 ]7 n  C0 P/ P: b8 r) ^
-The most exotic ones (could be very slooooow :-(
  U' K+ R& |8 P& X4 q% ]8 L" p   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  * U' ]+ \3 d  D" n# m) S( L4 ?
     ;will break 3 times :-(
4 H# A7 j# `/ S: ^* s% Z" s
& y, Q9 t7 K, ^6 R4 h, f* z) u# H  \-or (a bit) faster: + P& X. g/ W3 Q* f3 H  s0 j
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')  }/ U: B% {! i) s; x' H+ b

% N5 H, ~6 V" b0 g6 o% f$ h   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  9 f, c/ T7 \, X+ I
     ;will break 3 times :-(
4 F* s; H. P" G, q) S& g; L2 Z9 ?0 ]# }, X
-Much faster:0 e5 M: _! w* V( F1 P$ R3 v
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
1 C$ v8 p2 V) r: ?( v: C: H
( ?% u+ x3 o# f3 M% |$ n& ^& hNote also that some programs (like AZPR3.00) use de old 16-bit _lopen* N# _, V3 D4 N9 ~$ `# ?6 d4 W7 x' e) a/ R
function to do the same job:
! ^) ~1 B9 z" y0 O5 b
* O6 x8 T5 V. p7 G+ l8 P* j5 V   push    00                        ; OF_READ7 o. n3 Q: ]2 F
   mov     eax,[00656634]            ; '\\.\SICE',0
0 Q8 U% A0 F# {/ K. S   push    eax
8 s3 H. p/ f- I0 s$ U) b% W, _% B   call    KERNEL32!_lopen9 G6 W" |+ K4 H6 o2 k# }) N
   inc     eax
9 `( N+ K$ I5 |$ i1 x   jnz     00650589                  ; detected
" V. k0 J9 U7 Y* M, U   push    00                        ; OF_READ5 J3 a- a8 V. |' b1 e8 u% d
   mov     eax,[00656638]            ; '\\.\SICE'* D5 s3 Z- w2 w, E
   push    eax
* y5 w" }# ]$ ^  ?6 c7 ?2 v   call    KERNEL32!_lopen
7 h% T2 a) P# V! J8 B0 Q1 @( o( f" Z/ Q   inc     eax: e- @* W. x. y3 q& _  D
   jz      006505ae                  ; not detected. @3 p3 T/ {' R
( S. z  @0 o9 |

$ K" O. `' f3 \4 ?& \__________________________________________________________________________) v% f9 c' v2 ]& t" l: k' u9 S* `
& I& |7 q! D  C! W; t% L
Method 126 W& ?6 O7 K& O- U+ X
=========
  S0 L$ h- \, P
; F+ s! i% K! n. r" {4 W! H, p- |: RThis trick is similar to int41h/4fh Debugger installation check (code 05
3 V$ @- Y  p. q* `& u0 g&amp; 06) but very limited because it's only available for Win95/98 (not NT)
/ T  U9 |8 O: n& uas it uses the VxDCall backdoor. This detection was found in Bleem Demo.. o, f3 C4 v/ ^9 S1 C* h
1 C( G9 N: N1 k. p
   push  0000004fh         ; function 4fh8 O6 g& w1 S$ A; Q7 d: n1 K
   push  002a002ah         ; high word specifies which VxD (VWIN32)* u+ G. G8 y) w4 H' b$ e( Z
                           ; low word specifies which service- ?8 q* j. A/ B! P$ r
                             (VWIN32_Int41Dispatch)& ^9 \2 w& n) p
   call  Kernel32!ORD_001  ; VxdCall. i! \/ k/ G1 H1 t: ~
   cmp   ax, 0f386h        ; magic number returned by system debuggers
7 r9 q+ `/ `4 i   jz    SoftICE_detected3 c0 H4 q: x  f3 ]2 w

0 K8 e. T& o: @* b) RHere again, several ways to detect it:3 w/ ]' x3 T, l/ v" m* B0 M, }
/ W( y% t  |1 Z# Q' J" c& T8 U
    BPINT 41 if ax==4f
' @1 D5 G, A6 ]
5 t9 Q1 p! |7 n0 e' ?& o    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
) ^6 G6 \& Q2 T( Q* \- F( p+ J# C2 Q, Y( R
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A; ?7 X) q" o7 G
+ f! {* n' l" S6 |* V( ]6 h. Z
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!/ _+ U! s- ~  I* v
  e; W. T% }- X* a( Z
__________________________________________________________________________
- l. O/ M- z, N9 D1 t! Q8 w! \, }2 H2 I
Method 13
1 T. S9 v! t- I5 H& K=========
1 [7 @  u4 G' z# E! s2 G: j7 P
! O+ o, c2 B* X2 sNot a real method of detection, but a good way to know if SoftICE is6 {9 R. o/ F) q+ S. C3 f0 V
installed on a computer and to locate its installation directory., f0 A' L. Y6 `
It is used by few softs which access the following registry keys (usually #2) :( y  v$ e) ]9 D( I- n: r
- t3 u  b( W- |- _
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
* m, j) w. Q' T5 D( B( b, O' v\Uninstall\SoftICE
% }0 g; b* e' U1 u2 X' w! u& D1 |-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
3 r, \2 l/ ^. M2 g4 T-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
7 e7 n* L7 R2 e3 R\App Paths\Loader32.Exe; \5 D, }  f  C; L* Z

- ]& b- w, i, T& g7 S, b( F: d
! Y+ Z0 Y3 g/ E1 qNote that some nasty apps could then erase all files from SoftICE directory
1 J: N" L/ G0 w) S/ p3 u  P(I faced that once :-(% _+ B$ l+ W7 {0 I/ f. }# A
2 B0 s4 K" J7 R+ p
Useful breakpoint to detect it:
/ z! z# T" B) J  o2 l; t5 z1 [2 H( t% I$ p: T, |, i* p7 e4 u, A9 v
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'  f5 q/ R( Q% x

5 D, Q; J9 g  F, o& u__________________________________________________________________________  l' u7 z/ r$ y/ W( P; I

: W( F+ }3 `1 V$ g1 O' O( Q: Q$ x2 b" E# h" q! ?
Method 14 - v" d8 S; P- D- W' n$ u+ e2 M
=========
' b0 I5 \) \2 r1 t
8 w' [1 r) a  P% UA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose* }- q: d" P6 q: b+ O' q
is to determines whether a debugger is running on your system (ring0 only).0 h4 P2 i1 U+ f

$ h3 J1 f6 B( j! H1 Q   VMMCall Test_Debug_Installed
4 N& H% A! v% @8 l   je      not_installed
3 K; _/ p, C- y( X' c6 k$ |& |9 G- M2 I: X" S' s* \* S' n; C
This service just checks a flag.
& V( A. G8 n" o* Y4 w2 f</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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