About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
  k1 H" ?6 u; R. u! b" ], w, n. ?; L<TBODY>
3 U1 l* g% f5 P4 ~, s1 L<TR>: C' N0 g! L! H) A$ h/ m8 o
<TD><PRE>Method 01 5 v% f8 {1 {8 C+ u$ S+ n' C
=========
; f7 d* G, m  L- ~( e+ E3 Z. n& I0 c+ V
This method of detection of SoftICE (as well as the following one) is
# A; ?, K& o/ c0 R  T' j4 tused by the majority of packers/encryptors found on Internet.6 R7 ]( M; J0 w9 s
It seeks the signature of BoundsChecker in SoftICE9 F) J3 B% w. i# q4 G' e# f- U

) i) ^8 `8 F0 u- h8 e    mov     ebp, 04243484Bh        ; 'BCHK'
5 n- `9 n0 v7 Y7 L! J    mov     ax, 04h8 N2 r+ I. L% V( C
    int     3       # F; a, e* L9 ~2 |7 g9 Q
    cmp     al,4
9 ]; Z% @7 A- h% A4 k5 y: Z    jnz     SoftICE_Detected( M% a. _' I& n& G+ W, f
( b: c2 }7 `. T
___________________________________________________________________________1 ?/ n# _$ P& d& g" ]
+ ?3 N# S$ m0 t. u- O1 O( Y
Method 02- H7 o- |. b0 d$ Q9 V
=========0 I1 {0 E/ E& D) c4 U+ a

5 T' ]. V. \( M7 H$ r% T& sStill a method very much used (perhaps the most frequent one).  It is used
/ ^6 s: X' W: Y8 E- }4 tto get SoftICE 'Back Door commands' which gives infos on Breakpoints,6 x5 _" @& g2 d. u5 f6 n- T8 R
or execute SoftICE commands...# ~& j+ n+ |3 D4 S
It is also used to crash SoftICE and to force it to execute any commands2 L1 }+ Q5 B$ W0 C8 p, U
(HBOOT...) :-((  
. L" G' G" C* h8 n8 L& h4 ~& B
( L. D5 E7 k5 z" kHere is a quick description:
- |0 l9 l6 _% e9 k% _9 _$ U-AX = 0910h   (Display string in SIce windows)% j1 Q7 L0 x" f0 L8 v+ F
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)" ?- [7 o, B1 f" B7 `8 m+ [; b- `
-AX = 0912h   (Get breakpoint infos)
2 F7 Z3 Z' a1 T( D! y+ ?7 M-AX = 0913h   (Set Sice breakpoints)6 E1 W; i8 }8 K  q( A1 Q, v
-AX = 0914h   (Remove SIce breakoints)$ r' u/ Q9 B9 ^  i
+ Z- q- A6 K0 u0 M
Each time you'll meet this trick, you'll see:
; e/ n8 b& ?9 o; K4 \: r-SI = 4647h) p. G. _4 P: U2 ~: y3 F% o
-DI = 4A4Dh6 ^2 m1 m9 W4 s* }2 @7 v) V. d) l$ G
Which are the 'magic values' used by SoftIce.3 E4 b! G3 n# c4 W
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.
  x% P9 n6 O* u  k  u9 l% x
4 S# ]& P! G8 b  ^Here is one example from the file "Haspinst.exe" which is the dongle HASP! }6 h. w6 x! X: f1 e- M
Envelope utility use to protect DOS applications:
, _# E, Y% v' V
: U3 Z; ^- v* R# p
/ ?' G8 B8 }  B/ o9 p4C19:0095   MOV    AX,0911  ; execute command.
. P7 b6 x2 H, i; @" q1 `6 E8 t4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).8 H6 ?. A' d& e% W0 o6 V/ \" U
4C19:009A   MOV    SI,4647  ; 1st magic value.
5 ], u% x7 A% E( w* I, E4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
3 n) x- H) a7 H4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)* Q3 N% i& T  a/ @, n; g
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute, z+ I3 H7 b: }# l1 Z0 P3 L
4C19:00A4   INC    CX
' z: |+ K$ e- `* i/ j) @4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute" _; D( z' H' \3 x8 |3 z( m+ U/ `
4C19:00A8   JB     0095     ; 6 different commands.
0 r. R7 o$ a* {' R4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
4 c4 }* `% n9 O' w4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
/ |6 x' C+ E5 z7 M2 o; N7 w$ I; X5 |, R# Q8 V
The program will execute 6 different SIce commands located at ds:dx, which% ^9 l! y3 Y3 {0 n" S
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
' h* }* ?6 x7 w( `9 ^# W2 p+ C) P) X# J# Z
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.$ X3 S" E+ T8 m. r1 ^" D( l" F
___________________________________________________________________________
- n0 Y) v, j" S& G+ ~
- E  k4 P2 `2 h/ L2 K2 W4 P$ ~, Z* `/ O5 i
Method 03. ]/ _8 U: {6 P" z* E" D
=========
- D2 A) e1 r* F# y0 R% u
7 A: B. o* S& @6 \" c0 l$ v' VLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h, ]# `+ @7 ?8 ]" m0 T& Y4 i% K* H
(API Get entry point)  s% P1 k4 t6 }+ C: t, a7 S
        & t  c" I, o; y% V
