找回密码
 注册

QQ登录

只需一步,快速开始

About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
  e$ z7 p# _' R# I$ P" k% j<TBODY>
2 i; D. t, a! ~  ^<TR>! _5 ~* @  [/ j3 D. B
<TD><PRE>Method 01 4 W3 I- X& t3 d# N* W
=========' M- X9 u- d. j  `6 E# Z$ N
8 J7 m9 _' A; y- V% L6 r; a
This method of detection of SoftICE (as well as the following one) is
; q4 s% v8 n' n7 Q- R8 X+ q& C; uused by the majority of packers/encryptors found on Internet., o5 E; V/ n3 ~8 f( k. J
It seeks the signature of BoundsChecker in SoftICE
- y; T0 P" O1 F/ s. _3 b
0 B, @% X3 q1 F( V' `0 {, ^    mov     ebp, 04243484Bh        ; 'BCHK') g2 @5 a1 G( B8 Y
    mov     ax, 04h
3 F3 R' x7 p) y: J/ ]7 i3 w- e# M" I    int     3      
" ^' N3 z0 U. u3 M7 X( D' ^    cmp     al,48 E0 n' O  U5 ?: b$ o
    jnz     SoftICE_Detected6 b" |, z" B  ~. k; y' V
' D( z9 g9 _. ^% [) K* i" g* i
___________________________________________________________________________
' G9 c" f& {' L: i0 ~2 V: \! L0 W' B2 }% U# X5 F7 K( I- O9 k
Method 02
! K  S; Q0 C; Y% w' p$ w=========
' ]. Q5 C: Q, h! O* b# F; r: B8 }3 N: ?8 b# Z4 ]
Still a method very much used (perhaps the most frequent one).  It is used0 j+ ~. i/ F, j5 Y7 D
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,
8 M; W9 h7 N2 V1 z* U) Hor execute SoftICE commands...
; I1 r1 U( z% j. ^. }% cIt is also used to crash SoftICE and to force it to execute any commands+ g: C) S5 {" a; p* ^0 h6 D
(HBOOT...) :-((  
+ {8 a' e5 V/ Z; J- s- u/ J7 l
0 r3 J0 D5 i+ qHere is a quick description:2 @: p8 D' g% n- p* s
-AX = 0910h   (Display string in SIce windows)
* r% U$ ~. [  U: ~-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)  q5 t* Y2 G$ g8 v' |" o3 F/ P# \
-AX = 0912h   (Get breakpoint infos)9 P9 S. L4 N: ^* A& W7 U# c
-AX = 0913h   (Set Sice breakpoints)+ c, v7 r* i  d+ h
-AX = 0914h   (Remove SIce breakoints)! v) H& _4 x1 T' v  _$ P. Y: m
) V; J4 B! q5 x) \/ {8 B
Each time you'll meet this trick, you'll see:$ ]9 q8 G' h) I, f2 C' o2 n
-SI = 4647h9 p, w  w, d3 N& E
-DI = 4A4Dh
9 J- r: U# U) S3 uWhich are the 'magic values' used by SoftIce.
* Z6 D* }( y. b, FFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.
6 t8 g, J" O: p* {4 Z9 E; c: c- F$ n$ ~
Here is one example from the file "Haspinst.exe" which is the dongle HASP# N/ f: E6 i2 Q" w9 I; i/ _4 Y
Envelope utility use to protect DOS applications:
' I: s9 E3 D' q0 l: |& S0 H6 s4 g1 ^# Q

8 @' l# t0 O; Y6 `9 n( ^1 k% q: v4C19:0095   MOV    AX,0911  ; execute command./ u% [& n* \- |; L( `8 }" v" q
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below)., Q$ ~$ o7 W: T8 |- N  o1 ?6 u
4C19:009A   MOV    SI,4647  ; 1st magic value.6 b3 t- k. B/ o) O; K9 `& P- `
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
$ d" K! G; n4 e- \8 n1 O4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)3 k  K. j1 q# N! m4 d0 U
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
" H: z8 }; G! u/ T( T; k6 p4C19:00A4   INC    CX2 Q: @* e. Y8 f8 x
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute7 [# m  H0 _6 K# Y" g3 `7 C
4C19:00A8   JB     0095     ; 6 different commands.
+ ~2 j& x" s" S. y: q, |: Z% }- z% h4C19:00AA   JMP    0002     ; Bad_Guy jmp back.' u3 s+ Q% H2 }6 u2 e; {
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
  C$ `! w  |. a% }+ I" W) H" L  p$ l$ r* ]0 D
The program will execute 6 different SIce commands located at ds:dx, which! b. P# V: s4 `, p/ p# y% Q
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
  m& f6 ?; V' T* ?6 q) s9 k5 m
