找回密码
 注册

QQ登录

只需一步,快速开始

About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>% p! S% m# ^* A
<TBODY>
1 b% c+ u. i  j6 q9 L* i% B<TR>; `, o5 y2 Y$ _- Z$ p1 L
<TD><PRE>Method 01 % `, {* j# s6 e1 [
=========
% `% {* d2 W/ n5 |7 I- `) c& p$ j9 M1 v1 V& m- e
This method of detection of SoftICE (as well as the following one) is/ s2 J' N* m+ p  X! r8 V7 }9 x! |: j
used by the majority of packers/encryptors found on Internet.
& ?- k2 Z, _0 S, @% c  Q7 lIt seeks the signature of BoundsChecker in SoftICE7 f# i* H* U5 r& e1 }  m7 H
& I! T4 B; i  S
    mov     ebp, 04243484Bh        ; 'BCHK'
! N4 _6 K" q  _% D* i! [    mov     ax, 04h" ]( Y  u9 c9 ~  N! H- F
    int     3       - G: y1 u2 M  @9 {
    cmp     al,4& \( A$ ~% w- |
    jnz     SoftICE_Detected" q- O0 `8 |- O3 e. r9 K, ^" I7 \$ d
- b6 a  _* T* Y- ?
___________________________________________________________________________% `% z' T4 l+ E4 D& R. B( B
" O* T; H, m: q
Method 02- u) s% U( t; s% B/ t7 h
=========- t  }+ L0 B- p( R

! O2 G9 ^: V4 I. r0 P! `Still a method very much used (perhaps the most frequent one).  It is used
$ [) Y2 T: h+ M6 t1 y5 {! w: }to get SoftICE 'Back Door commands' which gives infos on Breakpoints,: E- y0 n! V4 y1 x- a" v
or execute SoftICE commands...
4 B7 Z+ R9 }" m% UIt is also used to crash SoftICE and to force it to execute any commands
9 q( U; h8 P+ q6 @3 J" y/ a  E(HBOOT...) :-((  
) H! d" R5 {! J6 y5 @% \' V1 K8 ^7 V% M  J1 v+ f5 J
Here is a quick description:: W9 S4 r* _6 l* {$ j9 j- w' N& {8 n
-AX = 0910h   (Display string in SIce windows)
. Y3 j4 @$ H1 l8 u4 R-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
0 c# h% \* F2 [: _( D/ D# K6 _; K& V-AX = 0912h   (Get breakpoint infos)' U, W$ r+ O" Q' x4 i/ c* I
-AX = 0913h   (Set Sice breakpoints)5 q7 N5 d% Z9 B# {& _9 o
-AX = 0914h   (Remove SIce breakoints)$ `$ @7 \" N$ [0 Y* N  v3 w

; m9 J+ Z" K- f- ^9 @: MEach time you'll meet this trick, you'll see:8 r" A! k; v, N5 S
-SI = 4647h
+ z( X! M) [1 C" N-DI = 4A4Dh, x  s  x4 b. a- g7 ^. m0 O
Which are the 'magic values' used by SoftIce.
% A  a( X, p$ V! {3 s5 T" hFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.
9 `/ d, e* i7 H5 U  a4 D- ]) `. ]9 ], h' Y2 \9 @0 A
Here is one example from the file "Haspinst.exe" which is the dongle HASP
- v+ m" X) L! h5 BEnvelope utility use to protect DOS applications:
! q, V2 u% }5 o. X1 r  z+ e& }5 {9 g

0 B7 G7 o# F7 l' _$ \. Z; P4C19:0095   MOV    AX,0911  ; execute command.
; X9 e1 p; ?/ S# v4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below)." |2 T0 v. m0 ^6 T+ l3 N
4C19:009A   MOV    SI,4647  ; 1st magic value.
! q! U3 U: Y! c# u/ \4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
' I# @7 k( {0 i' [, q; u0 A4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
! W  n2 C, M$ |/ d) X* n8 u, ]4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
7 k- r: W4 k2 w4C19:00A4   INC    CX2 ^0 X/ w: p$ ]
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute& L7 K. O  Q" e6 ^4 @
4C19:00A8   JB     0095     ; 6 different commands.& z; h) }; E/ P! p+ d* A, q$ \
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
9 c* E5 ^3 R9 Y* V4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
, O, |/ n; g% i1 t- h- V3 W
' h; J0 A! o; AThe program will execute 6 different SIce commands located at ds:dx, which6 j( l) g, c5 R) K0 C$ P
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.5 @0 a; J1 [  a- i. m

+ O$ t5 L$ }9 r# R7 `1 |& u* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
4 n) T; Z3 E) D5 i% r7 v+ [: L4 }) e___________________________________________________________________________) Z/ n7 Y! s3 T
1 G( c& K9 w1 M' w& s
8 n$ T) B2 b2 ~% l" ^5 E5 \0 ^
Method 03
$ `9 z. l2 ]/ ~: M0 Y=========! q5 k4 F) e: U# `8 n

