About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>( n0 s0 @! r$ Y3 K5 G8 @  ]+ r
<TBODY>
2 e( V8 y9 _2 {9 u<TR>
* k/ a" `* n" K7 g5 I/ J<TD><PRE>Method 01
0 ?( x( x/ @, I# }3 m) }2 n; q=========
( c; D9 ?/ _4 S, X" z2 ^/ s; J
6 L" i- V- a) L7 U2 h5 p  B# BThis method of detection of SoftICE (as well as the following one) is5 h5 N7 D! U, K
used by the majority of packers/encryptors found on Internet.
: ?  l% v& }' uIt seeks the signature of BoundsChecker in SoftICE/ R7 L& S2 N9 K9 Q* v! u) H. Y

6 U! V1 H& `# J    mov     ebp, 04243484Bh        ; 'BCHK'  O0 K( ~7 B) f! O2 M
    mov     ax, 04h! Y4 G+ @; @' X. M4 D, h
    int     3      
& C# u5 W$ @5 b% b. @, u: D    cmp     al,4
, L4 f% L% q% _+ i$ }    jnz     SoftICE_Detected
/ c+ F, @* K+ v# m" e  e" h$ U- b. u- Q- ~3 {
___________________________________________________________________________
0 A2 s  |* a# R! W2 J5 X7 i$ V2 t( e% Y' s
Method 02
. u* y4 m2 N9 Q3 |3 B6 d. u8 p) F=========& D% @0 X" K& \

( @% z/ q5 r/ _4 D+ i& N% KStill a method very much used (perhaps the most frequent one).  It is used4 T' H9 o5 X$ t0 l  |
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,
0 j8 ^5 k8 O$ eor execute SoftICE commands...
4 y8 R$ f' i2 z; w! A9 j1 rIt is also used to crash SoftICE and to force it to execute any commands) F" q$ p/ `9 m  b; a% ~9 T/ [3 X
(HBOOT...) :-((  0 t9 c* \( k+ s& ~
9 O5 z6 i% I: M8 g
Here is a quick description:  q& V$ C1 V5 N! [; a
-AX = 0910h   (Display string in SIce windows)/ e, L( R  b4 |
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
6 ]' Q5 x9 k0 C-AX = 0912h   (Get breakpoint infos)
. X% N# q. @7 B7 s8 }7 D7 A-AX = 0913h   (Set Sice breakpoints)0 k& q7 g' z1 b
-AX = 0914h   (Remove SIce breakoints)( U7 M" i# d% d; n# s( z# K8 j

, o$ |& [( W, p4 X* _- x+ XEach time you'll meet this trick, you'll see:) Y  ]& i3 V  r( y  Z1 b" h
-SI = 4647h
. i6 _$ M- @  r1 Z3 R. L# b-DI = 4A4Dh
* x! M$ e) d; Q+ u0 Q5 }8 \Which are the 'magic values' used by SoftIce./ f& a! E' X9 [! w: d& @+ G% p
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.# ?) z/ _* `  L9 ?

, ~8 b( w; z9 m3 i6 tHere is one example from the file "Haspinst.exe" which is the dongle HASP" T* ?2 O9 D' R! {
Envelope utility use to protect DOS applications:
- A% Y+ G* ~' T2 _' M9 l. n9 c: T1 [

$ q% I$ K$ t: E" R9 U* O; c  _4C19:0095   MOV    AX,0911  ; execute command.
) Q* {, @1 |! [9 ?4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).$ R6 o) N) L# F; x" i) j
4C19:009A   MOV    SI,4647  ; 1st magic value.
+ l) x/ K5 e0 V1 S4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
7 z! ]5 P: e, q- A2 q) w6 `4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)4 @% z6 X% N- O
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
! m# ~2 `+ H  Q! i4C19:00A4   INC    CX
* z" A8 F5 C5 u9 R3 F4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute4 _3 R  P# n+ M! e
4C19:00A8   JB     0095     ; 6 different commands.1 O; M, `% M2 s( n
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.6 O: f7 l* H# u
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)/ |- n( O0 b6 L+ d6 {
$ Z6 s" Q8 m6 h9 i
The program will execute 6 different SIce commands located at ds:dx, which) S- H* ?+ z7 F( p0 w
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.% `* Y2 }2 g6 j. s( b2 C
+ U! v9 p2 S( @) q! [
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
, A2 P+ s8 P% H/ u8 H* _- G( z___________________________________________________________________________$ b3 X. k8 k9 e9 u

* M) f& `1 G4 r5 [+ [7 ~
3 R2 L. R" ^; U  C8 ^1 ~Method 03
# e$ d- E1 L3 J( I" s=========- J/ H) q* O& R2 C' o
) w' |+ e0 C8 g
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h9 t6 A# i4 q; U- }3 C% U% N% ^
(API Get entry point)
& k2 [6 x8 d6 S. ~: x          q% Y- i' ?) p- Z
: @8 @" j. S: D$ ^* {8 |* B
    xor     di,di
* M7 r- o2 k  ]/ i: o8 Y    mov     es,di
& k3 |9 l  V9 _6 t  z3 w2 x    mov     ax, 1684h       1 B% M; ?* }0 O- N8 G/ a
    mov     bx, 0202h       ; VxD ID of winice
' ]4 t( `0 L# l    int     2Fh! o7 o- q. S" n- U
    mov     ax, es          ; ES:DI -&gt; VxD API entry point% S+ Q  j, J9 v( V; y% s
    add     ax, di8 t0 n( T8 I$ B8 W2 K- V% Y
    test    ax,ax) X- k% w% P/ a
    jnz     SoftICE_Detected8 z. D/ z, G7 P# ?

" j" ^; T- l  R" W/ M___________________________________________________________________________
8 v( L0 t2 G+ ?- Y
! \1 O% W# R) o/ T! RMethod 04
- |8 h" ~  b9 F/ C( E: ~& |8 `=========
/ j4 k, k+ y8 ?5 N$ h+ g* Z$ H! j# ]$ Y" Z6 L! A! f" C
Method identical to the preceding one except that it seeks the ID of SoftICE' H8 p+ s; H. ]2 O& ?$ j7 @
GFX VxD.& p8 {  u! S- t3 D
9 o% K5 k3 l: f- ~$ E
    xor     di,di% \( p) ]: T8 }  T
    mov     es,di  d% a5 P4 b9 N5 a# t6 B# _' H
    mov     ax, 1684h       ' d* D& w* ]2 V: T" B
    mov     bx, 7a5Fh       ; VxD ID of SIWVID
8 }4 Z% l+ K! K% J, v2 u    int     2fh' A, v3 w. q+ }; _
    mov     ax, es          ; ES:DI -&gt; VxD API entry point+ _- q. S8 D! l$ W
    add     ax, di4 {+ o* x; c+ S8 m
    test    ax,ax
$ `+ l- A2 H. P2 n6 x3 j1 f6 o    jnz     SoftICE_Detected
5 |+ M4 i* f* a& t6 s% N
6 a  D" H9 R$ y: }__________________________________________________________________________
" y2 P" L+ s& b8 G/ V7 D/ P, h
( y+ p! U$ P1 c: p6 c. F+ I! b/ r" b$ {9 h  G: y
Method 05
+ m, y& Q- c3 y9 g2 {=========
" W  F: R: C' G6 ]; u8 m$ u- Z$ I8 P6 E. _7 N( o- N0 q7 o
Method seeking the 'magic number' 0F386h returned (in ax) by all system
3 L6 g/ u/ l7 K$ t7 |1 Jdebugger. It calls the int 41h, function 4Fh.4 E# E3 m5 T5 k& O/ [" T
There are several alternatives.  
5 f- D2 v  R5 F$ o5 z' F6 U, M0 |0 c1 K# i) V1 C9 |6 X
The following one is the simplest:
; e3 y5 X* R! y2 S- ~  e  l" O0 m" _) \  N4 T( a1 J
    mov     ax,4fh
& C# b  L5 A# C: ^    int     41h
, ]( f. I3 _: Q0 h/ s0 T    cmp     ax, 0F386- L' T; O* x$ o1 \
    jz      SoftICE_detected
! N) B7 w/ Y& B  s& ?, F% `# f, R& a" D% `7 [. S! _

3 P6 E) D; l6 z# U% }; m+ z% _Next method as well as the following one are 2 examples from Stone's . T, W5 }* r' ^
"stn-wid.zip" (www.cracking.net):' Y: h! l# L* u6 B

* {6 ?$ Q" e, j' U3 F2 R6 i. R    mov     bx, cs
3 I, o* g. I9 L1 ~7 z0 f    lea     dx, int41handler2
9 P: j+ o$ Z8 U, k" W! d    xchg    dx, es:[41h*4]3 B* F) r9 c: ?0 u5 m+ Z
    xchg    bx, es:[41h*4+2]7 L2 C8 G8 ~; B% V
    mov     ax,4fh" @' {8 q# x2 n8 k
    int     41h, q, _1 R4 F8 d3 o: z- k
    xchg    dx, es:[41h*4]
, q& ^: o0 a" [) {) j5 j    xchg    bx, es:[41h*4+2]
, I( L" {* _4 V    cmp     ax, 0f386h8 ?; I6 V1 c5 D! f: g0 T/ K4 ?+ ?
    jz      SoftICE_detected
) K% [0 H% W  c5 T" k
* j  i# }  K) aint41handler2 PROC" p3 v+ I1 i) D2 {9 C+ [
    iret3 I9 a" F+ l  a( {; I5 E  m, d6 c
int41handler2 ENDP
' E/ @3 e* G5 z7 ]& j7 n& `7 `1 y. k6 F% t% N, l

! J4 m) x' C& i1 O_________________________________________________________________________1 ?1 e5 E( T# L* I; u
3 `/ L! f( r% n& ]
! G* K; a0 ~" k" `
Method 067 h  Z" {3 ?5 v+ V* A
=========  S; ?& w( `) X9 w

; A( F6 D4 t/ q( `# c
3 F9 F. A3 W& \2nd method similar to the preceding one but more difficult to detect:
% ^! G! u' v7 \
3 a# k; ]/ B5 T+ v3 M6 L5 w1 W0 P" T& @. Q$ u& g4 H
int41handler PROC: |3 y% n+ T4 ]$ T/ ~
    mov     cl,al" j/ V9 @; u9 t6 h6 m' c3 p
    iret8 Z5 D  H  T( ?/ V0 ?
int41handler ENDP8 [4 ?: U2 _! C7 s

2 V5 e: w$ p& S2 E2 s& a  @+ Z0 f6 x. h5 C, f
    xor     ax,ax
" i" D* y% z. ~8 Z* I$ \( |    mov     es,ax: o& {! Y) b! ]) t9 B
    mov     bx, cs
+ n9 _" P8 _5 D; s! M    lea     dx, int41handler" d4 G1 q& U7 B
    xchg    dx, es:[41h*4]
8 @) F: x" n- Q: g' N- |    xchg    bx, es:[41h*4+2]
4 E. M" a* P9 w. i2 O3 O    in      al, 40h4 E' W0 e; Y- h' X% \
    xor     cx,cx/ I, C- H5 _/ X( j. P5 b
    int     41h7 }! e, a6 J6 ]0 ~
    xchg    dx, es:[41h*4]
2 e+ q$ n# Q" Q. u, n" ?    xchg    bx, es:[41h*4+2]/ K4 G+ H! k" o
    cmp     cl,al
. i; f2 m$ R  E# T; A  L$ `5 f7 }, K    jnz     SoftICE_detected
1 |0 V7 q+ s& {! z# x: D8 j; I% j7 E" m0 G! N' ]
_________________________________________________________________________- [4 L' B* k4 {2 B2 v

* e! {) H0 C3 l9 B( U6 ]Method 07  y1 `  g( ~- c; C! b7 a* P
=========7 T2 l: k: Z- W& W8 Y5 F3 J. v
) \$ l2 S4 m- s( D( O0 |
Method of detection of the WinICE handler in the int68h (V86)
/ a% I) s7 ^& T" H
9 N" j  j9 l. i5 m+ R    mov     ah,43h7 J0 ~2 A7 k& N" M+ m
    int     68h
: `, s! t+ x3 M3 n    cmp     ax,0F386h
0 [" y! I8 {" h. R0 W5 j    jz      SoftICE_Detected
6 |( R. c) l( Y
0 k' @( [% a+ f6 S% n, q
1 e, @6 c9 \, z$ Z  V=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
  H( v; G* r1 N: t" q0 }   app like this:0 W0 ~% s9 ]  {% V
, Z  F' L- D. x, o& E1 U9 E
   BPX exec_int if ax==68
5 v) t  x$ |( [* a   (function called is located at byte ptr [ebp+1Dh] and client eip is8 P+ W: B. P1 [$ a1 {' e
   located at [ebp+48h] for 32Bit apps)
' G( v6 Y3 U- M- x+ b; n1 U__________________________________________________________________________2 r0 O4 R) h- }- |

8 r: E' `* F5 W+ L) A- r5 f, Z0 [4 ]$ \3 K3 l* [( C( {2 N
Method 08
( J* P3 j  |' b/ h! U) u6 h* X=========
4 W. t2 l( p+ z" f, i- A4 Z, O/ [+ O
It is not a method of detection of SoftICE but a possibility to crash the
3 F7 K# a& T* [0 S; C. N) asystem by intercepting int 01h and int 03h and redirecting them to another1 l' e2 `( F/ S4 T7 J) x# n* j
routine.
8 M- k" f9 P. p4 M$ A% ^It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
  O. s+ t; i, D/ r! `to the new routine to execute (hangs computer...)/ f# f) |0 C) f- {8 _; T( ~

" n( }( z: H* _) T( b" @0 b    mov     ah, 25h! d% k6 F/ N5 N: p* e
    mov     al, Int_Number (01h or 03h)
+ C; i* J# m2 @5 Q    mov     dx, offset New_Int_Routine
! x) y5 l  E6 q* C3 L    int     21h
- Q- \6 \" R) x9 l; _6 O9 ~. O8 h# ~0 t
+ p' M1 K! j+ {0 H; ]5 V: Y& h__________________________________________________________________________! ?/ H$ o9 l' h) I

5 e8 F! n* X1 T$ PMethod 09# B2 J1 l0 I; Z- w) m
=========
/ E3 V; I- Z+ t# R; j0 f) t' Q/ v, X0 G, o1 ]
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
% w4 d" z5 W0 t3 Nperformed in ring0 (VxD or a ring3 app using the VxdCall).
' u2 }) `6 ~8 L* h. K4 sThe Get_DDB service is used to determine whether or not a VxD is installed
5 u7 n" @$ S9 z+ y$ c2 k9 Gfor the specified device and returns a Device Description Block (in ecx) for
* l* n$ s  H5 T2 ithat device if it is installed.* i  M, W& o* N2 q! Z( x6 P
5 {) Z1 z1 m# d$ [, I* J) W4 H* _
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID* g4 q8 y5 X; i, O) Y, i" P
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
* v* O5 {1 x+ \- J3 n% O& e' I   VMMCall Get_DDB
- r; w# R7 Q$ N$ w3 m   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
6 G+ j1 |$ m! d8 W: a" t# w* M/ O' P: Z" J$ r
Note as well that you can easily detect this method with SoftICE:
* B; z2 d" s5 C2 I* d5 h2 q   bpx Get_DDB if ax==0202 || ax==7a5fh  H/ {) D0 n/ Z6 v/ c# M. ^

7 n% `! i( L+ G5 a% }$ s7 |__________________________________________________________________________
& v+ Q& X: f; Q& W
- T" t! y5 @# I. _Method 10$ x+ z4 U, a8 Q; f# {" m2 f3 {
=========
# a, v8 ^. q& j( h
7 t4 N7 B9 _8 e; C. D4 {=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with5 Z! t3 q; a+ o+ ^2 m  t0 i
  SoftICE while the option is enable!!& m* u& l+ i& N& F- [! S* l
6 S6 F6 N2 k% N% }6 }
This trick is very efficient:
& H- q' |. E; wby checking the Debug Registers, you can detect if SoftICE is loaded
  \2 t  r4 L. z: d3 `(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if. E5 m2 ]3 L7 E9 ~
there are some memory breakpoints set (dr0 to dr3) simply by reading their6 ]9 Z1 D% s: G! ~+ S  X
value (in ring0 only). Values can be manipulated and or changed as well" T2 V" A8 b5 u, V0 G  d- t( X- B) h
(clearing BPMs for instance). L& n- c5 G$ h5 i% H& Q
. i% w. u/ m, {& b  D0 v9 Q
__________________________________________________________________________. a; X9 K  M  v5 x
0 h; _* l' e2 F5 q' C
Method 11
' V2 e3 E2 q: @9 D; [, H+ L: d; R& \=========4 V) x2 n0 N1 Z% K

9 e0 d+ @. V  Z: KThis method is most known as 'MeltICE' because it has been freely distributed
  S9 i; ?8 I/ o6 A, ]via www.winfiles.com. However it was first used by NuMega people to allow
9 ^) i0 d2 [$ {1 pSymbol Loader to check if SoftICE was active or not (the code is located/ k1 N1 a7 f" Y
inside nmtrans.dll).( A5 U  ~& B$ G2 z( a1 |# d
6 u9 m4 f* {; I" E2 m( x3 R
The way it works is very simple:" |1 I( j2 k4 j) x
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for5 z9 I. O1 b+ T
WinNT) with the CreateFileA API." ^# G" F7 n) g$ M+ W3 R  k2 W: Y% P
5 P5 ~( P& Q  @# [6 V  b  w
Here is a sample (checking for 'SICE'):
8 p3 M$ b6 N& K6 r) ^5 g9 D; P2 T' h' k0 C% i( T
BOOL IsSoftIce95Loaded()
: l( n0 W7 l4 u" o9 G; A+ k$ g{
% r5 L* o9 e! i$ }3 X' F   HANDLE hFile;  
+ E4 h7 z4 @7 @# k5 t- S6 Z; E6 @   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
5 c, C' z$ P: t4 }                      FILE_SHARE_READ | FILE_SHARE_WRITE," R# W: l1 c3 T7 {  {$ g
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
5 n, k! T" Y* n4 d   if( hFile != INVALID_HANDLE_VALUE )0 x+ D5 `" _7 G6 Y/ ~
   {1 Q7 e* `# q4 \
      CloseHandle(hFile);% k( [/ ~' v( k4 f0 i
      return TRUE;
, f3 l  n$ W5 c6 E4 G5 ^' D   }4 z) ~9 t% x1 l2 J
   return FALSE;! Q& J) h4 z3 S; Q0 k
}6 j. e: }) ^" R, N  Y% d
2 H; |- S4 s" l
Although this trick calls the CreateFileA function, don't even expect to be
8 D. r, N+ Q4 }, oable to intercept it by installing a IFS hook: it will not work, no way!
; u+ P* g+ p3 q# h3 q3 |+ ?In fact, after the call to CreateFileA it will get through VWIN32 0x001F; l. Z9 Z' Y$ |5 {+ F* P. b+ `
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)) Z; w# O* n3 p0 [: e5 G
and then browse the DDB list until it find the VxD and its DDB_Control_Proc
8 C& r2 j: a* Z" Z$ y8 A# U) Jfield.
/ y6 h7 ^7 `. }) U$ v8 N; M* [  XIn fact, its purpose is not to load/unload VxDs but only to send a ; k- a3 e" o: V1 m; f$ j! C: C: }
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
' t1 {9 m. h1 k8 Z/ Eto the VxD Control_Dispatch proc (how the hell a shareware soft could try
; D; K9 D4 A4 c$ [to load/unload a non-dynamically loadable driver such as SoftICE ;-).
. b1 b3 G. _2 {6 Y/ x# u+ w2 DIf the VxD is loaded, it will always clear eax and the Carry flag to allow: i' P) n' l; ^
its handle to be opened and then, will be detected.+ I" @" }5 Y1 S3 Z* l
You can check that simply by hooking Winice.exe control proc entry point
* `4 p2 h5 A  O7 n4 m+ Q+ H! P1 Fwhile running MeltICE.
% C* b8 j+ C& g
; H- x$ X" e! D/ v: B* E' l- s) R2 ?# e: w2 X  v
  00401067:  push      00402025    ; \\.\SICE, \$ h* u: ~2 _0 a6 I2 b+ d6 ]% R8 G
  0040106C:  call      CreateFileA
# k4 R  p4 o9 _* a  V- E  00401071:  cmp       eax,-001
) x( d5 O) O7 f0 a  00401074:  je        00401091
' g4 K, z7 ~$ [6 y) W) \
: k' b9 ]! g0 [& O0 Z: b6 h/ p6 b7 p3 W7 m* Z1 ?$ `4 ^) |# l
There could be hundreds of BPX you could use to detect this trick.
+ g8 }5 t0 C" W" ~( g! ?) N; U4 r-The most classical one is:
) d$ F" O/ s% p  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
9 M2 b" z5 K( _0 Z    *(esp-&gt;4+4)=='NTIC'  \  p' r5 x7 j
! t2 y3 I* c; a' \
-The most exotic ones (could be very slooooow :-(
6 J; J- g  n. k* R3 h3 d2 A3 D   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
, h9 h4 H; L$ c0 f     ;will break 3 times :-(9 r( X& I" ^1 v3 U' q. d/ |$ v, ^
  E0 ]' M: o: d( O7 i; S8 M1 b( q
-or (a bit) faster:   v+ h! V: l/ V4 g; V! b
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
' M& B" ?' v7 \9 f1 h( W3 u4 f1 T/ s' a  I
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
2 b' ~9 j$ f+ h& g7 @4 W     ;will break 3 times :-(
6 r+ t5 N* a$ {/ f( v; f5 R
! ]8 M/ @5 p$ b-Much faster:
0 B% ^* S! k* ^; W' _! J4 y+ c0 [   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV', E2 n7 w  l- k+ f- U; A& N1 Z5 @" Y

3 G# u, x# d' a& A* K7 z) n% aNote also that some programs (like AZPR3.00) use de old 16-bit _lopen
! ~' Z$ ]$ X* x6 f' @function to do the same job:+ w3 _: ?& ^8 G" }& T5 y8 D
& p+ Q4 W, ]* n
   push    00                        ; OF_READ
6 ?( x# R( S2 h* P- N7 z   mov     eax,[00656634]            ; '\\.\SICE',0
) w6 |8 `) g4 ]" L. Z4 S5 t8 g0 F# X   push    eax
$ V8 q- C$ ^, n; u- P   call    KERNEL32!_lopen
& W, e9 c5 _' n+ X2 q. c   inc     eax# `( z  C4 I/ |3 w
   jnz     00650589                  ; detected
  ?. G/ [' w: M* U: ^3 W   push    00                        ; OF_READ( G8 t  \) M% p
   mov     eax,[00656638]            ; '\\.\SICE'
. t! n$ i1 |) y1 F# ~  `. C  M5 D0 D   push    eax: W/ S; |! M6 v! \
   call    KERNEL32!_lopen
* W9 K3 h3 d9 d- B   inc     eax, h4 X$ @4 y% N
   jz      006505ae                  ; not detected+ U, h; u5 c) l# z3 K( P

  |, O5 _$ C$ p# s& h
/ a; `/ N( [6 {# Z, S2 B__________________________________________________________________________) Z: [* p$ T1 ~/ G+ i

$ D4 ^% |9 @+ V" p$ U7 {& yMethod 12
. I! Q6 W# W: {$ N=========1 y, B2 h3 Y" B2 H- l9 ~

: W0 w3 ?7 k5 q/ v3 tThis trick is similar to int41h/4fh Debugger installation check (code 05
% j# }& r4 S3 N. p% h8 V+ B&amp; 06) but very limited because it's only available for Win95/98 (not NT). \5 b5 X5 q" p- Y7 ?0 J) U
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.! `6 e, S$ j. F5 P; ~5 E. _
- _! u; o2 U; W- p4 a( K
   push  0000004fh         ; function 4fh
: a+ o4 e8 ^! ]% G7 g& {   push  002a002ah         ; high word specifies which VxD (VWIN32): W0 R% @$ H9 {4 A+ K/ |6 A
                           ; low word specifies which service
  ?# m3 |  z/ y. c- a! P, z# G                             (VWIN32_Int41Dispatch)
' S) S! Y) t2 z. I- K$ d5 `   call  Kernel32!ORD_001  ; VxdCall
7 F5 ^/ A. c" `7 L* @   cmp   ax, 0f386h        ; magic number returned by system debuggers& |  ^) w7 x' n$ U" o/ o) M
   jz    SoftICE_detected0 e9 R0 L& z2 R/ a

- s+ v9 M- z- d6 ]6 C9 y4 kHere again, several ways to detect it:( N6 C' \9 Q* \' z" H9 n  y! a! i

' E8 m3 j  Q0 ^  |2 P    BPINT 41 if ax==4f
6 z0 V1 t( L* m8 l* d" H' D5 c  N" P/ T0 V+ J  H
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one! Y( {% \1 H3 ]4 u
. j5 s) u2 X. W2 R+ b
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A5 ?# [; r1 g  N9 E0 I' b
! c0 G" }! x' h, ^. T
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
4 `6 S" f, K3 N6 M0 t2 X) S9 [. k& ]% E$ x0 H1 z9 a# Z
__________________________________________________________________________
9 v1 r" k% J* K, @; C' j2 ?) L& ~. |9 g9 h1 z+ {" x
Method 13
7 k% {$ C3 i) Y, u* a5 x1 E=========
1 h% x& p$ j& m4 L
/ B& p! _8 l$ |  S% R1 e3 }; U; rNot a real method of detection, but a good way to know if SoftICE is
7 U  n% L2 j1 x% }; uinstalled on a computer and to locate its installation directory.& z$ P2 K% S: O0 m3 y; _
It is used by few softs which access the following registry keys (usually #2) :5 n' v9 l2 K; C; c# ?' S0 x4 V
: _, A& X9 T  y; Y
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
  `) N$ j6 _2 z  ~+ B- B! Q\Uninstall\SoftICE
  Z) h7 M7 w8 k" p-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE5 O  v  x5 q0 _' V4 }
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
) q& L6 B) ~" O" t\App Paths\Loader32.Exe5 l% Q6 Y. i+ p. C7 l

3 A, x0 m" G% v. D! R( _. `! h9 }; q% N0 _. m+ n9 M) {7 @4 }
Note that some nasty apps could then erase all files from SoftICE directory
* ]4 r3 f  e1 O(I faced that once :-(
& n( ?$ k# @4 s
5 x$ u* u) R, NUseful breakpoint to detect it:0 t8 w6 h0 }( G* [4 X
4 p% Z5 [% `% @+ P& H2 E
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'5 N+ Z2 L+ q0 A1 y$ l& E
* S) q& Q4 @" o  j* k
__________________________________________________________________________) y4 d, @% K. A& n$ l

. C3 X. o; D4 W9 E7 g/ E+ s2 q$ `0 L! o+ V
Method 14 / @+ R+ \7 N- _8 n" t$ ~
=========
# X3 r& O9 n. M2 v/ X$ @( N& y0 x* x
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
/ w+ ~( d* {7 h, h& U) }4 jis to determines whether a debugger is running on your system (ring0 only).
4 Y, U) L1 u/ I6 I1 N
+ b% c- p1 M! U   VMMCall Test_Debug_Installed
) j8 H6 Z+ I/ ?; o% G- [/ \   je      not_installed. U; }; S5 _) J; W; c4 i. n* Y
9 A( [* t" T( G" e8 R
This service just checks a flag.
0 @4 U$ O: M) I& B</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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