. F2 q7 h7 L4 d2 q! n$ A: ?* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
! a$ ?. l0 X* C/ G* e$ z___________________________________________________________________________
4 E1 H( \0 M- `8 E* C* ^. p% S7 m& G5 e) E4 C9 ?# t3 l: m- F9 d3 f

/ h3 k* u5 L# \# y; D$ xMethod 030 ?* ?4 }8 }0 _- s! ~6 s$ \
=========% N. `5 l, I8 E4 ]% `  b8 A0 I) P

& }) ^( t) {  {& j: GLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h& o" ^) q+ u( S, x% r
(API Get entry point)
6 d/ a5 {6 K$ x+ o7 z) u2 W        
! t! ?5 M9 F1 v/ L" M- b, s9 ]
9 L& E* Z7 i' m. T    xor     di,di
0 ?' ^/ E8 G* T" n+ I1 G! e2 U  \    mov     es,di
& r4 l" e  y1 b4 @6 X' s( {    mov     ax, 1684h      
! B9 ^$ b" t) ^6 L6 F2 Q    mov     bx, 0202h       ; VxD ID of winice; }# v9 h$ @* o! m; U6 X0 V! g% s
    int     2Fh
& x# i( G* J- I    mov     ax, es          ; ES:DI -&gt; VxD API entry point
: l- W3 f5 b0 g6 `    add     ax, di& l/ N  E% Z+ R/ ?1 Q- A( z; V
    test    ax,ax1 T3 y6 V% e! s' ~: l0 T( h
    jnz     SoftICE_Detected
* \, `6 I# O0 W* C; `2 f% J! N9 S) U( g3 n5 J
___________________________________________________________________________# Q3 S0 }& V( E% b7 D
7 q1 K7 R4 V4 g2 j8 C4 T" ~
Method 04) p2 C" b5 I  s( O
=========
8 f5 P0 f- t, `5 E+ O- L& M) j& e: d( u( S+ f% v
Method identical to the preceding one except that it seeks the ID of SoftICE
7 \$ L3 q/ X) C4 r/ d8 C+ }GFX VxD.
- Z" j5 S( I; h# z9 F, E* I1 n4 ]5 U' f2 ^. t% Q1 i. g1 y& c
    xor     di,di
; D: K5 x  d3 H+ ~: b    mov     es,di
  `' H4 d/ _8 ~" `4 y    mov     ax, 1684h       2 C! K$ k2 i) G0 [% E
    mov     bx, 7a5Fh       ; VxD ID of SIWVID, `( B. Q: v  h% t/ l2 V
    int     2fh, m9 f4 O2 S) i% h7 n6 S
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
3 _  B% k  e) r% Z$ A8 y" {$ C    add     ax, di
8 z2 e' M. Q+ s6 b5 C- z    test    ax,ax
  U+ I! {* b& D8 N    jnz     SoftICE_Detected: d7 r: }. w: Y  n$ c9 Y

2 A: M% Z' X  G3 m7 ~& `0 b__________________________________________________________________________% y* v0 n* P0 y! _6 h* [( d$ L

  n' Y/ s6 N. \# F5 e: o+ K! m' J& `
Method 05
/ o7 ?: z' a( I6 P=========+ F% q) o  C7 o9 l0 e% b1 Y" J" v
  |  t# _* B, `7 ]  W2 ?$ T+ q
Method seeking the 'magic number' 0F386h returned (in ax) by all system
3 w2 _$ L+ r" @" N. ~debugger. It calls the int 41h, function 4Fh.
, h; m$ ~8 S; T' K/ K# uThere are several alternatives.  7 ?0 H4 Q: ~( t& `" k4 `& i7 ~

; u% w; b4 p  ]  [! N) IThe following one is the simplest:: ?! M' H% l1 f( T

