About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
# I/ b8 M9 }: f4 U* |" `<TBODY>
$ v" G: R2 Q4 y$ F* b4 f% l; i5 L<TR>% K- }! y. c& S( F2 \9 L
<TD><PRE>Method 01 4 l3 x5 ~9 L& U
=========
' `+ c* t& ]4 E. m
; O0 t4 j; F" XThis method of detection of SoftICE (as well as the following one) is' b7 q5 a! o$ @- r2 i) W/ y& l3 a
used by the majority of packers/encryptors found on Internet.0 K( E8 U# C4 [' F  o3 R! n
It seeks the signature of BoundsChecker in SoftICE# E9 x- g# M6 h( _  B" [
* ~9 h+ C" n& I8 f- A
    mov     ebp, 04243484Bh        ; 'BCHK'
7 i- p$ Y. e7 L, N' I    mov     ax, 04h' ~4 o- a' g. P# j- [
    int     3       6 y% K( L4 O0 e
    cmp     al,4
# k4 E4 Z9 X+ d1 P    jnz     SoftICE_Detected% H  T& y2 Q; o
1 M. E( F( a: l' A& d0 \+ b
___________________________________________________________________________
; W0 |( A  O) o+ A& I5 A0 a; u) Z- o" t
Method 02
+ T( e/ Z+ V( b. l; B* x" F8 B6 J- t=========+ l. Q6 N0 w9 X
% [# t0 W% W0 T% s
Still a method very much used (perhaps the most frequent one).  It is used6 e7 i0 M1 L& ^' g: z
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,
$ n5 x5 G) u) Y, w: D' F8 Xor execute SoftICE commands...4 C% K" `6 F# _
It is also used to crash SoftICE and to force it to execute any commands
8 M( A1 J2 X& ~& A9 a4 U(HBOOT...) :-((  
* Y2 P0 t) W4 D4 I7 P1 u- v+ f  _$ V
Here is a quick description:
" \7 j0 Y# z3 E4 a8 m! i. Y: b0 B- [-AX = 0910h   (Display string in SIce windows)* z' m- b5 o: ?' D
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)) ^3 Y" i% s, x" w
-AX = 0912h   (Get breakpoint infos)
: u3 a/ v' r$ j-AX = 0913h   (Set Sice breakpoints)
2 \4 X, R) [7 O! W9 G- J  _-AX = 0914h   (Remove SIce breakoints)3 B4 M1 N7 C2 D
1 I* t6 [" q% n8 k) L
Each time you'll meet this trick, you'll see:
" E6 m- P0 C4 E: C% Q$ l# g-SI = 4647h) T: @# H5 k! z+ @% h. [0 v  w
-DI = 4A4Dh: r' B# n* u1 f4 b8 g
Which are the 'magic values' used by SoftIce.$ q$ N, H: {! Q" l4 U5 D: _
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.
1 }+ {$ X0 G5 e. Q
/ _: R" ?. p+ B0 B' e2 mHere is one example from the file "Haspinst.exe" which is the dongle HASP
8 k8 `) k4 L/ Q: [; W& d, [/ mEnvelope utility use to protect DOS applications:' T8 I- J3 M! n

' r+ s! i% K# Y
$ O! z' D2 Y& X, O" K( M' F' p4C19:0095   MOV    AX,0911  ; execute command.
5 I4 V2 u4 n1 @8 ]4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
/ f% R- a. J1 e9 o) o4C19:009A   MOV    SI,4647  ; 1st magic value.: i  D6 L2 ^0 |$ r+ E
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
! [2 D! M; S2 ?) d# ?  a4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
6 y6 J) A& ~' K7 g  v+ ~8 V; f4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute/ f3 H3 A  s- v' V0 s  e  L
4C19:00A4   INC    CX) f% E4 e! X0 T& g. N  d+ T- R
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute9 k7 I5 _9 a* v* z2 V$ [
4C19:00A8   JB     0095     ; 6 different commands.
8 a; v/ t' q, O. V7 U4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
4 H- D2 K6 n- g" u) X4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
6 [% s6 E" e( `9 I! {  G
5 l, e, I/ w  U& d; FThe program will execute 6 different SIce commands located at ds:dx, which
0 |" J) v3 m1 ~7 B; T, f/ `are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
+ `: B9 }; p# U: _0 t9 r* c. |! G* ~, Z1 W) [2 a
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.. y, r4 E0 L. a2 V' |
___________________________________________________________________________
5 R% r0 z# u% F4 `& O6 {
& X+ b8 R  K, b) W4 e
! V2 s! w  s5 m! h6 o) FMethod 034 \( X& b7 ]; b3 X; O- H/ J" Q' W
=========  U) S7 l$ C& M/ o7 V
9 P3 g* s& X, |4 ^5 w
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
$ p6 V& N  [# R- Q& u/ Z5 x(API Get entry point)6 ]/ j: j1 n7 ]5 t. W& @
        
; a' w& v0 O( R6 C) V, q: k1 X1 ?  t6 D! ?( ?( K# q  z
    xor     di,di
+ Y+ h2 D/ m8 n; `    mov     es,di
9 m4 K! |! p! y. B" L+ n2 W9 r7 f  i    mov     ax, 1684h      
. X4 |! f2 Y5 b8 m: @1 N, j    mov     bx, 0202h       ; VxD ID of winice
8 L4 l& Q# ]& A9 r& C. M    int     2Fh
$ Z' O! ^# \, E$ o7 \    mov     ax, es          ; ES:DI -&gt; VxD API entry point
8 g2 F5 A, |4 O4 }    add     ax, di
+ y7 s* t0 R8 d5 }, Y4 J: n2 h    test    ax,ax
8 h0 a9 A+ o! K    jnz     SoftICE_Detected
" K$ _& L7 u  {) h. |& l& ~6 a1 p+ K& e" I8 F. U" W8 W6 ^, H6 H
___________________________________________________________________________
8 ]0 [% K3 A. |* @" ?( g4 J# B/ R& B# H+ Y
Method 04
& @4 r% U+ p+ B1 H$ Q0 G9 P=========* }& N: V# b9 v% P

* T4 i6 U1 f2 C  o4 I# cMethod identical to the preceding one except that it seeks the ID of SoftICE0 _3 `- l! H% u
GFX VxD.! d. r1 `) t4 ^- K( N1 E- ^
7 m  r7 a7 _. `; c$ ~
    xor     di,di
5 d* a# o6 I6 z9 U9 R# T6 N    mov     es,di% J, N0 B- ^* G) p" L
    mov     ax, 1684h       0 `( W5 \. O1 j. v5 o
    mov     bx, 7a5Fh       ; VxD ID of SIWVID0 Q/ j/ @% Q) k  N
    int     2fh7 l: [) Q& d! K9 x4 w
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
& K" |6 A+ Y3 }5 A7 E4 Z& `, d    add     ax, di
% I, y5 Y! n3 d3 k1 f; C    test    ax,ax) s( H9 W6 o1 M, b
    jnz     SoftICE_Detected
9 J2 G7 }$ l- ]7 V1 C  [- z7 i. N0 H5 g) O" h
__________________________________________________________________________+ n% H, g9 R* U* W7 _- `9 t

! M' O, k7 u7 w* `/ \
: G* `+ j! `# P; T# ?8 j/ EMethod 05# }0 z9 \4 Z0 h5 A! [* Y2 ]* X5 a
=========; V' ]. H; D  ?' R) t* y
, v0 l) t5 Y; ^
Method seeking the 'magic number' 0F386h returned (in ax) by all system% ^' W' B% v% `3 V! E. F+ ~
debugger. It calls the int 41h, function 4Fh.+ Z+ x( l9 Y# U& x* C8 v; T" L
There are several alternatives.  7 }8 k3 N$ z7 Y4 Q- N# e$ c! ~

" v3 o/ d' O  b8 FThe following one is the simplest:! ~: {& B9 C8 m- ]

4 _  s2 ~" E. x    mov     ax,4fh
2 U8 Q% M& _% L    int     41h
2 Z2 O6 T' L( `. @3 d; \, {$ m    cmp     ax, 0F386
5 \( d* ?2 V7 t7 P2 V' m    jz      SoftICE_detected& d) y3 w. ?8 o
# X; d# U" N5 }. `
$ n1 r& N& J* x$ g  L  d
Next method as well as the following one are 2 examples from Stone's
8 ?; ~, p& Z  V" ?6 K"stn-wid.zip" (www.cracking.net):
# D" M7 u! ^8 b1 h7 {- B+ R
, L2 [* R) O! j* m    mov     bx, cs9 N+ L# S: y; ~
    lea     dx, int41handler2
+ X& j) A* \! p/ h7 y8 i% B& B$ k    xchg    dx, es:[41h*4]
4 K, w, a4 o) H* A5 r    xchg    bx, es:[41h*4+2]
% t, O$ a: R- m( T! ]0 @6 O    mov     ax,4fh
' y& K0 O' |2 g" t! ^6 W" ]! f    int     41h7 ~; [7 T/ T9 l' M0 f7 S
    xchg    dx, es:[41h*4]
. n) J% W0 _) e$ ^2 Y( h) j/ g    xchg    bx, es:[41h*4+2]
, |/ [9 N9 `1 e5 s! ^0 {" n( ?    cmp     ax, 0f386h
  n- q7 A8 N, z* H! B    jz      SoftICE_detected
# ^5 c  p% H& l6 Y& Y8 C
/ F) T, {8 O# Jint41handler2 PROC
- Z% B, f! {9 L/ n, [) G) V# _    iret
1 f3 b, N/ Q  `int41handler2 ENDP/ [, n' p1 j6 V0 V& a

, V- a8 f9 k: {, B) A' I' W' d! s% F
_________________________________________________________________________
7 J5 b" Q$ V  R4 ~
0 s  N8 i4 j2 L- ^9 V7 Y. m: T( f' B7 P' |& r& J
Method 06/ W* A' ]* y7 b" j, H
=========' j8 q* x, {2 m* X/ n$ g9 O, M; f
* i- ]5 n  w3 @2 w
1 G/ O8 Z- d& m. ?3 m
2nd method similar to the preceding one but more difficult to detect:
, \6 q5 a' c+ J" S2 K% a* U+ M* d: J) `2 K2 j, s
% v; P2 v. b2 n/ S
int41handler PROC
) N9 _: a  C" Q' i+ e7 V: @    mov     cl,al7 }% @  j. |& a" J7 _
    iret
2 f5 }1 A! P# T8 xint41handler ENDP4 w+ V4 R7 A6 e. I$ V