, P. M+ o7 I' s) G, Q. z. C& s4 HLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
6 Q0 t# u3 @; F+ C+ A$ v/ q(API Get entry point)
. y; C. f5 j: Y0 g7 c: D- p% I8 T- E0 W        
3 z% ^# ^2 J1 {$ ~. Y/ a# M3 {  V9 d0 n1 B
    xor     di,di  F# x$ c- J/ ^  z& B
    mov     es,di
9 U% C2 A8 ^4 S) {  |4 n3 [    mov     ax, 1684h       # w, Z( l& v, V) t' R. S  p# u
    mov     bx, 0202h       ; VxD ID of winice
8 Z; N& p4 f& W0 o3 f4 I    int     2Fh# }# O; q# n9 _7 _$ F" s
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
  @5 W5 l# v. r5 T  f    add     ax, di
- J" P$ w( S7 b) V5 G$ `, c    test    ax,ax8 J8 q4 h8 I; }
    jnz     SoftICE_Detected7 Y; u6 ^( U, J
; {. |/ a( A+ y  H5 f1 y& K; b9 Y" _
___________________________________________________________________________: D+ s3 A- V; @% ?. S

7 R- |5 A) U1 S$ u# _6 n2 Y4 iMethod 04$ C- S0 p. F2 l) f7 t- I
=========
& Y# Z+ o  |/ u3 d5 M. ^" U) m
$ S( [, X2 d( n# F. MMethod identical to the preceding one except that it seeks the ID of SoftICE
8 P* f# c0 n2 H' f9 p9 w& G. f' J. oGFX VxD.
1 ^+ s% A6 R! b. V7 X  L: }. d! `, Y; t6 S
    xor     di,di
" C+ ?* R+ c  D% e0 B    mov     es,di
1 d0 y) h4 z# \  G' P, Q/ K# `/ b    mov     ax, 1684h       3 V! e1 w# I- N8 I9 G; n0 t
    mov     bx, 7a5Fh       ; VxD ID of SIWVID$ Q3 Y# L& q$ p8 e1 K
    int     2fh
8 C# t6 I2 J6 s  {( ^    mov     ax, es          ; ES:DI -&gt; VxD API entry point' z' z+ l$ F; J, `
    add     ax, di. ~+ S0 l6 V8 s9 ~' w
    test    ax,ax
; ^6 u, ]) N6 r0 j. {, ^9 H( r; n    jnz     SoftICE_Detected! w* N; H6 j& Z/ c, M

# ?) }4 t4 N7 w) L  C1 C4 @__________________________________________________________________________5 ?1 y' A3 |) M* d7 p" c

# e/ ^/ e4 L8 V8 N
' S7 Y' I' A- \! J3 d5 F; a/ ^7 F0 j* hMethod 05
0 i( {! }" f# k1 W% u5 m=========& p! {$ |5 t- N* n

9 G2 x/ d( L$ F( ]Method seeking the 'magic number' 0F386h returned (in ax) by all system
' F3 q! X) R% Z$ J0 m5 odebugger. It calls the int 41h, function 4Fh.3 S6 P  T+ q4 x% C
There are several alternatives.  4 \8 c& w, k( c: N4 U  @+ W5 j% o

* ~) m/ O8 h, R$ d- KThe following one is the simplest:
7 _5 D5 H2 s) u( O4 L7 h2 J7 ]
5 T0 l0 T7 y: h; U; n    mov     ax,4fh
& v7 e7 j" }* M    int     41h
) E  }/ h8 f0 A    cmp     ax, 0F386
6 A, [' b% _3 |    jz      SoftICE_detected
- G- o& l" \" J% B% j
% K7 f) I' Z8 ~1 N' e: Y$ j" Y: |' C
Next method as well as the following one are 2 examples from Stone's 1 R( P" G2 Y( J; k, h: A
"stn-wid.zip" (www.cracking.net):
( F( |  _: G1 k0 V, P3 u4 a( u' }$ F+ c6 D8 s- ~3 f
    mov     bx, cs
1 y$ {6 X; ]" C    lea     dx, int41handler2
$ X+ F+ \" I0 U. n  G8 S. q1 @& j! q# X    xchg    dx, es:[41h*4]3 s  S- Y; ?7 f8 C- f+ `
    xchg    bx, es:[41h*4+2]* x4 g% I3 p" e; I- m- {  F
    mov     ax,4fh! V! x/ U+ u- X" l1 V
    int     41h
# d$ X9 y  K; Z  f. j3 i2 p( q    xchg    dx, es:[41h*4]
5 t9 T% \3 \5 x. s    xchg    bx, es:[41h*4+2]9 {& \* C  O" w1 F
    cmp     ax, 0f386h8 g/ G$ _4 U/ V7 x3 y
    jz      SoftICE_detected  e; A6 {7 J+ q

6 q  j# ^! b7 l: w* L& a/ kint41handler2 PROC
2 k/ H1 L. V  _5 F3 s# b0 I8 Q    iret6 p) G  z  v/ x1 r1 n
int41handler2 ENDP) v- i4 B; ^3 d

3 K3 [% e* U: i5 c4 i
9 c9 j% ]3 o1 X3 R+ ?6 T" y  [_________________________________________________________________________
0 o- L3 t" g1 R$ @" x
9 D; m9 c4 ^! e1 _' ]! g
5 h' G! p3 L0 C% B8 w. t( F  Q7 b$ KMethod 06! u6 S& \  V- c8 W: E  f
=========
7 C+ m! Q' Z% ^; d3 L  k: q4 H1 }3 t. [4 g7 [( w- `

( W% e6 a' P: o! B& |4 ~7 H2nd method similar to the preceding one but more difficult to detect:, `) d  t9 f! w) ~# N: r
! Y# [; y* E7 m  ?: h
' d8 D3 p  q0 L
int41handler PROC
  x1 ]! B* W& q& ^0 `4 `% `% H# J4 k    mov     cl,al! [5 S, n+ d$ V; t) T
    iret# Y' e0 j9 ~1 C
int41handler ENDP
  u8 X, s  h+ i( l/ X, v3 s- b+ f# e9 |. A8 {: A9 S( W
, n5 s( C: `( B8 M# y2 {
    xor     ax,ax
8 e% s. ~) {) K9 n" I) Z/ Z    mov     es,ax
8 [8 d# P3 r2 u  t1 D    mov     bx, cs. _4 p" d. B3 Z" g
    lea     dx, int41handler! d/ s6 _1 R* V, b6 @1 ?
    xchg    dx, es:[41h*4]  S3 k6 `% R5 B7 R- x, i
    xchg    bx, es:[41h*4+2]4 r( C1 I- P2 _% b2 q
    in      al, 40h
; W0 F1 q  \# V9 n+ M+ G  }    xor     cx,cx
+ i9 A; H6 K4 e- h) }, d    int     41h
% j  C' ]* d( n& N' Y- O    xchg    dx, es:[41h*4]& E4 R, c- \7 c! c' N) g$ E3 E
    xchg    bx, es:[41h*4+2]" g' x* [' c+ ~7 z8 B7 E
    cmp     cl,al
6 F& Q% ^7 \+ `3 U+ Y    jnz     SoftICE_detected, U# t( D( L7 x0 s( X3 t  _

$ T% k  [. Z- e_________________________________________________________________________3 b5 s3 {9 K& i6 b4 g

1 H, Z9 r% x+ W- r( x, {Method 075 m; b# M& s. Q* y/ l
=========' B' m! G0 T2 Y. ]% ]

! h! d/ b6 `2 i( V( ]Method of detection of the WinICE handler in the int68h (V86)( R7 |$ b& u! Y' n( y# N1 X

  u, K/ f7 E5 A* U! M) Q3 ~% ^( x    mov     ah,43h
  K) N: l  Y0 K# j2 a    int     68h; Q6 _4 e- D' u4 R+ G" I9 }
    cmp     ax,0F386h
% d7 f+ C  l8 ~0 F7 P    jz      SoftICE_Detected
: h7 k, }4 v1 H# @, v) q1 o1 x7 \" o
$ D  n1 n4 P: i3 F: I! x
; v8 f, G- G1 Y2 o3 `=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit" H: {& d4 B% n0 Q' G* L; Y/ B3 ?/ b
   app like this:
# z# H2 ~4 Q& ^; }7 o1 a  k7 U& R- j& z/ G) p5 @
   BPX exec_int if ax==68. |5 ?( V3 E  e9 |; ^* v  f) h& @
   (function called is located at byte ptr [ebp+1Dh] and client eip is% L4 |# S% N( ~0 Y9 R* |* X, U
   located at [ebp+48h] for 32Bit apps)
' N) J0 \* x# u# t) @__________________________________________________________________________  n% Q& F/ v% u0 o' z, v# ?$ @

) v0 T  U, C4 o5 k# D4 K- _7 q) U! X, o' e. b
Method 08
# U' }6 ~* p# d* a; ^& t3 z+ t=========
- |6 D/ q3 A( h5 ?% `
  }  E9 T! h4 y3 dIt is not a method of detection of SoftICE but a possibility to crash the
8 s# }+ _" ?- D! \8 B+ bsystem by intercepting int 01h and int 03h and redirecting them to another% g' F( D4 \6 h4 J1 v) V# q# {9 c
routine.
" c( Y, S+ U+ T* }$ ?It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
4 T, h5 d8 s- i4 k# wto the new routine to execute (hangs computer...)
% A' H5 y2 J2 B4 L1 F
) {% L! Y2 _# E. @8 C! n! z8 H# F    mov     ah, 25h
4 G: l9 ^) S% R" Y  }8 ?    mov     al, Int_Number (01h or 03h)
2 V- _) m& c- b4 H0 Y; V, A% b    mov     dx, offset New_Int_Routine
6 i* }; {& ^3 x$ h    int     21h
4 X1 f, o" Q5 `* f& s0 ], t3 }; v
: J+ s& d& C. M6 ~__________________________________________________________________________
3 o8 C1 `$ X) j& J0 @' [
+ F/ C* P+ |7 {9 w, BMethod 09
8 |: u4 W5 r! H=========
0 P: f+ G7 u& T) \4 A+ k7 `0 z4 G; r& |
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only3 T1 O9 A! a1 `& H( G) |
performed in ring0 (VxD or a ring3 app using the VxdCall).
8 y5 H& b& s. b0 KThe Get_DDB service is used to determine whether or not a VxD is installed
% A3 J+ j' t8 x/ f8 a' x5 tfor the specified device and returns a Device Description Block (in ecx) for) Y* @- t/ e# G' X
that device if it is installed.
) y3 q5 z- b, ]
/ ~; p, \& _0 n6 v   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
/ ^& Y! Q, m" o   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
0 Z1 w* v  o( E! s# D   VMMCall Get_DDB0 f; K9 w9 `3 ^* f, X
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed2 I1 ~+ {9 K) N2 Z2 l

3 G% \+ e- ]" q: ?6 k5 ENote as well that you can easily detect this method with SoftICE:
1 V& n( o; c/ ^$ L   bpx Get_DDB if ax==0202 || ax==7a5fh4 L6 ]: e! C& Z" `! g1 F

+ D4 e" N! u: N6 p1 p$ d__________________________________________________________________________8 q' x  l9 s3 F5 y. ]

& B: g. a& }$ hMethod 10
) d. ?! |3 ^, ]0 D" W0 F; M=========
& l& |4 ^; y7 ?$ m& Q# {# j1 p' Y- T" [: [( }: a% l1 \
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
5 C2 X( A. s+ J5 L+ X  SoftICE while the option is enable!!
7 |9 A0 f% u& k8 P$ o4 U( `) V0 [0 V" b2 Q
This trick is very efficient:( ]: y+ U2 _6 C  A9 A
by checking the Debug Registers, you can detect if SoftICE is loaded
6 H! ]4 X, Y1 a(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if3 U1 n( H5 x1 n, S) k# F& j: {5 n' k
there are some memory breakpoints set (dr0 to dr3) simply by reading their- W( H8 C4 X. [8 v
value (in ring0 only). Values can be manipulated and or changed as well
/ e0 }7 _0 Z4 W3 B9 L: {(clearing BPMs for instance)% K2 }: R( {4 d$ Y  Y2 d3 h- V1 K) @

: J3 e+ T( h2 n8 z! v# E__________________________________________________________________________
. X: C7 K3 ^5 G9 W6 ?8 V' L! E( Z% \, j
Method 11
. I* r5 w( X$ R$ b  P9 z0 S3 r=========' R: Z8 ^; w% {5 [9 K; e
" b7 S1 H4 ]3 N6 L: L* b
This method is most known as 'MeltICE' because it has been freely distributed
4 [+ d7 K. A5 `' f, G" {via www.winfiles.com. However it was first used by NuMega people to allow
: A% }9 E$ h  P4 ESymbol Loader to check if SoftICE was active or not (the code is located3 h% ^1 S7 G/ @: q+ b$ [( m
inside nmtrans.dll).
9 J5 V& m& r9 J5 Q& k. I; `& D) i' x8 h: ]# p+ v3 b, R( g8 e
The way it works is very simple:8 B8 E: U- ?. l4 n
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for* Y# M/ k: ?$ I& s' E3 o; ]4 ~8 o
WinNT) with the CreateFileA API.
6 @/ k  K9 U& R7 H
2 u' M& d  |; h. {# V5 L2 @1 b- jHere is a sample (checking for 'SICE'):
/ R  D) F+ ]2 t7 |& @& ^) B5 |. {
BOOL IsSoftIce95Loaded()# A5 ~- H5 z" H+ ?; J/ w
{
/ F. J. s- a9 w. }   HANDLE hFile;  
- g0 q. i2 k; ]  d/ d   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,: X) i! A. v# i
                      FILE_SHARE_READ | FILE_SHARE_WRITE,
9 W; M4 I9 P8 X; e6 ~- @                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);% r* q+ k9 ?2 c2 W( c
   if( hFile != INVALID_HANDLE_VALUE )
, a* M. Q0 @0 \; F   {
0 v8 ~* D8 w& ^7 Y      CloseHandle(hFile);$ L( N9 l4 i9 ^3 C
      return TRUE;
- y8 l7 \" v2 q   }
$ J2 M8 A+ S. o8 Z( X   return FALSE;% V4 V  J) _& u8 f4 T
}
' n8 \. N' q  ~1 Q
; s9 J1 a2 V: [- hAlthough this trick calls the CreateFileA function, don't even expect to be
& K4 q4 c/ K+ y* ~* I) table to intercept it by installing a IFS hook: it will not work, no way!
: k+ H2 M) B- f1 o5 QIn fact, after the call to CreateFileA it will get through VWIN32 0x001F0 O/ e$ x. j  b% |( o* I% @
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
  H5 ~$ G  M" Q4 T- d2 j1 tand then browse the DDB list until it find the VxD and its DDB_Control_Proc
. b# w% ^0 }7 C- Z: r5 \4 yfield.; U$ H9 W' ^" @$ w" i$ M) K
In fact, its purpose is not to load/unload VxDs but only to send a . k' k9 m( a( V3 U- [6 y
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)9 o  [9 s3 A1 C" d% i! N+ S
to the VxD Control_Dispatch proc (how the hell a shareware soft could try( c" ~  P$ k9 P) o
to load/unload a non-dynamically loadable driver such as SoftICE ;-).+ C6 W, Q4 v7 {9 g) S
If the VxD is loaded, it will always clear eax and the Carry flag to allow
# y: M/ N7 n. d( b. q; wits handle to be opened and then, will be detected.
9 |7 p9 E7 B# i* {8 yYou can check that simply by hooking Winice.exe control proc entry point) ]) \* F6 l( P5 w2 V
while running MeltICE.- H" b# Y1 Y. f/ W% l& Q4 f9 [; T

! L, k: x+ \& A& |+ L6 Z$ ]1 c" }4 Z, C" w
  00401067:  push      00402025    ; \\.\SICE
& g9 s0 |9 E% v! e* r+ `- D7 P  0040106C:  call      CreateFileA- U5 v5 j/ e* y" f) \3 a5 F
  00401071:  cmp       eax,-001
& x( R& w9 f: g4 \' w2 ]9 y$ }/ f  00401074:  je        00401091
' W$ S2 H! J9 E0 B) @9 N, E  ~9 N  Z  j1 f. `0 N" T& h' w

1 p+ b3 b$ D2 M9 c( |( iThere could be hundreds of BPX you could use to detect this trick.3 {2 I- S+ u" K6 F
-The most classical one is:6 u3 W+ B7 {8 s9 ^" X
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
$ M3 f0 H9 U- n    *(esp-&gt;4+4)=='NTIC'
: Y/ t. R- e2 C
. V* ^; R* R9 u& u  y$ l-The most exotic ones (could be very slooooow :-(
  ~1 b% I  a6 }$ K4 G* `   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  ; ]# x- ]* A7 @4 j6 t0 D/ U/ g
     ;will break 3 times :-(
' m: V, M2 u% U# f8 b% B! F" N- @. M
+ t6 f* \: V7 b! ]0 L-or (a bit) faster: + F7 U  e3 b1 T- s4 k
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')7 O9 M4 C  s5 \' z2 }

) r! e& c9 A( r- C4 O4 i   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
- E* l( U& X9 W     ;will break 3 times :-(, s' l3 S7 i- f7 q( ~6 `
+ ^. g# C" C4 o3 J- V. ~7 l. P
-Much faster:
- U8 ~) s' N1 X- L3 D   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV': t& |1 T" x5 h! i+ Z. ^  b- \

  `! k5 o+ K  G( NNote also that some programs (like AZPR3.00) use de old 16-bit _lopen
8 A9 j9 b/ P" R' r; B- ]function to do the same job:
% h- ]: ~6 C0 o. E# \+ y8 \% y, K% j6 H% c( u& G% W) W
   push    00                        ; OF_READ6 D0 Z1 _; z$ ]9 a' [* y8 _
   mov     eax,[00656634]            ; '\\.\SICE',0! ~, B* m; a& q
   push    eax' V* G7 W- N8 \& r/ j
   call    KERNEL32!_lopen" V! _7 v" h% T# L9 E
   inc     eax
/ d! z& d7 h+ l4 A! {2 `+ J   jnz     00650589                  ; detected
3 W+ Q& Q6 H1 g3 P/ T   push    00                        ; OF_READ7 c9 t. V# ~! X# y0 }
   mov     eax,[00656638]            ; '\\.\SICE'6 X) g, K4 j0 p5 Z: S1 ^( c/ R
   push    eax
3 f! l5 @5 b: Y' R- J   call    KERNEL32!_lopen$ O; C$ Z5 y) z% G% M: R- A0 r- R
   inc     eax! ~: y( W7 w: }* w9 F5 w
   jz      006505ae                  ; not detected1 U0 X) ~+ d$ \* x* Y

+ z4 ?! H4 H6 ]1 j9 t. r% X. H" b, \3 p; a3 e* a$ {
__________________________________________________________________________
4 n, J. Z) A+ |% o$ {! t
: r, O& R7 F( }' L/ V5 kMethod 12- Y! U! ^9 |0 P4 \
=========
9 h6 ^5 D3 n/ F4 G* K( p, u. O: o' z; ^7 p$ T1 M
This trick is similar to int41h/4fh Debugger installation check (code 05
; O* q1 n, x) J) F* M! r: O&amp; 06) but very limited because it's only available for Win95/98 (not NT)& L- d- {1 s; [$ n
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.
0 \) H+ F- w- Q& q: \
' m# w  ^7 s' A' c8 z   push  0000004fh         ; function 4fh
2 M1 `" h3 R( A4 C. T0 [   push  002a002ah         ; high word specifies which VxD (VWIN32)
9 f- T$ h4 C$ a/ _" F1 p+ t                           ; low word specifies which service
/ @2 J5 K: k2 ~$ g5 c1 n" I; B                             (VWIN32_Int41Dispatch)/ |; C& }* a5 M2 _( \  {. v  T
   call  Kernel32!ORD_001  ; VxdCall
1 D7 Z5 L* F* f; D. k2 \$ n   cmp   ax, 0f386h        ; magic number returned by system debuggers
: F& E, M, e4 h4 r. Y   jz    SoftICE_detected& V* o9 s. x2 X% ?5 s7 _
- v% d# q9 F+ V3 [' r  D, R' H
Here again, several ways to detect it:& S6 v, V" }, C5 U- i$ l

) ~4 Z$ r9 Z* U9 V* _    BPINT 41 if ax==4f/ r- ?$ ~4 `7 b
" [  b8 p3 z1 Y% u
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one: B$ m. {, u- ^# d
8 ?; P7 G2 ~8 V6 I7 z* ]5 j$ A* Z9 {
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
; s2 y8 ]# L3 T; a/ n! K6 H
- L9 A! |9 p6 w3 e" B    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!/ n8 i9 z- [/ S& n" Y8 F# R/ I

3 o5 F- a' }- `' R* H' k( [__________________________________________________________________________
9 l. g. P5 Q3 b, v( w4 c2 S- f! N$ E$ o5 [4 v; D& {9 B
Method 13
6 Y8 E7 o+ f2 {0 X5 t+ i=========2 Q! y( U1 A- ]
& Y) N' J" {9 d/ R! k- G
Not a real method of detection, but a good way to know if SoftICE is
9 _/ o4 X, s: q9 T- J  _installed on a computer and to locate its installation directory.
( Y3 o9 Z8 J& p# Y- x! SIt is used by few softs which access the following registry keys (usually #2) :
, j/ R  r' M( M7 r
8 Z  G3 P( k5 S& t) {5 X2 d-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
/ x$ y8 D; }* D; E; B7 |\Uninstall\SoftICE& _: }8 W! g+ o& A' r1 B' Y: r
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
, G6 z, K3 W; O: w/ q-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion/ v4 \0 F  P) ~# B9 k
\App Paths\Loader32.Exe' t+ b0 i. K! _8 {1 J7 N

- i2 K, o- S* J' o6 J+ ?. h4 l# F5 K7 t( R5 g0 ~# d
Note that some nasty apps could then erase all files from SoftICE directory
: h6 J  ]3 }8 i: `* Q% c. w+ f(I faced that once :-(0 W5 V4 H$ v* z1 w

4 x+ q3 c9 m8 [  q+ k% @) `Useful breakpoint to detect it:
: w: N: O2 w' b6 o" o  |
& l+ a6 b# q. k5 x# S" c     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'2 D7 H& v, m0 x& H- S3 X

, y# d6 f4 S% ~1 Q  r& f3 s__________________________________________________________________________
" M: M" p9 i5 D
0 P; {( o" \0 K3 u' N6 d
5 x, M- e, t- f( u# ?Method 14
$ Y0 Y' g2 o, m) d- l* R3 [8 i, v6 G: U=========/ a3 y( \, i/ r& X( d" j

' e9 W' g) {+ w  O- S+ C. EA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
: v0 u  Y3 [# nis to determines whether a debugger is running on your system (ring0 only).& W! v3 J+ z" m, P
, v8 b  [# X8 N
   VMMCall Test_Debug_Installed
: q+ T: s: l$ Z7 y   je      not_installed' ]" W. c# H* u5 a6 C- E4 J5 i
0 z" [: [9 [2 F$ T3 Z
This service just checks a flag.  S) i8 e$ F9 _' C9 G
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|本地广告联系: QQ:905790666 TEL:13176190456|Archiver|手机版|小黑屋|汶上信息港 ( 鲁ICP备19052200号-1 )

GMT+8, 2026-8-2 19:06

Powered by Discuz! X5.0

© 2001-2026 Discuz! Team.

快速回复 返回顶部 返回列表