+ m+ I) K' |' r' s2 n7 ]1 n    mov     ax,4fh
1 o# B) i- `0 k" U: F    int     41h7 L3 i" b) q# C9 P/ {- \/ }4 ^" L
    cmp     ax, 0F386
6 w0 w+ E& K% D$ ?! ]4 ^6 v    jz      SoftICE_detected
8 `- X5 B* D. L4 h& @! L+ ~& S5 ^8 B& Q% y5 i
' m; @& i& }, O4 V: c: y0 W) |* e
Next method as well as the following one are 2 examples from Stone's 6 ?- Q- N* ?% f4 V. A
"stn-wid.zip" (www.cracking.net):0 h- k/ s7 C- S$ n% i
9 D+ t* J, @5 @! z
    mov     bx, cs
5 _. O7 a* C' V! W5 w6 C. c' f, O    lea     dx, int41handler21 r* A* ?# n9 k
    xchg    dx, es:[41h*4], f& O$ `# N9 d/ I3 X6 i; M* h& J
    xchg    bx, es:[41h*4+2]' @$ `( R( i/ W
    mov     ax,4fh
9 v, @$ M8 `" b. Q$ e    int     41h8 v9 J$ g. ?' U2 ^7 g+ F
    xchg    dx, es:[41h*4]
2 G9 b' a+ w2 {! z- T9 @, [% x    xchg    bx, es:[41h*4+2]: b& E& S7 Z5 l# T0 j1 T
    cmp     ax, 0f386h- r6 i5 A8 n% w
    jz      SoftICE_detected
! X$ l1 ?5 p; a& a. q3 O- M# u' v' v8 {
int41handler2 PROC) _1 n9 J; w4 J- X* y3 Z  O
    iret
' H0 S) d! g8 q* m: ^1 Pint41handler2 ENDP$ V  b1 U* V# F* x* r$ n/ ]

. L6 Y2 ~+ N1 n/ h+ q. L* V  t1 _2 c; R  y5 P( O- I
_________________________________________________________________________4 e' ?3 v) D1 \/ D+ N  Q4 a

8 F6 J  s0 f; M. W! ~7 ]8 N$ F- @
Method 06
3 B# n9 I3 \+ d1 X+ x9 Q/ u5 t=========
/ z* w$ j5 G8 T, P# u* i2 m
8 @" q- K. x0 j# f9 m5 n1 u: r$ ?0 x: i! g
2nd method similar to the preceding one but more difficult to detect:
4 }1 F& z/ ?7 {
1 l2 z0 Y. G, g/ `* w" _6 }6 Q5 i+ _! z2 t& G3 n5 D( p/ o
int41handler PROC
- M  ?. C) U( i4 Y5 |    mov     cl,al
3 B3 m% `! c* |    iret) Y; W- D* I) O9 X; T2 Z2 R( M
int41handler ENDP) q# K/ g! A4 i* e

2 c+ [0 \% ^# S. P, w0 U3 K: R* n3 [' F/ e& E
    xor     ax,ax& a0 M; B+ I) A, x1 ?! ], c
    mov     es,ax9 z1 Q( i" Z* H% Q
    mov     bx, cs' t8 E7 E) O$ J* O
    lea     dx, int41handler, N+ R( F8 z3 n8 c" ?
    xchg    dx, es:[41h*4]! Q) K" `; I5 m
    xchg    bx, es:[41h*4+2]
/ G1 L( |- T% a! ?' ]6 n! D$ r    in      al, 40h
$ b: `, A/ c5 C: O5 z( @, E9 L% U    xor     cx,cx
7 {: H  H3 w1 l1 U% J    int     41h
2 M# L/ }. U7 R( o1 \    xchg    dx, es:[41h*4]
5 E; S& F% {* {    xchg    bx, es:[41h*4+2]5 o$ y8 V! D% E4 z% ^  w
    cmp     cl,al. g  K6 C  x  w- O) Y
    jnz     SoftICE_detected: G" a& Y: |/ ~+ b: s% S

. A& f$ j- y% f. Y$ Q- _5 |" g_________________________________________________________________________
0 y# ^6 f9 j$ D" [8 f/ M+ k
- }, ~( q* ^2 q/ K9 mMethod 07. N( f' y1 F# D% }+ L
=========
" h6 h7 o5 [) ~. r, c  p7 Z: D# F9 T
Method of detection of the WinICE handler in the int68h (V86)8 U! w8 b- v# X0 ~+ e& i/ T
9 h. H! U: h  L# O
    mov     ah,43h- Y2 f- `* M- T, s: t
    int     68h: h) K, b: }# L( f4 g6 [
    cmp     ax,0F386h( h* ~8 T' B8 J8 ]1 Y
    jz      SoftICE_Detected, I: k# D4 h8 _( G7 j) J6 G, v7 ?
/ S( M, `* p' D3 o
. n+ |# Z& i7 ?8 V8 n
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit2 `; I8 N/ F" C+ f
   app like this:
+ J# O1 i5 F1 w2 _6 x& O
2 ^1 y) K7 E6 n9 ~   BPX exec_int if ax==68; ]' _0 f: \9 R" `* H
   (function called is located at byte ptr [ebp+1Dh] and client eip is
* T" \! a- [9 Q) e8 W. Y   located at [ebp+48h] for 32Bit apps)4 p4 ]) I5 v% }# }
__________________________________________________________________________) ?* n- y, A% t# r  p' n) [9 Z
# }2 M7 p. z; d& R4 n