2 N  z$ x- Y# ?3 Q7 P: [1 F, Y' [. k- e/ u. ~) I9 C
    xor     ax,ax
9 |2 g4 n9 \; S    mov     es,ax
+ V2 Z/ b+ O$ w$ g0 m2 x' z. ?8 e2 g: p, J    mov     bx, cs* G8 u# h4 _6 X  P1 I
    lea     dx, int41handler2 a2 F) |0 Q2 S
    xchg    dx, es:[41h*4]
8 r8 v$ v/ E( `& O: Z$ X    xchg    bx, es:[41h*4+2]+ F; I: c' T! W7 R& h* d( G
    in      al, 40h
) t; j. m( D1 u3 E$ z5 q- {/ h    xor     cx,cx) Y5 r5 F' D% w  U, r& u7 F
    int     41h8 L2 {: H, z/ `8 D
    xchg    dx, es:[41h*4]: Z6 }/ V) k: p+ [' i
    xchg    bx, es:[41h*4+2]
0 s! i8 E+ i5 x9 |9 _    cmp     cl,al
) \3 ^( P; j1 q4 [. a( f5 I+ ]    jnz     SoftICE_detected1 L4 i7 Y( H8 l- E6 F$ W
3 ~9 Z- n8 j4 }$ g4 R1 Z: p* ^
_________________________________________________________________________
4 N$ ?9 S: Z7 k; H$ H/ a
7 G3 d/ g& J# Q) g! h. j3 YMethod 07/ P' @6 l7 B0 [% V' u9 {1 U
=========& E! [' \! b6 p" _5 m' q# K
4 F0 r/ P7 _& V; F1 `! }
Method of detection of the WinICE handler in the int68h (V86)
, }7 Q" h( a9 W0 m5 W( p, D
2 z2 _' L; |. C. {0 [. A* Z% x    mov     ah,43h! C5 a) f! W5 E7 m5 P
    int     68h& \' |. Z" J, w5 O( e* Q
    cmp     ax,0F386h
' |5 r6 u( Q6 @4 q    jz      SoftICE_Detected% _" y0 ~  X$ j) t( Z7 C
, _6 ~; c$ J: n; ^* S. _2 g9 |1 B3 W+ s

( k" E. H1 P" l/ |=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
5 e0 G- [' j, B/ E' `! t8 o5 q# [   app like this:
! s+ Z3 x. D: ^6 ~! W5 E* y; i2 ]9 x7 e* c
   BPX exec_int if ax==688 u1 }7 F6 ~8 J' y7 j
   (function called is located at byte ptr [ebp+1Dh] and client eip is; }2 W6 Y& V0 |& T2 c* }4 ?
   located at [ebp+48h] for 32Bit apps)
