找回密码
 注册

QQ登录

只需一步,快速开始

About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>+ w6 p/ i) @9 O8 ]1 C/ E
<TBODY>+ }) ^3 b: H* f7 g
<TR>
% I3 s( O- S0 ^7 o: _* ^<TD><PRE>Method 01 / `  W! X) r! ]! Y5 g
=========
0 d8 w5 p, z3 ?9 s& [6 |& O" O* ]; @$ _+ |+ f4 x5 {
This method of detection of SoftICE (as well as the following one) is
7 B0 f' D: a8 @2 p+ v* Nused by the majority of packers/encryptors found on Internet.: N- Y: J9 p* d6 x  c% h
It seeks the signature of BoundsChecker in SoftICE, n# |" ?1 T/ F* }' J
* I" c; {7 P- d; [, N! I- y" N2 A
    mov     ebp, 04243484Bh        ; 'BCHK'
. @7 z' v( X  a    mov     ax, 04h1 E) m: `9 Z" t, T! \4 ]
    int     3       2 n+ h* d6 M! z: M2 K( @
    cmp     al,4
& |+ T$ G1 K4 u* V- w( k; l$ B    jnz     SoftICE_Detected
% x* U! V, c0 ]0 `4 F/ A$ Q- Q* z$ s+ G/ {; z
___________________________________________________________________________& p2 c8 I7 }# B4 h8 o

. g# m7 P9 W8 N" z) \: H/ E, FMethod 02" C; j, f) ?, U/ n/ u  A
=========
& j. P7 {, o4 w- y. A2 ^  {4 X+ e$ N! O% V- N: {# e6 I
Still a method very much used (perhaps the most frequent one).  It is used
' J' F- r# H- K  b6 a, m5 T7 Xto get SoftICE 'Back Door commands' which gives infos on Breakpoints,
6 ^; h: n1 a8 ^( r6 H3 j: G2 B3 s( Ror execute SoftICE commands...
' {% Q$ k0 X$ G, P3 z/ I  \8 x& NIt is also used to crash SoftICE and to force it to execute any commands
  k$ Y' J! |& S# N' S0 V# {(HBOOT...) :-((  ) H& J  h7 S( x. `1 R$ ]

. f: }, n5 O. ?3 g8 @1 nHere is a quick description:# v* W; `7 T' C% m8 _' ^- T
-AX = 0910h   (Display string in SIce windows)0 U, ]2 J6 ~0 [  w" O6 p1 P8 D
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)( h0 H4 t8 n% [  p6 j) b+ a
-AX = 0912h   (Get breakpoint infos)
8 F6 k2 r2 K& o/ Y/ T1 D$ n) \# t-AX = 0913h   (Set Sice breakpoints)
+ z) G+ z7 @- c6 \-AX = 0914h   (Remove SIce breakoints)
( W2 ~& y- J% v, V, j
) n6 ?4 @. K& ~) c- p: wEach time you'll meet this trick, you'll see:
' `# C8 Q5 O( Q) U8 v) h& e" ?-SI = 4647h
: U. P3 a, u! i5 m0 U4 Q5 @# T-DI = 4A4Dh. y2 m: A0 b# y8 O
Which are the 'magic values' used by SoftIce.
8 ^3 e2 ]+ Q' C) QFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.* I8 M  c1 h+ F; q0 y

  l! F: l6 x( X0 YHere is one example from the file "Haspinst.exe" which is the dongle HASP
' Z7 i( p6 k' a, E# t5 G3 QEnvelope utility use to protect DOS applications:; S# ?( u: k- ^# O6 v# I

! x9 R8 g2 F9 i$ I/ |9 N# Y0 |0 D4 E: l
4C19:0095   MOV    AX,0911  ; execute command.
' q( x5 w, v5 N1 @2 a: a4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).4 [2 L, p+ ~, ?" q
4C19:009A   MOV    SI,4647  ; 1st magic value.( m  H4 n+ S! }. x7 o% i
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.7 w% Y5 K' n) Z( @
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
, q0 _1 l  X. A5 q: K4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
; ]0 `" ^" W6 X; o; \0 r4C19:00A4   INC    CX( _% S/ Q( v9 X1 a0 `# h5 @
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
8 ?0 l! e6 U+ S6 H9 f4 h4C19:00A8   JB     0095     ; 6 different commands.
' s8 U- c3 H0 O/ I' c! j- H7 [6 D4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
* h8 r1 C7 k5 w6 W5 u6 f! E4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)- g% B( \. ?7 A7 L5 q! L4 L2 t
- [' Q+ I( b8 c; ^( F+ ?5 w# q: G
The program will execute 6 different SIce commands located at ds:dx, which
  P' U% {3 y1 [' S, xare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
+ Q# ?/ F6 t* `
1 M. e8 w& [8 X# s6 Q+ J* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.0 ]1 |9 q3 T9 v, [' M: Z+ y0 S7 Q
___________________________________________________________________________7 u; p* T! f7 j! v$ {# e6 R' a; `! s
3 `' W* ]2 |- W' j  z8 W

$ F0 p5 a$ c# sMethod 03
4 N' [3 e$ V( c- G=========
$ c& c# z: Y# x5 F1 f; f# [
: u2 j$ V4 L$ f1 KLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
3 D: x# v7 q1 _; y( }4 I# L  H(API Get entry point), `2 B4 A" \# S6 B5 x
          Y0 [4 Y) ~5 c1 Y$ {; r$ |
! z( @: S! D/ V+ z  s# R7 L
    xor     di,di3 o9 M9 l5 p6 Y- w
    mov     es,di. s( p$ _/ t+ A8 ]
    mov     ax, 1684h       0 `. n" z, M8 \% s! M
    mov     bx, 0202h       ; VxD ID of winice
  |# Q4 G" R1 l" y$ E! w    int     2Fh) w4 }$ C. h9 E( S
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
8 g1 g' I& k6 V8 x* A2 {    add     ax, di
4 g$ X; s; M2 D# A  N    test    ax,ax/ ]# ]7 C6 o4 \! H- O( a
    jnz     SoftICE_Detected# O+ u3 q/ R5 ]1 [/ ^/ y, E% M

' a, G) ^0 X: x$ M___________________________________________________________________________+ q, q+ M, C1 v+ Y6 N0 k# I' W7 R
9 v( X$ \+ f: q  I2 f
Method 04
6 Y) S  |5 t( o# @: b=========
& `9 P. e  k, E5 n5 k7 q: w3 I( H9 R. }" q  K) [
Method identical to the preceding one except that it seeks the ID of SoftICE
- {5 ?8 Z/ j! U, e" k& H' HGFX VxD.( V5 U7 o0 B' I0 L( ~
. b  D4 H8 e' C, G6 n, e2 Y
    xor     di,di1 d5 ?4 \6 Z. p/ J, O$ J; N
    mov     es,di& P4 ^  b+ A6 v' `+ J' P
    mov     ax, 1684h      
- p) t( w, u6 _2 ~    mov     bx, 7a5Fh       ; VxD ID of SIWVID
# l; A* y4 ~( a. U* a6 M& W    int     2fh) @6 o* X7 o$ d# }( ~' j, M2 p1 x1 y
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
" [" x# n5 R9 x" \5 E    add     ax, di5 Y- S6 W3 j8 i/ m+ Z
    test    ax,ax# `" G6 K7 Z# K' A
    jnz     SoftICE_Detected7 g% h0 X& @# A

3 [2 ]% G# t7 z* f2 P__________________________________________________________________________3 o2 Q  a! ~* h  z+ ?: {
- W3 x  b$ y9 T  _$ n+ k1 ?

7 D: I% M* I' Z. w& [7 BMethod 05
5 P0 t/ z: q7 |$ e* j=========
0 p9 n, D4 n* s+ _# P7 v+ O
6 I% I& d# h! p" xMethod seeking the 'magic number' 0F386h returned (in ax) by all system
9 ?4 p$ V# X) [4 ^3 o1 N+ \* |* mdebugger. It calls the int 41h, function 4Fh.
! j( w+ u8 f* a4 aThere are several alternatives.  6 i" p) s9 m# {; R

" k/ q# T3 h5 Z3 l7 R$ tThe following one is the simplest:
3 G& D/ K- {$ _$ M% \) r! T4 Z" ~9 x. E$ @  e2 q% x: m
    mov     ax,4fh  T8 |; h3 H/ O7 ~: z3 c, R) ~8 O; J
    int     41h0 `' N- ~, i2 x+ k$ Q8 r
    cmp     ax, 0F386# O& t8 ~" b3 b1 X6 k
    jz      SoftICE_detected# k6 y' L: V+ i

; {/ r, v6 H- @' K
! J+ h! J, J$ z! lNext method as well as the following one are 2 examples from Stone's % Y: i( ^. |: U3 X! R1 i
"stn-wid.zip" (www.cracking.net):) J: w' G6 ?4 |/ d% T0 F& S" p; a1 O

% m- }4 ~  {6 G4 N$ W! |    mov     bx, cs) L9 j6 v& ?: R7 K6 H
    lea     dx, int41handler2  b* [2 n' ]8 X3 F0 Q! Q
    xchg    dx, es:[41h*4]
! S( |0 v' E% z+ |6 O    xchg    bx, es:[41h*4+2]7 q; A: c: [/ s% Q6 l$ t
    mov     ax,4fh
, T+ [6 P& K7 t    int     41h
; R, }, K8 L- h    xchg    dx, es:[41h*4]
. x; B- ?" Y$ \, h# L    xchg    bx, es:[41h*4+2]& G  e( f' X) t6 t
    cmp     ax, 0f386h
, ]) Y1 D) q. t& }% x1 t    jz      SoftICE_detected
( c+ j; g7 `1 }- ]1 V
3 ~7 R+ a& }% I/ c8 Wint41handler2 PROC
: v' N6 @8 [' r  p: v1 ^" y& O    iret
& p: s3 p9 C% z; ]" y7 E6 p  Oint41handler2 ENDP
% _/ f+ S3 E" ^" Q. C
' j( q2 r% H" H  C# h5 H3 o5 z- q0 j2 |
_________________________________________________________________________
5 Q+ k! y7 R: i1 i: t
, S( o! `2 Z4 _. n# b* j0 K' h! {% B0 p5 {; Z1 j+ F( P7 d9 q
Method 06# |$ y6 V  b( v4 R' {& \* ~
=========8 \5 G. F) K4 k: n* e% M' a
" O2 O4 D. ~, n; o& U( \: H
  \5 q% D( y( I7 O0 v9 E
2nd method similar to the preceding one but more difficult to detect:, u2 `; `, H4 D5 l0 `$ A, ^, m0 `

  \0 _/ R4 J. s& t
) Q8 v: d/ I/ y% R- M. V6 d/ fint41handler PROC
4 h5 }0 I8 [7 E/ E0 L    mov     cl,al% {& [$ F+ i. X- ]% Z
    iret) Z! L: k2 B  a$ Y9 {# ^
int41handler ENDP
! A. a# W9 z" T8 @9 p, q; x
; d& a# j) x+ {5 M/ a# _0 d1 W) O' N: Z) v2 F
    xor     ax,ax. u+ W4 ?. d2 S) d, L% m: `8 t
    mov     es,ax2 ]  D( A5 Y7 t) `
    mov     bx, cs% _5 f9 t, e; |* p
    lea     dx, int41handler2 Z, d, a5 Z0 F3 ~$ ]
    xchg    dx, es:[41h*4]( G2 L4 l6 J0 i8 M: J# T3 w: l" I% K6 k
    xchg    bx, es:[41h*4+2]3 }% m6 U* }1 K5 U5 v. l  T
    in      al, 40h
, w& {- g0 {7 G2 c# r( A# m& J; u    xor     cx,cx4 I1 D, r5 C% t$ g: w
    int     41h
5 W. u# k6 Z& M5 F3 ~" w, @* j3 _    xchg    dx, es:[41h*4]7 R) w2 M* \2 _( o9 F/ J) [" m: b+ p
    xchg    bx, es:[41h*4+2]9 I" O% z3 ]' M+ c9 {: k
    cmp     cl,al# n) o+ F2 t' ^( [3 X. I
    jnz     SoftICE_detected
! R2 h7 _+ `: P1 z5 J
. `0 t5 h3 L9 x+ O* @4 Q$ k_________________________________________________________________________- m% A2 y( m& U) x! X, k. D: P+ c
6 J* i, B4 C* R! Z* w' R4 c' f/ X1 c
Method 07
6 K8 D( a' f" @* J=========
. f/ R& C0 D/ i" E& k6 M) X* V2 E, K* p; B: ~% `% A, Q
Method of detection of the WinICE handler in the int68h (V86)( V- U" C  k# Z

7 w) p& D. W: Q: d& B    mov     ah,43h
: Q% Q) L5 E) `    int     68h
0 e1 q( V% O& o7 a    cmp     ax,0F386h
0 R8 _; f0 h1 s( V9 f    jz      SoftICE_Detected
- e( y3 b( i8 K  Z& q' g& i2 d( o

0 b7 b5 Z6 [( ]& a. L=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit3 q2 v) ^8 Q$ l, Q; {3 H9 g
   app like this:" Y6 \, W2 O3 l

; I! Z7 {1 L- C   BPX exec_int if ax==68/ [8 G5 d. ^/ t1 X+ t2 B
   (function called is located at byte ptr [ebp+1Dh] and client eip is
1 H6 `8 H/ [* d/ _8 n" u   located at [ebp+48h] for 32Bit apps)6 d6 ?* Y. a1 ?$ O! p! G, N
__________________________________________________________________________
* x, T9 p% n5 o! p  F; p! f# }; W3 X7 A& u
/ m! s, k" L4 y; P0 F/ ?* t" H  a
Method 08
6 R6 x! u8 [+ B, a$ @=========
- d. {2 U: U! i6 A
1 e3 v! I' N/ K% IIt is not a method of detection of SoftICE but a possibility to crash the
6 j! x$ {' \  E0 {* V! |system by intercepting int 01h and int 03h and redirecting them to another3 w' f4 S3 K; d* }
routine.4 M2 N6 x  r- `# L
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points5 b* _: T) {7 Q$ ]- m
to the new routine to execute (hangs computer...)
6 x( N: \2 j4 Z5 i! ?- C+ B' ?) D" ^8 @2 i6 h; L  _
    mov     ah, 25h
& g$ F4 I) e, p$ {    mov     al, Int_Number (01h or 03h)
: G% h- q' X* d7 e    mov     dx, offset New_Int_Routine- s+ g) u+ n5 ?8 O  [
    int     21h9 L& g! E8 ~# N' S  S' Q; a

" R% _: p" Z' Y9 \- U% U  h__________________________________________________________________________) y0 |# S+ g: w8 O1 q
1 w: Z" S! T0 ?3 o) ^- q1 r7 J
Method 09
/ S8 `7 {/ q. P0 T! P+ D=========
8 J7 j5 b& x, d+ x  d) V/ h
- l/ M! S0 L* B( l! RThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
0 F# F4 v# U) ^6 o" O% N: Qperformed in ring0 (VxD or a ring3 app using the VxdCall).$ {7 z+ P" k7 G2 d8 P
The Get_DDB service is used to determine whether or not a VxD is installed
/ W& J+ i7 }8 e* k, x/ r  Zfor the specified device and returns a Device Description Block (in ecx) for/ Z5 O0 ?/ H2 ~4 c
that device if it is installed.
2 z' r. R' n( i. G! s! y* a3 f. A% V" j1 L
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
  T! s( C4 o; l5 z2 V8 D6 p  j   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)" k1 |8 _9 {+ A- q. c" C' A- n3 r! H  R
   VMMCall Get_DDB
" H5 }: H5 J, m; Y: Y6 G  o: }   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed* @1 I0 ]2 o4 t  |# x# E

# G' g, q/ M0 p. l2 I$ ]& ANote as well that you can easily detect this method with SoftICE:
6 g, _  M# ?" `2 N   bpx Get_DDB if ax==0202 || ax==7a5fh1 V9 i, q% `9 q

5 N  n$ B# H+ G2 v+ o0 k$ A__________________________________________________________________________! Z  q( P% g$ p" h1 E& [

% {: r+ Z* E4 i  x$ q9 b( t  V& ?8 a* aMethod 10
+ o1 \0 \# Z/ x# z# k=========
8 p2 V/ |! K) A5 k- ~
9 r6 k9 s4 w& D& f=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with" k2 _* s3 e" ]5 c; j
  SoftICE while the option is enable!!
7 J; [, m  g% p- V8 z( G# I  B8 T1 t
This trick is very efficient:' d- n+ E" p% p2 a- }5 s- B! P1 q
by checking the Debug Registers, you can detect if SoftICE is loaded
( c- ?( V( n6 J) s- d% P(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
( I" _5 B0 x% B9 athere are some memory breakpoints set (dr0 to dr3) simply by reading their- g' d" e$ Y' T9 T$ K) I, x& W3 X  U
value (in ring0 only). Values can be manipulated and or changed as well2 }$ o3 p1 k) F0 T9 |- i3 y
(clearing BPMs for instance)7 e5 t, l. P0 N

+ _4 x: ]# q1 e( n+ L__________________________________________________________________________
. u, }( N7 U% Q1 v( f# x$ K
! r, g- r' q7 q- i0 gMethod 11
' F; I% n# F. K3 `1 O( F=========
, Z1 g& r8 C# K8 Q4 y% v. K1 q- |4 b# \. X, M  X% {
This method is most known as 'MeltICE' because it has been freely distributed
# J( `' ]8 C" d& e0 jvia www.winfiles.com. However it was first used by NuMega people to allow4 V; h6 C& h* h. {6 R9 b
Symbol Loader to check if SoftICE was active or not (the code is located9 [4 K" c8 R( D6 n
inside nmtrans.dll).5 n- {! j! s' k# ]
* t1 Z" U$ G+ Q$ \8 K/ n
The way it works is very simple:$ j7 l  Y% X! \2 f9 k& D
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for9 N1 N2 F: ^% S
WinNT) with the CreateFileA API.
, [) z2 v8 W  A, d8 N, Y! o$ Q) i
1 a3 I! s& `" z4 Q! L, CHere is a sample (checking for 'SICE'):- |& b: _) p2 h8 K
$ ]& ~4 S6 R( E1 E3 V$ I5 O, F
BOOL IsSoftIce95Loaded()
0 v4 @2 E5 Y& S% A{
' Y( v. R: d4 X2 j   HANDLE hFile;  
/ Q5 t9 r2 T; r4 x' J6 i   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,. n9 Y0 h; ]3 d: H. n* x
                      FILE_SHARE_READ | FILE_SHARE_WRITE,
8 V  X! g+ ~7 o8 z3 J  j9 {  R                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
4 p9 N  f* k  }$ l- K) B3 e   if( hFile != INVALID_HANDLE_VALUE )" o& V% t$ [& j4 F5 f8 o' h$ I
   {
# C3 [* S7 k+ ~7 F      CloseHandle(hFile);/ t- z! L- r+ N% D. B; f, E
      return TRUE;  A; D; E8 o4 L0 L4 {) e
   }
; I) |2 V% [9 z4 f   return FALSE;8 d0 B: Y3 o9 c) Z/ E
}# ]+ `- f0 y/ ?: W" s. H0 r
  \' i5 l: q# A! |$ J* a
Although this trick calls the CreateFileA function, don't even expect to be) G; E1 W  ^5 _5 }. [2 P& A+ W( ~4 d
able to intercept it by installing a IFS hook: it will not work, no way!* M. j& t* r1 e# p8 K/ ~" V
In fact, after the call to CreateFileA it will get through VWIN32 0x001F5 ]2 {$ ~/ Q0 l: T3 ~; y, x5 C9 G
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)' a3 J) W9 E" D  X- v8 g# w
and then browse the DDB list until it find the VxD and its DDB_Control_Proc
+ J! F+ R8 H% a( e, Tfield.
* t/ g; V5 u: k# C2 a( l4 J) DIn fact, its purpose is not to load/unload VxDs but only to send a
; O, k% \. D4 k. jW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)) Y+ M! N) f4 X  E# j
to the VxD Control_Dispatch proc (how the hell a shareware soft could try
; Y, b: Q; _. [to load/unload a non-dynamically loadable driver such as SoftICE ;-).) ^+ ~/ o0 o* N" l, M" i7 y# U
If the VxD is loaded, it will always clear eax and the Carry flag to allow7 \  g0 B& b2 T* }. C0 i
its handle to be opened and then, will be detected.
+ w' D1 |! A$ P6 ZYou can check that simply by hooking Winice.exe control proc entry point3 }, E4 d% `. T+ \$ g
while running MeltICE.
. W. X# a/ ^1 @( T6 W: z: |. Z0 _/ K
' G8 z0 q  ?# r
  00401067:  push      00402025    ; \\.\SICE% z8 w/ l% a7 l+ c( C9 ?+ h2 N! v
  0040106C:  call      CreateFileA
! V9 `; o. w) x  00401071:  cmp       eax,-001- X, M5 e+ G0 _
  00401074:  je        00401091  v2 }! U, b1 f/ h$ y
) C5 X0 `6 [4 w
( p6 D  S; Y# `! ~7 b
There could be hundreds of BPX you could use to detect this trick.
# L+ E0 S) u2 ]& U( a1 Z9 q# g-The most classical one is:! g3 j* N/ f* n. i. d% x
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
) Y6 ?* j0 x1 N; p! V    *(esp-&gt;4+4)=='NTIC'
# @9 H4 V# B( i6 l7 z. M% w( \4 c/ V$ O& k0 W) |! t. ~; b
-The most exotic ones (could be very slooooow :-(/ r6 L0 |% x$ V0 L# s
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  + D5 x- |$ _" a5 [7 q3 J1 H
     ;will break 3 times :-(- H' _" e9 m& U8 i+ s! X
# x2 j8 d1 [- _$ o( y
-or (a bit) faster:
% c. q% S" r4 u8 t   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
* u9 z" J( h1 N+ Y5 j/ R' Q' I* u9 q/ v! [: r/ C' }
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  7 ^; ?# L8 N$ \% W( q0 Q  g( U4 ]
     ;will break 3 times :-($ ?/ c" E( R3 K! q) F! A" ~

8 v# Y  s6 I- G) _# E. ]-Much faster:
2 K" P8 U8 @& b( r  q   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
$ r" N; Y9 [- D# A& c% `* F9 U$ M. K+ u3 C
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen
9 T$ F2 ^0 O$ E! w1 Ifunction to do the same job:# n  B+ W6 V# d

' n+ ~7 Z! }  c  X) m8 \   push    00                        ; OF_READ; K) z  B  K! p, x
   mov     eax,[00656634]            ; '\\.\SICE',0
! e; a* E3 U! M  X2 K/ B   push    eax
  L; |. T/ @  c   call    KERNEL32!_lopen4 S3 P" i8 T- w+ I  D
   inc     eax
0 q% q3 o* M- Z( k, b/ u   jnz     00650589                  ; detected1 \; h. `, T# k" E4 G( H  T0 E! j. \
   push    00                        ; OF_READ
3 W% t% }! r& }1 ?& s. k$ f   mov     eax,[00656638]            ; '\\.\SICE'
- S- ]0 J4 H# g/ \; J: ~; o* q% A   push    eax
; N" r$ \, W$ k   call    KERNEL32!_lopen" m; J( u4 O! O8 O( v; v
   inc     eax
- P- s0 g9 u9 a( O   jz      006505ae                  ; not detected7 C* N" Z. P- ]6 d
; _" I& L6 i5 H; @! m7 c
( q) y4 K. O4 ?9 Y3 c% @7 }9 f
__________________________________________________________________________
/ [4 v/ t' n: \# t- C3 o) V' h6 C: j/ d; T8 ?5 r
Method 12* _8 m; [' O( n) P2 ~2 q, z
=========
& j2 q, v8 T" {3 b- _* A- q
) z' I& u2 L. S& aThis trick is similar to int41h/4fh Debugger installation check (code 05; k# E" t- i; T& n8 Q
&amp; 06) but very limited because it's only available for Win95/98 (not NT)
4 i0 I; z. d& t/ {4 Mas it uses the VxDCall backdoor. This detection was found in Bleem Demo.
. ?/ I1 C4 c% s6 T6 n+ ^  {
/ d! l9 W1 A( u5 \/ H4 j   push  0000004fh         ; function 4fh5 O# F6 p- u0 n
   push  002a002ah         ; high word specifies which VxD (VWIN32)7 X1 a4 ^+ D1 I0 R0 j
                           ; low word specifies which service0 P; H  {5 q  S7 v9 I
                             (VWIN32_Int41Dispatch)3 [; e* U- R; g" \
   call  Kernel32!ORD_001  ; VxdCall. Z8 ^6 [" Z- q) [  c
   cmp   ax, 0f386h        ; magic number returned by system debuggers
+ s  G( }9 a0 y, o2 }. X* [   jz    SoftICE_detected- w6 [  d: b: Q! |8 P( s& j

6 `0 U6 S" d0 m/ x9 T' e, `Here again, several ways to detect it:7 _2 e) s9 B# J

" n( h& t! ^5 t2 r4 N( x    BPINT 41 if ax==4f
! W: e% E4 E0 x
8 ^0 h7 u/ P- |* N/ E    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one9 r' c6 x+ r/ ]% j% y
' `) V5 w9 q0 q! N3 k
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A& v9 V: s2 i' \# T2 C7 N6 v
2 |7 a+ i% N; O, t; Z: c% W
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
4 L/ K. F% E( b" a. F: T
* T8 ~/ i. \( q( r6 Q__________________________________________________________________________
" h3 k& m- X; F3 F# D/ l' U7 a9 _" V# }4 R1 D8 S- c
Method 13) U8 _2 o8 a. ?
=========
& |+ G! S$ @# V( C% k. A+ D; [- [
& I+ E1 z, }0 |& UNot a real method of detection, but a good way to know if SoftICE is8 Y4 w  C5 s, j% t- x4 O
installed on a computer and to locate its installation directory.8 p$ Z% k) I! @* t4 q4 f* Q9 y
It is used by few softs which access the following registry keys (usually #2) :
$ P$ X9 w9 N, r, Y7 J0 x
: x7 ^" z) w" g1 g& z8 j-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
- h2 U+ {. h  Y1 X/ I\Uninstall\SoftICE# v3 O: d0 s0 L2 }+ ]8 h
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE4 P& F; }2 x" ~8 Z" C% Q
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion3 T! O4 o, s8 k. C
\App Paths\Loader32.Exe+ Q9 L% y, P0 q$ N6 {% N  m
/ x# Z' y7 ]/ e+ l1 \
. u8 D: l8 g  H. e2 A( P* R
Note that some nasty apps could then erase all files from SoftICE directory- c5 F& j! [" a" F8 T8 V6 A
(I faced that once :-() X" ]$ ~3 ]5 w1 O
& w8 m: ~5 y+ J1 L2 j' y
Useful breakpoint to detect it:
( H7 Z1 i# R3 f  Z- X$ p2 v! @1 B) w4 {7 D
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
  {$ }- b8 t6 o2 ]1 J
& Y/ w8 c: |% q! x. r$ X& s( d5 p__________________________________________________________________________* `! l8 I) o$ F5 ]' c, u6 ?
  ?( x) [; N( l# H# U7 |

% p4 G3 t9 ]3 w% x+ M7 \Method 14 ) K6 h- z' q1 A& d% f+ s
=========/ i8 H+ V( B, l; ^

& U3 R, D3 x# K& oA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
+ ~! s7 `$ }2 q( s% p" gis to determines whether a debugger is running on your system (ring0 only).2 ]/ ^& |. S" W9 }7 n5 @% l
% ?: F' n1 Q0 M, R
   VMMCall Test_Debug_Installed) S& K( m/ h1 G1 Q) b- H
   je      not_installed" o5 v6 [7 T+ B2 Z3 E

" G6 |/ `3 n/ yThis service just checks a flag.* L# V* q  z+ B6 d# t
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2026-7-20 20:36

Powered by Discuz! X5.0

© 2001-2026 Discuz! Team.

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