" d4 Y' c" G* w2 j
    xor     di,di
4 T& o( _& z2 @) d; K" g. `    mov     es,di6 O. e" S2 k$ N& `' S
    mov     ax, 1684h      
. g, d- _0 S3 }- v: S2 ?$ ?    mov     bx, 0202h       ; VxD ID of winice
$ K$ d; l: K, ]- o. W5 i9 ^    int     2Fh) S5 I0 K: l" Y+ }- ]$ |9 I
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
/ Z- p# c1 K1 ~0 I, r5 F    add     ax, di7 \. u9 k' u. P+ H: d
    test    ax,ax/ D+ _4 ?0 A# L: o: ?
    jnz     SoftICE_Detected
7 ?* h8 U3 v( t; E* s" G" I8 w2 t% q
___________________________________________________________________________
: G2 i" s5 Q; Q: N+ R, p* ^9 L
7 [  R" }5 U. x# Y" pMethod 04
" `7 p- K2 A7 N9 U/ S9 w=========: b7 k2 G7 l, ~) N/ ^# i
  k# r) v, E9 C+ K5 a5 c6 `1 B
Method identical to the preceding one except that it seeks the ID of SoftICE
/ ~& Q5 c- N# \  `) n. E  t* UGFX VxD.
# x+ Y9 g' o! w0 G8 c8 C
( }: b, Z; P0 O& A3 e3 z    xor     di,di" {" h. i, N* ^
    mov     es,di