' W* ?% P% D" {, t' U! eMethod 081 [- w+ H/ O& g! A
=========
5 f7 ^4 E' x3 U2 \9 ~) q. h9 B/ d3 m5 x) F0 {4 x. B
It is not a method of detection of SoftICE but a possibility to crash the
0 n1 B' J& i/ ~$ H6 ?: L. h3 Isystem by intercepting int 01h and int 03h and redirecting them to another$ q0 p0 {/ m8 U; `7 I) n% T
routine.
! y4 L% v0 x, C+ T9 u3 h$ R# TIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
, ]$ R9 u9 j& g4 c: L2 G  V8 wto the new routine to execute (hangs computer...)
2 x& S/ d& j. P6 p
+ K: {6 h. b, y& C! i/ C5 m2 b    mov     ah, 25h
2 v7 ^7 j2 g# I/ _! A- `/ I    mov     al, Int_Number (01h or 03h)
! H% {/ x  t; k9 v  Z    mov     dx, offset New_Int_Routine
* z/ _! ^. t2 b$ J; A    int     21h6 h6 ^: y" R. o

5 f/ g2 b4 ~. w6 u# |__________________________________________________________________________
. J6 v7 @4 ?3 b
  k- G6 u% C# }3 rMethod 09$ p. v$ F. m% }5 G: k, }1 q
=========7 m5 V1 M+ M& h0 A. P6 P

* C0 O6 g! H  P6 nThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
+ Y4 O8 H* S$ F9 @+ Jperformed in ring0 (VxD or a ring3 app using the VxdCall).1 g1 O; ?+ f! B2 K0 N# v+ W; K
The Get_DDB service is used to determine whether or not a VxD is installed$ K" z9 Y" s8 }0 E/ `* p& ]
for the specified device and returns a Device Description Block (in ecx) for$ u9 p' l9 u+ i' `
that device if it is installed., ^& k4 e! o/ }

! _- a6 J; M: }( N- C   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID- o" j& b3 h0 W) V: M
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)' H. q8 K  M6 E- V" s$ W3 G
   VMMCall Get_DDB
. Z) d- M9 d; V8 a; E   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
& w+ l- Z1 u. C
, f5 f6 p. A- E  ^; U1 GNote as well that you can easily detect this method with SoftICE:/ ^& o3 Z' S6 a# O
   bpx Get_DDB if ax==0202 || ax==7a5fh7 v- K: u  r# K! P7 s