3 v; d, \* x( C; |  P__________________________________________________________________________
6 L9 r; |+ T) K0 e) b3 |7 p3 u& I7 Z( a  O" |

2 D3 O* E6 n3 V6 L9 \5 i' Y7 SMethod 08
# Q# |5 k9 M% x+ z0 k=========( R$ |5 t3 x% i
2 z# v, x3 `1 t, I! _! p/ W
It is not a method of detection of SoftICE but a possibility to crash the: W' f$ ]. I& S9 ^& P, ?. ?
system by intercepting int 01h and int 03h and redirecting them to another1 O3 K3 X6 m# @" ]6 b
routine.. E5 v+ p! T0 P9 @6 y9 h
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
/ s' n* H/ }% K6 A( Q8 g' pto the new routine to execute (hangs computer...)/ s& j3 a$ T1 v. a  d( a
. t: d3 ?& M7 l* t
    mov     ah, 25h# j0 B( g) n, ~4 k/ p; @) G
    mov     al, Int_Number (01h or 03h)
# G0 I. h$ z( X    mov     dx, offset New_Int_Routine
0 b  Q& j( B) u% U. E2 z- |    int     21h. b$ j4 X$ o" V3 q# G) p

: v& b4 D, t: Q. W0 ^; j3 x' @__________________________________________________________________________
- L9 y1 K* \+ N  [. T9 m3 T0 f. @8 V: ~& }9 v8 y3 y8 Q# f
Method 09' i) Z% [  F/ P% S$ @, g) C
=========( h4 m5 v' |2 \  a6 N3 }  E
: q) A. b6 ?( Y8 n" P$ \: g
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only: G* ^8 w0 M$ w5 [% b4 l
performed in ring0 (VxD or a ring3 app using the VxdCall).
1 S* o4 j% b' R2 O9 SThe Get_DDB service is used to determine whether or not a VxD is installed( u, z9 ?5 R1 s8 n3 o- n, r
for the specified device and returns a Device Description Block (in ecx) for  R" E9 e8 Y9 ?1 v9 }
that device if it is installed.- L! l& f# w! [- }4 p

1 a( r& Z( @- F& q) f   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
: ^6 U' }) z- \7 O8 {, |( ]7 ~   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
! ~( {: w( _. w( c$ O   VMMCall Get_DDB# H7 K; T+ Y) O, z  d! m& t8 r
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
6 C6 T8 q; G% V$ V- ^. W; G
4 h( ?" S7 @) u+ d" ~5 F. ^! ]Note as well that you can easily detect this method with SoftICE:5 f9 Q3 @" W  k1 r# s$ a0 U
   bpx Get_DDB if ax==0202 || ax==7a5fh
# ]6 i$ W5 W  G! g; ?$ G  ]& [6 r4 I) t3 l) o# h4 K
__________________________________________________________________________
$ Q# v7 W  i: F, s
( Y7 U6 y) r) k' u' R* {5 GMethod 10* [+ t" g7 n" w6 c5 [
=========; F) q7 d% c: e# y3 K1 X! X

- W. I8 f; Q0 o  n+ L3 W=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with+ g" r0 S, ~9 y+ P( b  {& _
  SoftICE while the option is enable!!
* k6 }( `. |: f, l9 u; o0 ]: q. s6 l0 }: x  d
This trick is very efficient:" w- z' z2 L* K' \
by checking the Debug Registers, you can detect if SoftICE is loaded
: \' \" I; E. S$ G(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
6 K* y# h, v9 ?) Z1 c( {there are some memory breakpoints set (dr0 to dr3) simply by reading their
9 ^1 n  ^/ F1 ~: pvalue (in ring0 only). Values can be manipulated and or changed as well( f& q7 t5 J! w) r9 [* q
(clearing BPMs for instance)9 s: q: D! t. B9 v0 Q& d
, h1 V% j* o7 G, S2 [  D
__________________________________________________________________________! a/ k' Q8 o) d/ I

# O, H0 Q% i1 y# P& cMethod 11
7 ~/ c1 d. k' B$ G0 s" P# h, D=========3 O! o2 Q- Z$ ]5 A+ L' f
1 E# v( S1 X' n4 L
This method is most known as 'MeltICE' because it has been freely distributed' l, w! V' G0 Y! _6 J
via www.winfiles.com. However it was first used by NuMega people to allow
' S7 o& y. w) hSymbol Loader to check if SoftICE was active or not (the code is located2 t& z" m. E# E% n) ^) d1 w
inside nmtrans.dll)./ D( ?9 y8 t/ ^- {

0 }; ?: l" X! U3 B* _/ u2 rThe way it works is very simple:
8 r3 w, D5 J$ hIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for4 c8 l1 ~4 B" u% J0 a
WinNT) with the CreateFileA API.
& H0 s6 k. R+ \8 L! z; f; h1 H
/ p' V# }7 j) I- q# a6 H3 E- cHere is a sample (checking for 'SICE'):
& ^9 R3 Y( C* q7 H- i% h8 d
2 p; d" {. ~: W- p/ C& x# @BOOL IsSoftIce95Loaded()" F) U/ q* g. K. G
{0 A5 O6 H, ]8 E# T
   HANDLE hFile;  
  |9 T! y  P2 v6 V& O% H9 {   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,$ |9 Z" X4 f8 \) Q, B4 v" Q
                      FILE_SHARE_READ | FILE_SHARE_WRITE,. e# o. _8 @1 \7 Q
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
8 Q. K6 l- I. Q% A   if( hFile != INVALID_HANDLE_VALUE )( K6 U/ ^3 X9 i5 ]9 b4 f
   {3 N5 y% m) N+ y3 h: b2 g8 q+ i7 Y; @, F
      CloseHandle(hFile);- N# r' ^& S2 y- S/ F' h- @/ ?1 k0 E
      return TRUE;
9 `; X! Y" b; X0 [* ?- L   }
0 {( z& C' e' b7 L( D2 p   return FALSE;
1 R7 y1 f1 ^' U0 {}
1 b; H7 S3 G5 Q# _/ ^
; O4 j! B: j2 T! T* WAlthough this trick calls the CreateFileA function, don't even expect to be
3 ^/ m4 z0 U+ q3 W& dable to intercept it by installing a IFS hook: it will not work, no way!
% a& V( H  J; h0 l8 I) D' @In fact, after the call to CreateFileA it will get through VWIN32 0x001F( ?5 N" U# O$ `& ^/ `/ l2 \
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function): R1 d2 F# L4 G9 K* P/ Y7 s
and then browse the DDB list until it find the VxD and its DDB_Control_Proc
9 Z5 o1 o+ s+ `- ?% W# y3 d  ~field.
9 [, R- W4 o- Y' n0 ZIn fact, its purpose is not to load/unload VxDs but only to send a
2 P1 S6 f/ w8 d! ?W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)
% k! _. {; T4 I' s2 ]9 x* o+ Uto the VxD Control_Dispatch proc (how the hell a shareware soft could try
/ A: l1 w$ F; O0 D; @* `to load/unload a non-dynamically loadable driver such as SoftICE ;-).
, X9 l) j6 _7 ^# B2 m, w! [6 \If the VxD is loaded, it will always clear eax and the Carry flag to allow
5 V: f# w8 d! c: X0 N6 ?: Cits handle to be opened and then, will be detected.
' w' V5 [; s" fYou can check that simply by hooking Winice.exe control proc entry point
+ y" r6 m$ D+ m/ {- Swhile running MeltICE.
% b' q) s+ W: N# ]; o! ^: c! i
+ x9 h$ \5 }/ X4 V' |
& _  W3 `" o7 ?. f3 n5 p; p5 \  00401067:  push      00402025    ; \\.\SICE; ^  q) D5 Y4 T! \/ I
  0040106C:  call      CreateFileA  |3 Q) {: U# n# u; {
  00401071:  cmp       eax,-001
; l" p; H! F5 p3 h& M) y5 O3 ~) Y  00401074:  je        00401091
! ~# W0 z! g; X3 x- ^2 I: K
( h* Y' g6 l3 g- a1 [" r9 I) ?% m$ R# O. u- I; y- V
There could be hundreds of BPX you could use to detect this trick.. a6 @/ i5 A" ^
-The most classical one is:
4 ^+ j1 z1 R# v! Q7 o0 E) p  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||/ a9 ?( Q7 ]* n* N
    *(esp-&gt;4+4)=='NTIC'
+ h: b8 B( m6 k& O
+ M3 C" q( B" P) u8 d+ B-The most exotic ones (could be very slooooow :-(  P4 r: p% o, R4 l6 \
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  " p$ j4 M, h# S5 R' }5 q
     ;will break 3 times :-(
$ z8 m3 o, z% B1 G: e0 G% V1 _0 I2 ]
-or (a bit) faster:
- V( r* X6 I) K! n; A* y+ K' E   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')# P$ X! v6 p6 D% L! l
) [$ b" O" j+ J0 D8 }  Y# d# y. o
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
) s/ f/ k9 T2 p8 B     ;will break 3 times :-(, @6 I, Z% K4 p( _  s& m: w( C

5 B' T; I9 a7 o- q2 C0 T8 C* k' L. i-Much faster:/ X% ~5 r2 @& H7 Y+ b
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
% x1 s& |9 h  x; z8 X8 p- y6 j/ a# H+ G, E4 V. G" f
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen
' D% h, Q8 g$ C5 H9 Ufunction to do the same job:
, \8 j( S$ A* y# p! n! x9 e7 J. V( h$ |; x5 {
   push    00                        ; OF_READ. q, Z" y" c) a
   mov     eax,[00656634]            ; '\\.\SICE',0
1 c, R4 a' p; e7 d   push    eax
: ?1 m; W( x; P# K9 t, Y0 Q% |   call    KERNEL32!_lopen
$ c2 N/ v8 V/ f- X9 f, l) Q, A8 G) M9 j   inc     eax
8 u% b# @& T; w: M" \   jnz     00650589                  ; detected9 u$ c% S, T  w" R
   push    00                        ; OF_READ
0 r: x& n0 S: i! ?   mov     eax,[00656638]            ; '\\.\SICE'
1 v* A  ^. p3 d% n) a# O5 f   push    eax
, h$ ~. T0 B( y  p# w   call    KERNEL32!_lopen
- V, l" P! _. C" d# N   inc     eax! V: Q) B, O5 L3 m% [' A
   jz      006505ae                  ; not detected) [9 r  W; Y* L2 v# l2 _) F+ i

* }% N  l3 W) y
1 @$ n5 G  O! p3 G) m, ?: k__________________________________________________________________________: A+ l9 m. h0 N& R
8 d: [5 v% A; e- p" L1 \
Method 12- s- z( n- d4 U* G5 c2 S
=========
; `1 C: P$ U! |& V6 m3 W( x: ]
: A# A" D- S! RThis trick is similar to int41h/4fh Debugger installation check (code 05. ~9 [9 r! n1 G3 n" _
&amp; 06) but very limited because it's only available for Win95/98 (not NT), c+ D' z/ c" m
as it uses the VxDCall backdoor. This detection was found in Bleem Demo./ e' K; K- d2 c
5 W, |3 N8 O8 x* k: R6 E
   push  0000004fh         ; function 4fh
7 R" s# \7 K2 t( W* H   push  002a002ah         ; high word specifies which VxD (VWIN32)
- C3 U0 _$ D7 o: Q2 a- R$ P) ~5 |: P                           ; low word specifies which service# i; p. Z7 d! n' n
                             (VWIN32_Int41Dispatch)! [3 l: f2 x1 G
   call  Kernel32!ORD_001  ; VxdCall
, D  h& N6 s/ X! Q, B  P+ C+ j   cmp   ax, 0f386h        ; magic number returned by system debuggers
  i& w' a0 W6 L: _( E* ^- v   jz    SoftICE_detected
7 d3 y' ]* W3 H: p0 K# K
4 c0 v% |( y* ^8 ]4 gHere again, several ways to detect it:" i3 h% ^+ t/ u* N
: i  v+ f7 Q2 @1 D3 l# b8 J
    BPINT 41 if ax==4f
8 e8 N! e1 U! v' d6 q; I$ t! o1 I
$ ]+ N* [+ U5 i1 }% k0 I. y5 D8 A    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one7 A, S8 C! f  g' J' p; m+ M

% h3 D/ a9 Q" i+ K% J    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A5 @- ~$ G) b! A( ?- [5 Q

6 v& w* u0 f/ C; O& {' l* r    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!$ C" ?. u6 p0 H
) f9 B" `! v9 J* g& u7 ?7 S, ?( ^, m
__________________________________________________________________________' j! h% l& z. E0 [0 o  }- O
3 N/ U" r; _7 h& o: W, c0 H
Method 13
* f0 A4 l; U* c' g2 y1 z=========
% `. L% ^/ w  P2 Z2 X- B  d) J& G- H% _( k! H- [! Z8 i
Not a real method of detection, but a good way to know if SoftICE is1 {' s: d% ?: x4 S
installed on a computer and to locate its installation directory." c( C7 Q4 Q( g
It is used by few softs which access the following registry keys (usually #2) :
/ G0 j0 }/ k7 s  D! O9 f4 K/ j3 U+ L7 v# h
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion- @0 O3 _1 C* _5 a1 d% P
\Uninstall\SoftICE
' o& h1 J; a- x4 I8 {- b-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE' \) i% D# z6 w4 \* c8 G
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
, n/ k/ \% k8 O5 Z. U8 Y9 A- V\App Paths\Loader32.Exe& J) r3 N; G0 L2 j% x. L
. ^5 S  r( D- C) k* N' B0 h

( W! G4 Q4 _% J7 FNote that some nasty apps could then erase all files from SoftICE directory# y  l8 }- j" {. a- M
(I faced that once :-(
2 n' P7 x  n/ Q& N! d) f1 d/ I( W2 I5 d! ?$ ]% t" {8 K+ |) w' L! s) L7 Y
Useful breakpoint to detect it:5 x% g# Z8 a9 G3 D7 I+ c1 d8 d4 d

: o1 j' [4 z& H* L# J( v0 E     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'" c% ^1 [0 P( g; [* T0 x; n! i4 l5 Y) A

# @% T1 Y; {) V2 R" M9 g& k$ r) A& ~__________________________________________________________________________
5 a6 s/ J$ X/ F5 r- V9 j
' |& m0 E: S2 t. A. M! D
. p  r/ M& ~6 V6 IMethod 14 5 i$ D) M6 R$ _; i: n
=========
" G9 N( l& D+ R+ H' W' s: p% B4 G/ {
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose2 n: `% l+ Y/ o7 j, F( ]
is to determines whether a debugger is running on your system (ring0 only).1 W; L0 p% q1 ?) l/ C! K

# ?8 ]3 {3 T- _8 a5 Q) d   VMMCall Test_Debug_Installed
' b$ E0 e: @0 u   je      not_installed
6 x, s' o3 `; \: _& L2 C4 r
0 z. [) L. {- }This service just checks a flag.
7 |2 e& r2 {$ J$ B& x</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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