5 {5 {3 \) w, d7 @, d) m5 e    mov     ax, 1684h      
6 D* H. v0 ^: D$ ^8 f% K3 h" }# o    mov     bx, 7a5Fh       ; VxD ID of SIWVID  s, x, W3 f9 U3 J
    int     2fh' x. |' \  Z; ^$ T! b2 Y2 c
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
9 K. }0 R2 {' F& Y5 E    add     ax, di
6 e+ f: M0 p7 s  @    test    ax,ax
6 _: @. g6 g& L. J! `, m! s6 |    jnz     SoftICE_Detected
$ {0 q' _( F  ~7 R0 Q: c
: f' H6 U0 M% H# Q__________________________________________________________________________6 c" L, ~) G9 G, ^9 o# I
4 Q  X( ~' |% n6 [' |8 Q& k" B
; ~& P; L! q+ e9 H" O
Method 05/ Z7 O- J& Y/ U) e5 j
=========# n2 G: ~* V" v% p
$ q: j& O$ [% b9 `! Q
Method seeking the 'magic number' 0F386h returned (in ax) by all system
$ L9 J9 K. [) D1 r) J( Ydebugger. It calls the int 41h, function 4Fh.
" \/ r4 W5 D( R/ _/ lThere are several alternatives.  
( c. E: t7 z. R% n9 t6 y4 x1 p: F8 h  \) M- n7 u8 _' ^
The following one is the simplest:
# d: W* k  L! y
9 v. Y/ L, b! Z+ I    mov     ax,4fh
6 A% r- n  [+ h* c    int     41h
% C: s. [4 }/ R- }6 r    cmp     ax, 0F386
7 f6 r* f- {4 ?1 q6 Q" v7 X    jz      SoftICE_detected5 y' W& y5 K3 B& ~2 E

* ?! G2 U, b: K2 Y. F/ Q; s0 N
& I( B7 i1 c% b+ f, c& s! VNext method as well as the following one are 2 examples from Stone's 8 h/ i) V2 l9 \* Y
"stn-wid.zip" (www.cracking.net):2 F' u  F1 b0 J
8 {: _; L$ ?. `4 h
    mov     bx, cs, Y; W7 N; z. [  U, ~
    lea     dx, int41handler21 A2 ^$ c- n9 w* X
    xchg    dx, es:[41h*4]2 T  ?& E; F* U! N9 J' E
    xchg    bx, es:[41h*4+2]* P8 @- G" Q( a- D& T
    mov     ax,4fh1 }6 R, O' }6 B& F* J
    int     41h8 G0 l; w$ G4 V; {/ B! {( v
    xchg    dx, es:[41h*4]! D4 k5 J9 E& g/ c" B
    xchg    bx, es:[41h*4+2]$ s$ D  K6 n3 N% v6 H- ~
    cmp     ax, 0f386h
& z# U, l! D: b& l    jz      SoftICE_detected  o+ F5 E0 v* V2 d

' H- t# z. m) b3 C/ T  vint41handler2 PROC# W; L3 h( i: S! j" q* j
    iret" E5 m' O+ G0 Z7 _
int41handler2 ENDP
! {1 _, _( W2 S- T' R1 Q7 I9 a( I
  w6 ~# W4 c5 L" E  K" P& P
6 b4 O$ U  G& ^; p- j3 n' o' g. f_________________________________________________________________________. T/ ?( r% m' m! I3 J

6 n  x5 P- g# Y5 R6 I& z, ^+ L: r$ d
Method 06
; J- k" p( l' y' w" n- \6 n=========1 p- }$ c! a8 Q
9 W. x5 H! o! J5 S7 `

% B% ^0 W+ s2 N& V2nd method similar to the preceding one but more difficult to detect:
6 X9 S  [1 |1 M4 n$ Z2 P/ q. e" h( w* [( x
% @; x& c" P: P! ^$ x5 o- ^4 ?
int41handler PROC
% ?8 h1 v8 l5 p( ~- L. v1 k/ Q& k' Q    mov     cl,al
! a0 h" S/ e% t% M- @  l    iret
# ~0 Y4 L3 Z% P/ Uint41handler ENDP
# w; y0 o! Y3 e# }$ ]% F9 Z, {+ ]
+ [: H# Z5 V  Y) _) ?4 Z
- r* z' @* L3 c6 g    xor     ax,ax
7 v% u' W3 Y  X2 z  o  w    mov     es,ax1 u: [0 s' h1 B
    mov     bx, cs/ Q1 I3 }% y5 i: m
    lea     dx, int41handler# E; F! @- j0 ~! b' ^
    xchg    dx, es:[41h*4]
8 P# x% [9 Y8 d, @    xchg    bx, es:[41h*4+2]
3 G, c# w" z7 o- P$ ^8 H    in      al, 40h
% {! D1 u  h- r" [    xor     cx,cx
( s; X! ?0 B; C% i    int     41h' @4 |5 Y7 z) N4 {0 B  R& q
    xchg    dx, es:[41h*4]  w# p8 g. r) h. y9 U( K% ~! O
    xchg    bx, es:[41h*4+2]
  u; ?, I0 v, W0 [, U    cmp     cl,al
+ H- m2 e/ [) K) z! p. t6 `# }* k    jnz     SoftICE_detected9 F8 L! C  d4 p3 L

3 G. b1 K) g* l! S_________________________________________________________________________
/ e' v' K- b' @9 m8 K( P
1 p# {. f, o' O. f( Q: Z& S! c: LMethod 07
5 x% |' W/ J% K' m2 Y) F2 C=========( v) g3 T- K8 C0 ?/ ~6 m$ j
8 p2 n4 p7 t) Q0 s3 Q5 p
Method of detection of the WinICE handler in the int68h (V86)
- s6 p- X2 O3 h5 i
7 L* S1 |* M8 J2 c. g$ _    mov     ah,43h
6 N% P: d. r% G5 ]    int     68h2 j6 w% l3 b$ J% i" p
    cmp     ax,0F386h6 J! a4 D. L& U4 i8 _
    jz      SoftICE_Detected5 e- y/ T# @6 P4 x! P# Q) e

, u) X! `- B7 ]1 f' t/ h
4 N8 y1 v3 @' H=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit; w. B- ~  \8 X8 W
   app like this:5 x( H( J& L( @/ A7 J" y. i
% N& H% a3 K! P) `+ A9 p1 N
   BPX exec_int if ax==68
7 `- l( ?3 l; Q   (function called is located at byte ptr [ebp+1Dh] and client eip is# A* M% i4 ~. f1 v9 y- ^
   located at [ebp+48h] for 32Bit apps); m! U5 {* p2 w7 y3 m2 m/ x
__________________________________________________________________________
- ?, j; i% C) H( C0 ~# C4 y( A) x* j  j

; P2 Q& H' e1 R- ?0 Y; C( y% sMethod 081 u& H8 }9 h5 b4 @: ]
=========# v; }5 l7 V$ J4 Q: p1 E( r: s
) a$ |. {3 Z! f/ ]" w8 D
It is not a method of detection of SoftICE but a possibility to crash the% E6 a( I% m* g  _" r# o
system by intercepting int 01h and int 03h and redirecting them to another5 x( K" D( y# k: f* G, ^
routine.
# Q% \3 p& W& Q) _4 YIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points# a2 U0 W# f5 a, I: a/ o
to the new routine to execute (hangs computer...)
: b" W; ]* M7 H  E9 \, T( q0 F' }( @% R, |% K0 q
    mov     ah, 25h
7 _& @% z  \% ~% b" B( t! ?    mov     al, Int_Number (01h or 03h)# e* M' b! [% {3 b) p2 s0 y# f
    mov     dx, offset New_Int_Routine" y" E( N+ W2 j7 y* G! S; h
    int     21h
7 R5 o. b# _( B* o; W
: w/ F4 ]0 u% w0 k1 z6 [1 R__________________________________________________________________________
- X( c$ {( m' r* h2 d- `. y# ^# T. \7 R
Method 09
0 ]6 p! r: Z6 e=========, e& ?! |1 R' r3 G" E
3 V5 c  U6 s" @& ]: `8 c2 X' z7 `
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only3 T* G, u$ ?$ i7 {/ Q+ ?
performed in ring0 (VxD or a ring3 app using the VxdCall).
& ~- ?: q- B; n5 n  ]; m: v0 dThe Get_DDB service is used to determine whether or not a VxD is installed2 |* \4 k2 ^4 G
for the specified device and returns a Device Description Block (in ecx) for1 |1 f4 l+ y1 }/ Z& d! c0 i
that device if it is installed.8 S$ d5 _0 M0 x  B1 U0 @; p# k

. `: x2 |; D5 o! o3 Z6 @! c   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID# f/ u7 l6 P- P& Y( ^1 f
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
6 [- P6 Y4 s4 ^. s4 o4 G   VMMCall Get_DDB
. S- E' Y- a+ L& {7 r$ ]   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed3 p9 y3 m+ L% J. z4 j: X

2 u% F5 K* b2 A) [8 c/ YNote as well that you can easily detect this method with SoftICE:
( D" \0 q7 z2 c1 Q( t   bpx Get_DDB if ax==0202 || ax==7a5fh6 k6 Z+ P4 e3 U' ]; z6 J1 v
: J3 d8 N! }& p2 B) \' t
__________________________________________________________________________- ?4 E9 e! w1 m; Y; N$ A
, g# ~: Z5 T5 f3 |$ i
Method 103 _7 y% n& W5 T7 G9 v
=========0 u3 J! @  X2 p: h' Q
3 \1 I; l/ ~) {- d/ [
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
4 Y% q8 r0 `6 c- Z* ^  SoftICE while the option is enable!!
/ r0 P, Q( Q0 O, ~: s  N) r8 e' e" G' [, |* S  `! A
This trick is very efficient:, S% C1 T) {) q1 v
by checking the Debug Registers, you can detect if SoftICE is loaded- V0 d7 d6 ^3 R5 h$ ?
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
8 }8 G/ q) k0 T  Q" K! H/ s1 bthere are some memory breakpoints set (dr0 to dr3) simply by reading their, p3 o, J0 l; h) c( K% m' F
value (in ring0 only). Values can be manipulated and or changed as well8 @0 W# _  Q% e3 i0 a' p
(clearing BPMs for instance)7 K1 b* d$ n$ N* K
+ ]7 c8 z' }1 }# u$ K0 L4 @4 n$ f
__________________________________________________________________________( i8 \8 s, p9 [& I$ T, {

9 @' n3 P0 @  X/ oMethod 11
  w4 v1 G  p) U, \=========
+ R; G; X* \& g1 a% }# z
1 G* ~6 [. E3 _) u- ?) Z2 eThis method is most known as 'MeltICE' because it has been freely distributed
) p5 d1 N% `" A! @% o, nvia www.winfiles.com. However it was first used by NuMega people to allow
+ v4 }$ B! A0 ?Symbol Loader to check if SoftICE was active or not (the code is located
: a; w0 A/ w! d0 V' S0 a4 e) minside nmtrans.dll).& S3 j4 L$ n2 a& X7 @- N& j$ e
& [# M6 L2 ]0 \8 {6 o" \2 U
The way it works is very simple:8 N4 Q+ j  g4 Z# \& N) Z, V
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for: W5 k8 g1 \: ~% N* N; Q1 f
WinNT) with the CreateFileA API.
& h2 u' A. M) e7 T) Z
6 e/ Q; C1 o7 N+ @0 K+ t( cHere is a sample (checking for 'SICE'):
5 i7 g- a' Z- i1 V( \$ S; \( x/ T* y  @0 F; q" D
BOOL IsSoftIce95Loaded()
/ i3 N' E/ L  M! c/ M' Y{
; d; I# i$ B4 r: C   HANDLE hFile;  ) |# h4 ]0 V" n4 X' `- W& V8 E. V8 m
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,5 {& N& t; K; N  [) y
                      FILE_SHARE_READ | FILE_SHARE_WRITE,
; g: f6 u" a; G6 o3 {                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
  q+ ?: V) ~7 |1 X/ n4 D3 ]   if( hFile != INVALID_HANDLE_VALUE )2 K0 d  K$ A: M  B
   {
7 d6 W/ n+ A7 A. {8 a  `6 l5 m      CloseHandle(hFile);# l1 O# W0 \2 e" H6 G- N
      return TRUE;4 X  [# t6 H- O! ~
   }8 E; g. x* o4 A  I; R! {# z, E
   return FALSE;( K& K& ]: c: l2 a2 G* y/ q5 k
}6 x5 O) A1 }! T- W% e/ X6 ~
1 \) ^/ A: ]. c0 ], ]6 c/ D$ u
Although this trick calls the CreateFileA function, don't even expect to be
. \* Y: e2 k. C8 X* C" Bable to intercept it by installing a IFS hook: it will not work, no way!
# I6 m! {8 k) UIn fact, after the call to CreateFileA it will get through VWIN32 0x001F
5 j% @; I% {6 P9 oservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
( S' }9 |2 f) ^* u2 land then browse the DDB list until it find the VxD and its DDB_Control_Proc, V+ H2 g+ a' T. y2 S# W: E! q' M
field.0 g- H. r1 B! A* Q5 f
In fact, its purpose is not to load/unload VxDs but only to send a 8 S, X, h- s4 A8 \, C3 R7 C7 ~
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)1 ^5 b: k: y1 v2 I6 ^
to the VxD Control_Dispatch proc (how the hell a shareware soft could try
* w( B4 P  s8 R8 L; {; _to load/unload a non-dynamically loadable driver such as SoftICE ;-).
" m, y+ O% r8 x$ o& ^! B& d6 MIf the VxD is loaded, it will always clear eax and the Carry flag to allow0 u* t! ^" `6 L2 G# v9 ?5 v3 D7 f
its handle to be opened and then, will be detected.; @. j) w8 J& s8 [$ \# f1 M
You can check that simply by hooking Winice.exe control proc entry point+ p5 b8 \' s: V2 G; e: G
while running MeltICE.6 u2 k1 p0 Q" W$ b, |! E
% y; S: K1 U$ D  a  Y4 b1 L: ~% l
3 i' O8 w: `: T8 T$ J3 e+ v3 _8 J" R
  00401067:  push      00402025    ; \\.\SICE; R. V( d5 `- W$ L
  0040106C:  call      CreateFileA
1 {; n/ t7 |' z7 \  00401071:  cmp       eax,-0019 b1 B. e3 i! P# z6 E2 L7 `; v$ ~. L
  00401074:  je        00401091
/ U2 n7 v' Q) ?; }6 F- H2 H: I$ h6 d4 E# E' |
# q# s1 {. W- M$ ~& F+ C1 ^
There could be hundreds of BPX you could use to detect this trick.
3 k, i/ q9 e: W& a+ E-The most classical one is:
7 d3 v( U( @" }$ G& k4 ?: T  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
' x; `) `6 Y4 f. m. l% h" q& r4 O+ B    *(esp-&gt;4+4)=='NTIC'
# I  Q/ M4 [7 L6 P2 e& L* m
' z$ o# Q5 f# v! d-The most exotic ones (could be very slooooow :-(
' p8 r/ ^" h; c( z3 C" t9 H   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  & d  O) U1 f' W
     ;will break 3 times :-(
" y4 o2 o2 p! d+ r* o6 D
( o' M- _2 i7 t) ?3 P* \: \-or (a bit) faster: $ ~' p+ ?. f% Y0 n7 }
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
8 Q  r. O7 [) N/ f; ^9 Y& B* q/ j
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
1 o4 N" G/ w/ {/ {     ;will break 3 times :-(
+ H, p5 j4 [- C/ T' }
6 F6 x% y) _2 u, V6 s-Much faster:( `$ _9 l' z: r8 B. s, ~( c' x
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'+ e# Y6 Y: y4 q# v' w' y" Y
# Y1 H! f( @3 d2 }. ]  _
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen
2 K- O3 ?3 a- Q: P9 V, Cfunction to do the same job:+ y* Z4 x+ n" m. p2 h/ A

5 {9 m# ?' n. [6 V1 q   push    00                        ; OF_READ
. b& `9 I* S+ J: ^7 B   mov     eax,[00656634]            ; '\\.\SICE',0
( B* y. W4 E4 z3 k! ]$ s+ c   push    eax
4 u. n% y6 [2 A3 |8 ]   call    KERNEL32!_lopen
; H8 I( s  l2 Z- [: D; g2 g  w. A   inc     eax& a1 W7 r7 a, @6 ~) u! N6 u: {
   jnz     00650589                  ; detected, G5 v8 V& z  g% ~. N: `9 _' \
   push    00                        ; OF_READ
  ?- m# U, v6 a: D4 w! s   mov     eax,[00656638]            ; '\\.\SICE'* P" w( P8 ?5 g. R, o
   push    eax
! p* ~$ {) f+ n# l9 P; L6 v+ M. b   call    KERNEL32!_lopen% o4 b' Q" _7 {2 j- ^% Z7 C
   inc     eax
7 G; a' f- i9 Z% s   jz      006505ae                  ; not detected
+ ]# Z& I+ r# c( _+ m6 Y2 H- p& C8 }1 f" K! j1 Z$ v
$ a: O0 l. D) t% ]3 a4 b. D
__________________________________________________________________________
' U8 d) _, p" t( t, T
: i( B5 H1 t) i- XMethod 12. [7 O" ]- y% ^7 Y5 Q
=========
% F# {, b+ g3 ?1 W; M. Q; l+ Y9 r& F' y! v0 b
This trick is similar to int41h/4fh Debugger installation check (code 05
. y$ P' d$ K: z2 X+ j# p7 d3 a&amp; 06) but very limited because it's only available for Win95/98 (not NT)
( n- O- q2 E5 nas it uses the VxDCall backdoor. This detection was found in Bleem Demo.* v# z' y! i* Q

/ [# y9 l% T7 J5 R- b; H   push  0000004fh         ; function 4fh; f8 I# Q% X+ _& L& C6 F
   push  002a002ah         ; high word specifies which VxD (VWIN32)
! |- `; b+ a  `* x, y1 `$ ?                           ; low word specifies which service. }7 o0 k* |, A' q1 }2 f
                             (VWIN32_Int41Dispatch)
. F. y4 s- ~" s" y8 S* `   call  Kernel32!ORD_001  ; VxdCall
7 D" _1 T% F' g9 s+ ~0 c   cmp   ax, 0f386h        ; magic number returned by system debuggers* A1 K! A  x, j& C/ X* q
   jz    SoftICE_detected
4 X5 q( {, T  F/ x7 x2 v9 d8 Z# t& e8 x' y& p
Here again, several ways to detect it:
- Z" M. |4 \, A2 e2 E8 E7 o
' Q$ ^* D' e' ?0 Q5 {$ Z0 ?    BPINT 41 if ax==4f) ^, S& M) J9 d. j* s- e) B

& k: G: P- }2 P" b( r    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one3 W1 J" F8 w* p& j
& g! Z: f8 R" d8 W: V8 p0 G2 s
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A3 e2 c8 s, b; [  [. ?: `3 W

' l. A& k$ n' f  O: x    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
) r$ }' F+ \+ V4 |3 |) R
7 C+ ~7 t! E$ n! P7 E! r__________________________________________________________________________4 @+ A2 P) g* Q+ A* Z
: ]! l9 P9 x) `& f' V5 T# n
Method 13
' n, p, a- E; R8 |# j/ Q8 |=========, M; U" R; }+ M
0 X) z' a/ G; P3 a. A# v
Not a real method of detection, but a good way to know if SoftICE is4 D) o% ~1 s6 Y# K" A- k) s* X
installed on a computer and to locate its installation directory.5 K( @& Y& {# V3 O( f0 M
It is used by few softs which access the following registry keys (usually #2) :8 c; G6 f2 ]8 r, r4 k: r" Z6 P
/ Z7 t- ~+ o/ Z$ u  S& ~  A) D
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion0 I1 ^8 [- u$ W  v0 B6 I% k
\Uninstall\SoftICE
# D+ z) E6 O4 ^# p1 g; l-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE! @) H& \9 B- V2 o2 C. J
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
' r- S0 s1 W5 p5 X; O) H# f) `\App Paths\Loader32.Exe9 p4 k  ?  V$ }

+ g4 ]6 N1 Q# [' {
* J6 |8 r" T( ]+ P; a! ZNote that some nasty apps could then erase all files from SoftICE directory
8 x* z- a( E  G9 @4 i& M4 m( W3 n& D' F(I faced that once :-(# C4 |. p, Z1 N* p5 q, U; k

% T# o: M( Z" o" tUseful breakpoint to detect it:- `: [& m$ ~$ R; F: b

' n% o: q0 f  P     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE', m& @! Z5 ~% q" O! K

: b  k; b/ ?- r__________________________________________________________________________( J5 v2 h, i4 u# v

# e0 k% e: |( {8 V1 ]! Y) d( g3 y! j
Method 14
  r7 m* @7 ?& V7 P, H$ V) |4 j/ M9 g=========
+ u5 E) e4 {" ~. I  C; \, D
: n# d7 r8 ~( l$ `% GA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose  m  i* c" U- b6 x% O3 q5 V9 {/ N
is to determines whether a debugger is running on your system (ring0 only).* K6 W! G4 c0 F% J7 `  E8 R
3 M  B) I: H7 T. ^
   VMMCall Test_Debug_Installed6 V1 b0 {. J& B7 c9 G
   je      not_installed
$ \/ _. @' A: K2 i* R& l: V
2 U  q' i  ?# x0 uThis service just checks a flag./ m6 n- U+ n. t% z) S6 Y" i
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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