8 w- [( q: A' Z, r& h$ w$ k__________________________________________________________________________% r' `) A! t* r% p2 t2 w  v- G- @

1 L: i' ?' U8 @; ^) B: QMethod 108 S; U) X$ r$ K% x  S' i* F7 e* S5 l; S2 `
=========2 G2 k, Z2 I+ \0 J2 E
3 J3 r2 g3 q6 M, U  J- k2 x4 d
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
' W6 k7 r# a' e$ O  SoftICE while the option is enable!!* z9 N' j% A! e6 a3 y
3 j. C7 i  u! y$ _1 x' T
This trick is very efficient:% ]) `$ P% J3 d% n3 ^: ~
by checking the Debug Registers, you can detect if SoftICE is loaded
6 d) m* d/ ~+ |, r" ?3 S(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
2 T! b" G$ k- Uthere are some memory breakpoints set (dr0 to dr3) simply by reading their' U, U$ B( q, b. o( h! o4 s
value (in ring0 only). Values can be manipulated and or changed as well6 v$ C) y% E$ z* l
(clearing BPMs for instance)5 g4 U8 o0 i$ P/ D% C0 J
8 u; p4 K7 n9 u& y* i
__________________________________________________________________________( [& v" P$ w7 o
: \- w' X7 ^8 U( e  u; |' [* q' ~
Method 11
7 v- f; |- E9 V=========6 G1 a8 |  K8 B" A. i0 y

  ?8 Z6 j( v6 d8 aThis method is most known as 'MeltICE' because it has been freely distributed
! n& L  T$ E0 `8 Q" y9 fvia www.winfiles.com. However it was first used by NuMega people to allow$ s& H2 Z. Z+ H& U
Symbol Loader to check if SoftICE was active or not (the code is located+ T# h' c7 w6 x
inside nmtrans.dll).
" |% Y4 u& W2 U* @8 E( e4 _" n+ o
6 X4 M% b3 q$ U( v4 mThe way it works is very simple:( N; U  o$ f5 m+ H+ a$ _
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for( h. }; Q0 B* @- N, M" T6 |" e
WinNT) with the CreateFileA API.% ~! _# A1 K& z

, t& O$ b0 ^; C1 g& g; H: }Here is a sample (checking for 'SICE'):! y% Y" M/ L/ K4 j- F2 F( Y6 }

