About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>8 V9 s8 o: ^- V* }
<TBODY>! t' V* K# [3 w  N6 P
<TR>7 ^4 J& k& X: q  W( u+ }) ?0 P9 J) P
<TD><PRE>Method 01
5 L- V  ?( b% c=========
: T# u3 L8 Z6 [5 x9 [
8 K+ n/ u  i4 ~# H! z- l7 KThis method of detection of SoftICE (as well as the following one) is$ H7 @( O7 X7 @/ @9 G: \& L, e
used by the majority of packers/encryptors found on Internet.
0 G: b* R! V9 C# Q, C$ ?; \7 T4 d' HIt seeks the signature of BoundsChecker in SoftICE
; h2 [5 |' l: O+ `9 y  C' ?  J- ?1 ]6 W) c& N/ Q5 y
    mov     ebp, 04243484Bh        ; 'BCHK'; F. B% e+ k: f% _1 n+ l4 A+ F
    mov     ax, 04h  Z$ _" X2 |3 s
    int     3       2 X  e' ?; S: R7 S$ S3 A
    cmp     al,47 h( v4 i; j/ x
    jnz     SoftICE_Detected# O# g$ \2 `9 d' U$ ?/ Q
6 F8 x; X+ K( H5 r9 W1 k
___________________________________________________________________________/ f1 Q# i! _. V4 D; j

' y' B- Z( Q7 L) ^Method 02
, f8 h* H  k, s& ~=========4 P4 X* L; o; R# U! @2 K
4 R( p! W$ j3 z( D& N
Still a method very much used (perhaps the most frequent one).  It is used7 I7 ?# \, e& {6 U# g2 c, N
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,* g' G+ U5 ]3 |* R& p7 y/ S
or execute SoftICE commands...5 s, [% s. J4 @3 M
It is also used to crash SoftICE and to force it to execute any commands
' {" q# g% e3 q7 v(HBOOT...) :-((  3 B3 y3 O2 y7 V. r, h( v

8 i6 W8 e/ s5 T5 q+ J, GHere is a quick description:
$ |  D5 b9 F! Y  g; G! J-AX = 0910h   (Display string in SIce windows)9 F" U6 a. f/ \" r: o& n$ A
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
0 s) i0 l" e/ T, {* W2 p$ E6 i5 Q-AX = 0912h   (Get breakpoint infos)
4 J) g$ v* P/ E* L! g8 H-AX = 0913h   (Set Sice breakpoints)- t" m; V' H2 z( ~
-AX = 0914h   (Remove SIce breakoints)
! @; G6 N, t) ~' M+ I2 u7 i
5 p+ G9 [1 T4 s2 L3 ~Each time you'll meet this trick, you'll see:
/ b! l, e4 y" z6 @. ^9 q$ K! w-SI = 4647h
. N; W: J( K8 ?, e-DI = 4A4Dh
( C8 a( [3 `0 JWhich are the 'magic values' used by SoftIce.
/ \+ B5 b- C8 e* k. r, xFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.
; c" @3 _9 Z0 \/ q( H+ Y; J( t
- n7 ^+ \' l. ~% }& H5 nHere is one example from the file "Haspinst.exe" which is the dongle HASP8 @4 A* n% Q3 \8 @$ M7 z
Envelope utility use to protect DOS applications:: Y4 P% _# H  ]$ W8 M
$ o# B7 `8 L: \8 U0 b
- k. C& _. Z# Y" C0 e5 s4 {* {
4C19:0095   MOV    AX,0911  ; execute command.
6 g4 E; X4 U5 {  m4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).5 B" j, V( J) W+ l" v
4C19:009A   MOV    SI,4647  ; 1st magic value.: D6 Y6 P+ G4 c- Q" }+ I  O
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
# i! T- c3 z5 N# l- S4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)0 H5 t9 h7 H9 `3 L" A
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
+ O8 @0 G- @5 c6 \, B" `( |1 s* t4C19:00A4   INC    CX) w7 y: ~) W4 D3 J, B
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute6 J$ k( G( `: R7 u3 `" k0 p
4C19:00A8   JB     0095     ; 6 different commands.
% f4 y* W' y# J" F  J4C19:00AA   JMP    0002     ; Bad_Guy jmp back.4 `% v% I& G' O5 A; d2 t0 S
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)- ?1 c1 g8 m2 W/ B& I+ `, L
% G* C, @# q7 I: y, @7 k( H2 Y
The program will execute 6 different SIce commands located at ds:dx, which* ^2 O& a( k$ c8 L0 O" D7 T
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
' S8 o8 F1 L7 S
; ?: O, c) j* e2 J* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
9 t3 e& G* W; J___________________________________________________________________________
, j  K- E- G$ Q8 M( U2 \9 p) ?9 f9 l* U* |* Z4 f# S& R1 a
( {2 ?# O" y9 f" m: k0 }4 G* m2 U
Method 03
  r/ `7 h' H1 I; {' Z=========# W0 _9 j7 o) `* u3 {
% n3 _  y4 d4 e0 ?9 R3 K+ w
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h% V+ R1 {+ K% y1 E% n
(API Get entry point)
1 X$ q' _7 I) U/ G; j          N# ?! X3 f. b
7 ~! V' \& t7 {
    xor     di,di3 k2 I8 u) U8 L' R
    mov     es,di: T# s3 L; r+ v4 y& F3 f: N
    mov     ax, 1684h      
! k1 Y, P; C5 C$ o    mov     bx, 0202h       ; VxD ID of winice. N1 x3 b1 e# F+ W% F9 F0 [
    int     2Fh
1 N' o  N# B/ O/ V+ B    mov     ax, es          ; ES:DI -&gt; VxD API entry point/ S' q4 b7 ~, J; h& o
    add     ax, di/ g9 t0 `5 U6 W; Q
    test    ax,ax
4 G& P; ^9 n- l' o! b  X4 J9 ?    jnz     SoftICE_Detected: A1 }3 ^1 ?2 u" ]

" ?2 ?2 |' k/ b! i___________________________________________________________________________+ k, a# a  i! P/ p, O# H
- O# C( B* b9 `4 G. H3 M
Method 04
1 X% n2 j/ r% Y0 w9 s+ K2 W- Q  M8 A( B=========
5 i2 y# n$ q. I  w6 n3 v# y# Z0 Z2 d3 g7 X6 [9 y
Method identical to the preceding one except that it seeks the ID of SoftICE# E* f% k) K5 h; B, `
GFX VxD.
+ O9 V$ X  d5 }3 X5 n" @( H9 L" r' l
    xor     di,di
' _5 ?9 z5 r! v+ l    mov     es,di( }5 B3 |) _; N4 ]7 i3 v. K+ N
    mov     ax, 1684h      
2 a% d% D! [( c6 l$ y! b2 u1 b    mov     bx, 7a5Fh       ; VxD ID of SIWVID
3 n! n% i5 Z' r3 n- t: Y    int     2fh( U3 _9 @$ v# O- ^" s$ y
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
  `* q5 u% ]) S& ?    add     ax, di3 O/ m9 \8 D) a2 |: c
    test    ax,ax) e9 D1 s* W. i
    jnz     SoftICE_Detected. ]* D% [9 U+ j4 a
# f$ [  e0 o' k, v% b' y
__________________________________________________________________________# O1 ], A5 ]+ F# c
4 M$ ~( {" G$ }4 w" Y

' K* B+ m. t3 H, N2 @: x! A5 `1 @5 LMethod 054 _1 m3 m$ ?/ K' w, ~( \
=========
. T$ U  J' q1 O4 d- \  M
9 I  C, n  g: O5 MMethod seeking the 'magic number' 0F386h returned (in ax) by all system
# p+ r% [' p" }0 E9 idebugger. It calls the int 41h, function 4Fh.
/ g4 a- S/ W$ T: U! b. w6 ~. [  ZThere are several alternatives.  , q6 V7 U! l- L9 \4 G1 T% M. A
* k2 ^9 O) ]' l7 U4 W
The following one is the simplest:
( ?, z4 B$ v" p- T9 z4 y/ h# P& a  P& {- w
    mov     ax,4fh
; P# v* {- y' j. r    int     41h, D7 @& {9 A" V1 \- i7 [
    cmp     ax, 0F386: D5 n( l! N5 l9 f1 y+ ^4 C' X
    jz      SoftICE_detected
. b4 U. ]: [. \. r( K8 V
# u; d8 J* e; I& }6 E" J. H6 P  T) H5 A% I5 S
Next method as well as the following one are 2 examples from Stone's + h' _' b* A: u* T
"stn-wid.zip" (www.cracking.net):1 w) u/ s/ |, i& }

  o. s$ k) y3 Z; ~7 J" R    mov     bx, cs
0 v6 x4 r$ z7 e    lea     dx, int41handler21 ?3 v) X: G8 W( `# o/ e
    xchg    dx, es:[41h*4]
3 W  o: R% {1 b/ [/ X+ n) c    xchg    bx, es:[41h*4+2]
" B3 P; e5 y; x, f4 C1 o    mov     ax,4fh
) `. b: U9 G1 G% e    int     41h; J% G  ~5 {+ k1 S8 d+ x5 _
    xchg    dx, es:[41h*4]
) J9 ?: p: K7 K" E% _, V    xchg    bx, es:[41h*4+2]1 |3 ?' F4 [* O0 o7 n
    cmp     ax, 0f386h9 H" S- s6 w0 O$ J$ Z) G! o
    jz      SoftICE_detected4 X. T5 z7 L+ c. C
1 }; G9 C  M* [% ?* q
int41handler2 PROC
, A% B1 [4 m2 T' v5 x4 S- Z6 X6 c. i    iret
7 K( P/ S4 L- Mint41handler2 ENDP
! _. T% C+ ~6 K  u$ @( y- m# ^% ]
2 [& w: Q2 n) z8 m7 H& W
  n$ d6 y9 @( v3 {6 h+ P  C_________________________________________________________________________
5 D6 V4 w5 B1 M# T, t/ k/ D, H% h
$ ?, m9 C) O6 Z8 k7 P' M$ `
7 `/ G% t9 q) V( A! TMethod 06& x4 Q8 A6 ]' H% d& j; ^% L# `" o) W& g
=========
  B- X/ A7 {7 t8 q$ X: x# ^! X0 I! I  M; @
. O  c2 p/ A* I( i
2nd method similar to the preceding one but more difficult to detect:+ a4 H& C3 V' V  T' u& h
7 t7 ]! {6 O/ h! }9 i, Q$ j" N' t

3 O/ [5 F# m3 d: K0 mint41handler PROC' `# v4 h; B. U$ v+ y, c, ^
    mov     cl,al9 @4 B2 E, g" R5 g
    iret
; t# _: q- r4 l# {* @int41handler ENDP
1 A8 `2 O/ J$ n  e- o6 Y# P' X$ z9 N  m6 I! h. D. ^7 a4 P

' @5 P) w( `* }! _4 f2 r    xor     ax,ax. p/ |* v; d1 N0 {+ k0 k
    mov     es,ax2 Z* x% i. G! d
    mov     bx, cs
7 G& c' s( h/ a# M6 q    lea     dx, int41handler
2 L. D9 h; T. K( E5 Z    xchg    dx, es:[41h*4]
" s. R, k4 O9 T9 g! q    xchg    bx, es:[41h*4+2]
- K4 U2 E$ L9 s  s    in      al, 40h
$ D# |8 U0 I/ H; p6 p    xor     cx,cx
9 j/ K2 Q+ m5 H6 @! q    int     41h
! j0 k+ I+ |: V    xchg    dx, es:[41h*4]
% z% b2 k6 D  d& Y    xchg    bx, es:[41h*4+2]
3 Q6 b) [+ U5 y    cmp     cl,al
2 Z; }0 P- e6 V! D) N* e7 B    jnz     SoftICE_detected' ]: p0 q$ r! g  `7 R+ y9 a
! B, e, Z+ U; [+ C# y! |" y
_________________________________________________________________________
" P4 @% [0 t# a+ d* r* a" Z5 d4 ^6 t, V8 ~% _; ^+ y  y
Method 073 ~  a( e1 ~: O( n6 Q
=========( n& {, h! u1 b/ N+ J0 v
7 L; |! z- u, a/ G. A
Method of detection of the WinICE handler in the int68h (V86)" ]0 W5 o. P9 t% m
# T9 b3 r" @6 `. `
    mov     ah,43h* c% H7 _3 [5 f4 h3 ]/ Q
    int     68h
8 A# K% B5 F( ~& a. k' m    cmp     ax,0F386h
2 Y1 S1 F9 a. `2 r    jz      SoftICE_Detected, {1 W1 n7 C- @& q0 _+ {

5 y. ?* @  I3 p# C: J4 m" o
& y/ `( f" k1 M" Z% T=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
3 ~" B9 a# K6 ?5 J. f) B   app like this:
1 k0 @+ k7 O- _! |* X+ l9 k: V5 y* T( t% W9 }
   BPX exec_int if ax==68+ E8 G  v' |" b6 a. Y: Z0 g* n
   (function called is located at byte ptr [ebp+1Dh] and client eip is$ `5 B, g- ^& H) y5 T! p6 O( N
   located at [ebp+48h] for 32Bit apps)1 w1 v, V3 f* \5 v( X; Q+ T& G
__________________________________________________________________________
6 k9 O+ q1 ]8 W; S# }1 C1 M% k
# c$ a6 @: H& Z- k8 R* u+ W
; s1 N, C: w: T( A& `* ZMethod 08
" j8 z& t& P3 M! Y/ w2 X* D=========
, |. \" S! z9 h8 x
0 a5 s) s* m+ O- J) q! RIt is not a method of detection of SoftICE but a possibility to crash the7 w6 I( M7 B( K* X, i4 O
system by intercepting int 01h and int 03h and redirecting them to another
: h) }, z+ i- \routine.
6 H  G: K* n. S7 zIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points# Z4 J. b" M$ W! |  a
to the new routine to execute (hangs computer...)$ x$ F/ a! e) I3 v& k( K

9 K; d9 @0 P. O) _    mov     ah, 25h+ D1 y) F. t9 a
    mov     al, Int_Number (01h or 03h)
% f1 {) b  O+ \/ Q7 Q, o    mov     dx, offset New_Int_Routine+ X. F1 V/ S# p) }; U. I: s1 O9 g! n
    int     21h
4 d, _: N! W- N" q$ ^4 d6 {; c# v3 h
__________________________________________________________________________5 y' s1 v! G+ t  r7 S; T

  t4 u1 M: t9 z" o( [: `Method 09  }( M* T$ X+ S" X. G9 a1 p: f
=========0 p! K+ o% ?6 ^$ D0 u* T
0 d) z9 @/ ~: H2 [) `* [: l  R
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
9 ?5 d* _  ]) z. a1 j" Aperformed in ring0 (VxD or a ring3 app using the VxdCall).
! |3 ^3 Z& J& ~4 O+ J, g; gThe Get_DDB service is used to determine whether or not a VxD is installed
7 F3 `, Z2 s- c4 i4 wfor the specified device and returns a Device Description Block (in ecx) for
. B- X! z/ g5 J7 z, [% k0 p. S1 W4 Bthat device if it is installed.
& R8 [' Z1 A( u4 e- l+ T3 P' h% J" q) k, l1 A' d; q
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
2 W  n- q* ~3 b" A   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)6 h8 ~: V' Q# i# ?/ \
   VMMCall Get_DDB. P3 Z% Z+ r4 k( P
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed) r' Z" l" u4 K) Z% ]. N( i
$ [% i3 N, Q$ ~8 B( ^
Note as well that you can easily detect this method with SoftICE:
5 e) |6 J- v8 S+ T3 S/ l& C% q   bpx Get_DDB if ax==0202 || ax==7a5fh9 ]" U( X1 o6 G4 q0 T" c
* W9 c  k+ I( h+ w8 [
__________________________________________________________________________3 [" d2 }' l8 c5 I. D8 v

: }5 U4 @1 B6 F: OMethod 10
8 P  k' J0 n  v& f/ a# c7 K+ A=========8 \# S( B$ Y6 m! \- w1 J3 |/ _

3 q' V8 f1 z* n3 ?=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
% p( v! [0 R& R& k- F  SoftICE while the option is enable!!
5 L2 `1 Z8 d' a  R- w
% g2 t) D- t2 d; Y1 N: FThis trick is very efficient:
8 Z+ q# }$ M, |: ?0 [% Eby checking the Debug Registers, you can detect if SoftICE is loaded
, M" W4 R: i4 U& n$ v+ c(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
# Z0 l1 ?, T( d4 l, v4 l$ Qthere are some memory breakpoints set (dr0 to dr3) simply by reading their' ~8 Y$ c* K- u
value (in ring0 only). Values can be manipulated and or changed as well
1 o; i" H  C0 V( j(clearing BPMs for instance)
* b+ s  ~8 k; M1 E( j
4 r% y: v" G% E- O8 Y. }2 ?( h__________________________________________________________________________
, ~, O  a4 @$ Y. P
, {) L0 i1 N9 r- _7 x. zMethod 11
* ~' l- i* K* l1 O/ \5 q$ Q' C9 }=========+ S5 a: b7 s# _5 u  l9 s
: b3 f9 w- x' R# S, M" T! w
This method is most known as 'MeltICE' because it has been freely distributed- e  ^) H$ w( P( a
via www.winfiles.com. However it was first used by NuMega people to allow. N. g' [6 {; c9 H4 b/ K1 m
Symbol Loader to check if SoftICE was active or not (the code is located8 [( ]. @! [9 L& b- w( G. ?9 O5 r
inside nmtrans.dll).
( @+ J8 |* W6 R) ?: z, U7 ~' y" u# |0 G" k% x6 ], U
The way it works is very simple:
4 q. ?6 k+ ~8 E4 I& f. h# ~It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
& C# z2 u; l1 QWinNT) with the CreateFileA API.
, t1 _  Q4 F9 w) B' O. v; c/ ?+ j) f
Here is a sample (checking for 'SICE'):
' x  S" D1 r/ n# n6 }) \& q% b
( E  f% B: k6 p4 v: _* t8 HBOOL IsSoftIce95Loaded()
( I/ y! b: j5 {7 s" R. [; j{( }* w. a4 {( g' S2 {2 P
   HANDLE hFile;  
2 l* r4 S4 C5 M" L1 V   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,( J$ T7 ^" K; e- L* R; t
                      FILE_SHARE_READ | FILE_SHARE_WRITE,
# F8 c1 I2 M* y5 R) `9 B5 X8 ^                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
# D' Y  c( _4 ^) N, ^   if( hFile != INVALID_HANDLE_VALUE )
6 h3 ]6 x+ E( d  m* O   {
4 c: l, e4 P" k6 q" L( ~  B: L& O( ~      CloseHandle(hFile);
- ]2 U2 j( t8 |$ Q  {4 \9 A      return TRUE;
: i5 }+ M( Y1 L5 M! Z+ s   }
# E! G! T( x9 O2 Y/ o, R' a7 J   return FALSE;& V7 I9 I* @& N
}
) I- [* j8 U7 t
7 u. p8 R! r+ F- V8 i: E' f+ CAlthough this trick calls the CreateFileA function, don't even expect to be7 e5 H, ]) C0 r4 [7 C. B$ B
able to intercept it by installing a IFS hook: it will not work, no way!
) a7 U' x% M! d6 }6 kIn fact, after the call to CreateFileA it will get through VWIN32 0x001F: M1 ], l7 Z9 h* j( ^
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)( G+ I9 j4 f% p2 y$ b  y( j6 O6 h
and then browse the DDB list until it find the VxD and its DDB_Control_Proc
$ ]( l! E% G$ j. @+ Xfield.: ?! O+ @" f9 _' u9 v
In fact, its purpose is not to load/unload VxDs but only to send a
) B) y9 r& ^6 K$ Z. D  o+ U" `W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)$ U4 e; F& s# x2 \8 h  g
to the VxD Control_Dispatch proc (how the hell a shareware soft could try, F  B8 H% w' y1 g
to load/unload a non-dynamically loadable driver such as SoftICE ;-).
$ ?, A6 f1 v1 HIf the VxD is loaded, it will always clear eax and the Carry flag to allow# s3 [4 H- W* ^0 Z+ Q% ]5 G
its handle to be opened and then, will be detected./ c2 B+ ~: i  s% ~# D
You can check that simply by hooking Winice.exe control proc entry point
: {" y3 C- K) A4 c) O. ~3 Hwhile running MeltICE.( o1 i: B; P9 b5 g1 q" R' {
' y- a5 E9 n2 k5 c9 j4 C; k
/ ^0 g9 O% I8 C" F/ w7 |; F
  00401067:  push      00402025    ; \\.\SICE
1 @; o: m0 Q* N- X9 ], n( v% p& H  0040106C:  call      CreateFileA  w1 Z2 }1 H6 Y. m. M1 l
  00401071:  cmp       eax,-001
# Z* |+ B7 a' ^: \% s2 A$ O9 @: d& [  00401074:  je        00401091
8 J9 }% U; I; G5 e$ M# K& R5 O& B
+ D8 o5 r' @( {) v, I
: Y$ \8 z  g( a' T; B& Y5 ]& y5 oThere could be hundreds of BPX you could use to detect this trick.
1 U5 }6 G+ f* ~9 O-The most classical one is:
3 o5 `: _# T" \7 ]; P  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
# E! B# w: A. H' U% m/ ^    *(esp-&gt;4+4)=='NTIC'7 r5 p$ p2 X$ x( B) c

2 l) r7 ?3 S  W( g1 g+ e-The most exotic ones (could be very slooooow :-(9 q& E, Z% `2 p6 [( Y
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  0 X. y1 ~: `$ ]$ R% S+ B$ i6 {
     ;will break 3 times :-(# a. H/ t4 Y5 t5 O

& g1 l* K7 H0 H4 a. r: a-or (a bit) faster:
" y: G; C9 y) ?( h8 g   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
3 V' E" Z  B5 ~& H
; q# q# I) h9 E) {- _9 r9 q   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
1 ?5 p$ F8 S* d     ;will break 3 times :-(
  n+ x6 @9 n0 B# w% S& ~
4 G; N$ c) {1 U+ {7 s. t# j* y-Much faster:
% \; h. _7 `$ \8 Z   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
4 I/ M: A' X+ B5 }, v5 e+ z) S. F, j7 I/ M+ k, K
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen. ]5 D7 J! ?6 _
function to do the same job:
6 @) t* j6 q4 W9 [2 J" R- S1 c/ ^, T) d3 Y8 j* N
   push    00                        ; OF_READ
9 c: L" Z6 a- x9 n   mov     eax,[00656634]            ; '\\.\SICE',0
& O1 q& E; [7 T3 v, F# K6 f0 A   push    eax7 j7 C3 y$ j/ ?" [4 f0 D8 C- m
   call    KERNEL32!_lopen
/ ~+ Z6 r( X) W4 ~; h   inc     eax5 [/ k6 \8 l- C/ Z4 j
   jnz     00650589                  ; detected
8 c& k0 @( a; Q% X   push    00                        ; OF_READ" \( i, j6 s" `
   mov     eax,[00656638]            ; '\\.\SICE'
/ F# ^! q0 j+ d7 K1 i   push    eax5 S' S; F5 k. U6 S+ e3 X8 g
   call    KERNEL32!_lopen
0 B! q7 \% d( X   inc     eax3 e/ s! j/ h4 r  E7 y* Q6 e' M
   jz      006505ae                  ; not detected- F3 x8 o+ O& ]1 \! a
- a' K; g* q4 D, `+ c  u! b& e
9 R. X" R7 M% D, p  T8 `
__________________________________________________________________________! R8 e/ R3 R/ Y2 ^
8 T6 d8 x  \/ k4 a, \6 r8 [$ \
Method 125 @2 c7 V' Y4 w: I
=========  V# N/ d9 D4 y% R3 ~
9 u6 n9 s+ L+ t) f* e
This trick is similar to int41h/4fh Debugger installation check (code 05
3 ]3 D3 t7 _# A* H&amp; 06) but very limited because it's only available for Win95/98 (not NT): d4 R$ u0 o) |: Z$ h7 m0 }  f
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.! C2 Q# w! r7 \# m. U
. m' b; K# M% b, p. B( ?9 B
   push  0000004fh         ; function 4fh
/ [0 f0 s7 m# t; J  z' C   push  002a002ah         ; high word specifies which VxD (VWIN32)
+ p6 T- P  j0 K0 W5 [                           ; low word specifies which service7 F/ t: w! j0 s8 X
                             (VWIN32_Int41Dispatch)
7 Z& P% H: S) L  U' L" e   call  Kernel32!ORD_001  ; VxdCall: o! g" H1 D) l
   cmp   ax, 0f386h        ; magic number returned by system debuggers* M7 p$ O2 m, q/ w- U2 g! ~
   jz    SoftICE_detected
8 l% O, c- l+ i; a9 J
" _* i8 P- J: [: aHere again, several ways to detect it:8 h; R5 c1 J7 O' J; Q, N2 f1 s

2 y9 p7 j8 b2 i) y( a) B# D    BPINT 41 if ax==4f3 Z) P3 A! s5 {" E! p2 |2 Y
; Z/ e. F, N5 A9 X) B
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
8 |: D8 e$ R- {2 [9 }
5 |% e* |: G+ o) [: i: b) M    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
1 C! b+ l! h7 @2 S2 Q
. m& Z$ B% u& b' r    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!  @$ k: ^4 _0 d( W
6 q+ J! F' x# Q
__________________________________________________________________________
" r# N. u; d" m& [2 C7 `% h7 T- ^- w3 \, @
Method 13
% F' A1 d1 E9 _" O* g=========
5 Q' K, J- @$ H) H5 p2 a
6 Z1 g* E" i( [* A& KNot a real method of detection, but a good way to know if SoftICE is
0 K! `0 W' T" s8 V* Vinstalled on a computer and to locate its installation directory.
7 r2 y: G; T# {2 l1 M& gIt is used by few softs which access the following registry keys (usually #2) :' v2 v2 F3 N7 l& L" Z' p/ b! b/ ]4 H
7 A* g4 T$ y; `( b, |& l% r3 U
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion: \: k0 a5 g5 j
\Uninstall\SoftICE3 Z' P" d$ Q0 ^$ g6 Q
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE  @) l& |2 V  n
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion6 s  l6 Q0 {3 _5 B% V0 B
\App Paths\Loader32.Exe, E9 ^: B$ u8 J" M6 Q3 R' v$ W3 x6 Y

. C4 i6 |; j, F8 V1 o  H6 W' c( j: f! ~0 i6 ~
Note that some nasty apps could then erase all files from SoftICE directory
+ O' }2 D$ L8 D& ~5 s(I faced that once :-(. i6 n7 ]7 k4 l, F4 @. \. {6 V8 C. _

2 \0 P( p3 S! u; PUseful breakpoint to detect it:/ g3 W4 T) F* D& I) H

1 S5 N2 u" a* A. S, G- v     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
6 m; O9 ^7 P2 Z5 x" g! [- G( B" c5 x4 O: P
__________________________________________________________________________) v6 e% g- Y+ q

7 T% V6 s: }2 B- Y, C- x$ D6 s5 R; y. C3 Z& l& @' T
Method 14
6 ?/ H/ w' ?# I3 K  M! s9 T=========
+ f9 T8 ?  m3 e* _( U5 ?5 P- H0 f' z' ^* w7 m+ d
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
  P9 h. I& w4 }- B. d6 Q! h4 Sis to determines whether a debugger is running on your system (ring0 only).' ?# L* _% u% [) d* x9 b

9 [( h2 @$ o; i% i( R   VMMCall Test_Debug_Installed! `% q; {' g6 H* z" O% c0 Z9 {
   je      not_installed7 {7 T* e9 V/ K
: `+ z& S9 f1 N) ~& k! D
This service just checks a flag.
9 ]' C$ f9 @% X; T8 o" L. f6 e% |</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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