. n7 Q8 b' I- ^0 G( _% ^BOOL IsSoftIce95Loaded(). d8 A! c! u; s7 A: @8 A
{
, n: B- @& L3 p3 C* f   HANDLE hFile;  ( _$ j5 Z; {8 `. Q. _
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
' A+ ^8 ]1 B, m                      FILE_SHARE_READ | FILE_SHARE_WRITE,
5 _: ?0 f2 h+ d                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);; p9 {- v0 r7 [9 T* N
   if( hFile != INVALID_HANDLE_VALUE )" o- d! J. t; h4 j5 J
   {  c& `2 h9 h, d2 p$ ~
      CloseHandle(hFile);
' c. V  }0 p: r      return TRUE;
* I' D% }; ], ]; a3 [   }
* I; G+ Q9 W/ r0 w& [( d+ ~9 Q   return FALSE;" C5 t" y9 o  X. ^: s3 A6 D+ t
}, g. c+ g: W" p/ s
, @+ q9 ?7 ~. s
Although this trick calls the CreateFileA function, don't even expect to be8 M* `" ~% B+ K" i% \7 i
able to intercept it by installing a IFS hook: it will not work, no way!, H0 g# O3 ^' }3 D7 u) ^* S
In fact, after the call to CreateFileA it will get through VWIN32 0x001F
: R# @7 b2 ^( l- t9 u. oservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
' J. @, d$ n8 e3 G+ o/ G5 nand then browse the DDB list until it find the VxD and its DDB_Control_Proc+ c% V/ C* L# S/ `9 ]
field.  B$ L; B2 V# n/ }% C
In fact, its purpose is not to load/unload VxDs but only to send a
) o$ B, H4 a+ VW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)& o  d/ }( u( S$ V: |
to the VxD Control_Dispatch proc (how the hell a shareware soft could try
, i9 f' v* N1 A: Rto load/unload a non-dynamically loadable driver such as SoftICE ;-).0 \' @# o+ M" `' ]
If the VxD is loaded, it will always clear eax and the Carry flag to allow+ k8 e+ g: m: P3 q% B0 V' J( N, K- i
its handle to be opened and then, will be detected.
8 b- V+ V" P9 ^- O* V0 wYou can check that simply by hooking Winice.exe control proc entry point; }# O8 Y% V' o5 Z/ J* ~' q3 s! f
while running MeltICE.
  O; p8 P% d( [2 L5 S
* j+ f; o) |/ r$ m6 G. h1 O! X
0 |8 T* |0 h/ D  00401067:  push      00402025    ; \\.\SICE
! ?, T( U! J3 `  0040106C:  call      CreateFileA, ]) ~1 }: K4 J4 @8 I
  00401071:  cmp       eax,-001: v+ g" h( x) B; o
  00401074:  je        00401091
, o. R% a8 h9 h+ J0 \
( X+ J, W8 t: {7 F
( ^" b% E3 ^& r8 x! @8 DThere could be hundreds of BPX you could use to detect this trick.
+ d" s1 I( G, x: x8 [6 k-The most classical one is:4 g. H, Y9 j4 @0 K+ @
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||0 `+ e  ?! O3 I6 O3 k0 a+ W! q2 s) K
    *(esp-&gt;4+4)=='NTIC'
( e5 m3 x- x! `! \, P. m" B( D! u9 G* H/ k" c
-The most exotic ones (could be very slooooow :-(
9 q+ g" m# h8 w$ C9 Y2 w   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
3 X: l5 ?- y- g" V4 P+ R. H     ;will break 3 times :-(
# g8 H/ S; j! @% f4 H
4 |" d; m2 s5 \/ f-or (a bit) faster: & N. t7 U$ F4 I
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')) h7 l5 @9 v1 z  g! b' Y

1 n1 q: l7 O# ^; n   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
& f- L: X# K! d1 Z) R     ;will break 3 times :-(+ D! k. X, D2 Q5 H, e
. L/ B# N# `! g
-Much faster:
2 S) T( ]# X2 d$ r1 W   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
1 D$ v+ A0 W* t; [0 F$ V/ y9 x+ |3 A( s; [; v* ?' c
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen
) E" Y+ w* q1 R6 ?' A# {' bfunction to do the same job:
  H" P' O+ M% D; H+ a; m& u& h+ k, L, n. k0 H- V
   push    00                        ; OF_READ
7 T. y. ~- f7 i5 I6 v! I   mov     eax,[00656634]            ; '\\.\SICE',0
; u* r: i, ]2 j! _8 O+ j) Z   push    eax
  ]8 }. `9 ~1 X, S& a   call    KERNEL32!_lopen
  B  H* [3 \: x  V   inc     eax
; t# S7 M: f* ]+ Z( p; N% N   jnz     00650589                  ; detected& b6 }: v9 A) C
   push    00                        ; OF_READ
9 p& [$ P$ T4 \4 w# K% n) D+ X+ t( U   mov     eax,[00656638]            ; '\\.\SICE'
. }, w+ c2 |4 ?* ~! R, M   push    eax
& F9 K5 Y% U" K7 B% k   call    KERNEL32!_lopen# G' m- I! `* Q9 Z2 Y; F8 o% P
   inc     eax& a% a& \6 Z; N1 K8 C. Q
   jz      006505ae                  ; not detected
8 e* C' j" O* e# i' H3 }+ ]% E4 S, f5 T6 W1 b4 A

3 j4 e$ F4 D! K! Q9 ^__________________________________________________________________________
7 u% R. r  s' \$ P3 T2 @8 L
: D/ ~, h' l, }5 sMethod 12
2 e3 I7 c6 K+ C" ]& y+ X=========: S' V. \$ K9 i# U! p) v1 V8 I0 ~
# w" G) j3 R7 D$ Q
This trick is similar to int41h/4fh Debugger installation check (code 05
- W- J$ t0 j# h9 s+ `9 P9 x4 X9 D&amp; 06) but very limited because it's only available for Win95/98 (not NT)
" Y8 m/ ]8 S, P* pas it uses the VxDCall backdoor. This detection was found in Bleem Demo.& g( R% t( n4 U" C; {
% \6 L$ x$ m. O/ p# I; @
   push  0000004fh         ; function 4fh
! N4 X# N6 w  T- o7 D) \8 p( f: N   push  002a002ah         ; high word specifies which VxD (VWIN32)
& H7 m& \  N2 Y1 L$ i                           ; low word specifies which service% j! C" r1 [) ~' k& u& ~
                             (VWIN32_Int41Dispatch)
0 M) y2 E  P6 g   call  Kernel32!ORD_001  ; VxdCall
. @1 B! H% }! R- n! k; B' |   cmp   ax, 0f386h        ; magic number returned by system debuggers
" t; y- V8 i$ r. @$ q7 j   jz    SoftICE_detected
, d' ^8 {9 }6 j6 @7 }' h( ]" T; \/ x. z: r& G. ^0 O
Here again, several ways to detect it:
6 P" \9 W; i* K, t9 L2 A: s
6 G6 }' w: I7 @" k2 q% N& J0 I    BPINT 41 if ax==4f
" ]' B! H) B6 V7 P
- {7 g8 g' }8 G5 o3 V! h    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one+ j  I0 n3 j7 v) T
" L6 y: D- u( U. [5 k  I
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
  r" c6 h* o( E8 a) c* e' D
% `* R( d. O- \- V    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
2 o7 ?/ T* ?" w; ^+ ~3 T4 [* k' W# d
__________________________________________________________________________6 g9 _9 K6 G, t1 ~0 f6 T2 Z

9 y8 `4 {; f8 f% _6 G* A: OMethod 13
. Z& ~8 i, T$ t& j5 y=========. A- S. Z1 Q7 k

% Q& K4 N) _3 B: \Not a real method of detection, but a good way to know if SoftICE is
- a8 `* |$ S+ a% O/ W. T" ainstalled on a computer and to locate its installation directory.0 a& Z) n& d1 R4 r: y( \6 [
It is used by few softs which access the following registry keys (usually #2) :
: V9 {0 m8 x4 B+ L& \3 h, P5 y: _; Q, |( ^
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion9 _  @- T$ m, _
\Uninstall\SoftICE
% L4 d6 ]; V1 V' i" [' |-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE4 |  o8 H  }. ^8 i
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion+ }% F6 l) N2 R5 ]2 q
\App Paths\Loader32.Exe4 B& m4 @2 [0 h
! w- ?$ k( B* |7 J
; S) F! X+ Z6 n% F1 T( I+ q
Note that some nasty apps could then erase all files from SoftICE directory
& \  F) j  K' K6 a(I faced that once :-(
& |5 [/ f- |2 ]+ G7 l, ^
0 \9 I. ]/ T& {$ u9 kUseful breakpoint to detect it:" F2 I' b7 g; x" p: d3 m
9 W7 n: q1 P# }/ S, Y. H$ B) V" K
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
" m3 B$ j% h5 @/ u3 z( z& A, j: C2 L
__________________________________________________________________________
6 ?) F$ C! q; Y" {0 m1 I( f
! e" M: p! P" w- J0 j5 a: k5 \# E% N2 ^/ o, k% c
Method 14
7 k- i% h) R; L# @=========& R, \! _/ T0 E0 C6 T6 [8 k  f
$ v$ A1 a" s  _9 ~) o/ c: R9 [
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose/ h. @$ X% X$ C
is to determines whether a debugger is running on your system (ring0 only).
+ H* Q/ [9 \7 b4 V+ l. a7 R# E. Y! W& R8 W7 o( J
   VMMCall Test_Debug_Installed) W( m  f* o+ T/ O2 N9 A0 G5 i2 a3 u
   je      not_installed& e' H7 l+ o* @/ u
: P5 W, R: L% s: m, G) p
This service just checks a flag.
$ w$ x" W/ g5 Z! {9 S, |</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2026-8-9 06:44

Powered by Discuz! X5.0

© 2001-2026 Discuz! Team.

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