About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>3 |( r% a9 k5 q9 a( Q9 ~' i
<TBODY>
. g; u3 X/ V, Z6 k/ c3 Q<TR>
* i6 l" y: Z& h<TD><PRE>Method 01 , [' M# `- `% o0 R+ {) i8 @. u
=========4 n" s; Y9 @/ p" n/ J

" n& k0 m" @* ?2 z  T% Z8 YThis method of detection of SoftICE (as well as the following one) is
! T, x7 ^" v) B+ S- y! eused by the majority of packers/encryptors found on Internet.0 v9 {/ q2 c9 k; p7 {& v* ~6 w
It seeks the signature of BoundsChecker in SoftICE3 [/ W8 a6 [( m; M
/ o; H5 D/ B  U
    mov     ebp, 04243484Bh        ; 'BCHK'
& `' v, K+ G5 ^, \, n7 J1 S    mov     ax, 04h
( T* A3 B: {5 c$ H4 n    int     3       0 W7 v4 E1 C3 n" F  `' J# }3 }
    cmp     al,4" S0 `& F1 r  J* y* S
    jnz     SoftICE_Detected
' J8 K8 \+ n2 x* l7 L( L+ z, s1 ~$ P
___________________________________________________________________________: O* |6 B: G' S  T3 ~6 [. k1 d) _

& O$ I( j+ H2 i3 S8 BMethod 02
# f6 q; _) P8 U6 P/ G' L3 A+ o=========: z  z7 O% \% y+ D3 S( i

- d/ C! Y4 L$ C( I5 @6 yStill a method very much used (perhaps the most frequent one).  It is used9 S/ r3 Z- s5 V" I" q
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,
: }! N4 j! X, ~/ ]" vor execute SoftICE commands...0 F+ i. L, l% |6 I8 k4 A! w
It is also used to crash SoftICE and to force it to execute any commands
. N6 o" i, j5 F  e(HBOOT...) :-((  5 K0 r: k! b9 d
& o! W+ v( n* L: z# Q; j8 R$ `/ u0 `+ ~
Here is a quick description:
* M. v* `' q! x; C7 i( j& e-AX = 0910h   (Display string in SIce windows)
6 [4 r% N  M" y& t-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
$ U9 x, a3 V' x1 q6 k! j# H4 L/ m-AX = 0912h   (Get breakpoint infos); z/ I  r2 V+ u+ B' s  U  g
-AX = 0913h   (Set Sice breakpoints)4 w6 [" I5 Z, g% g0 P
-AX = 0914h   (Remove SIce breakoints)
$ [3 @4 D6 Y" h" J! E) C, X& C% o" u7 s% A& n# A( N
Each time you'll meet this trick, you'll see:
1 w: ^; T( R# C) J& N-SI = 4647h; ~9 ?6 |, V* @. `& L4 r. [
-DI = 4A4Dh# h6 H& K( d2 d* I0 K
Which are the 'magic values' used by SoftIce.9 c% h* U2 \2 c0 V: v* B5 e9 |
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.
! x, z$ A1 w9 q2 }% W+ b# i4 b8 [% p7 c. q9 N2 J
Here is one example from the file "Haspinst.exe" which is the dongle HASP
( }2 Z  j* O# K+ e: JEnvelope utility use to protect DOS applications:
9 M6 o" q4 r7 X9 j
7 q4 K2 B+ P+ Q) v+ V
$ R' P3 |1 _- |6 X) U* G4 |4C19:0095   MOV    AX,0911  ; execute command.& G# M! K) H0 V  ?3 X/ B
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
; T$ }6 f3 u2 s# _8 C% K6 c4C19:009A   MOV    SI,4647  ; 1st magic value.! ?0 q  a' H7 Z9 y5 X
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
6 Q0 k; r; O2 k4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
7 D7 d" D, ~  p4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute' C# E  k0 o! R( `0 F! Y
4C19:00A4   INC    CX
/ h7 f4 r) K. S0 c& ]( ?4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
- W: S9 g4 z( I' `4C19:00A8   JB     0095     ; 6 different commands.
- P% P( z& w1 k/ F. U& Z9 K4C19:00AA   JMP    0002     ; Bad_Guy jmp back.* H0 p* H0 J' `+ y! f; k
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
& O# s" p+ I; m; @( t  ^% u) W9 s. b# _8 s" C7 A+ O9 \* q
The program will execute 6 different SIce commands located at ds:dx, which
$ B7 H8 k& P; r% uare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
! C' q& e, x( {5 x+ p
; x4 M  F$ ~; ^& m5 k, [5 E9 }* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.% k; K3 F, F& g4 P# a$ |8 ^5 Q0 V
___________________________________________________________________________
5 E0 ~' v/ \, @2 D4 r1 K# i& Z( M) p. |& \/ M. I8 s/ j3 X# \

( f- k" v4 f4 P& z! UMethod 03% ~7 m! g6 y  H; C. J
=========! W0 T2 b- {9 w" Y; e% N

% a/ n2 {8 Z3 O, |% m8 @. g- F9 L$ hLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
* J/ z* h- s# ]! [! g; W. T6 D(API Get entry point)
4 N" x; @# C' d% E: b: s7 I$ e" T        
" p* a6 E. ]- w7 T) t; Z- L
8 L& _  C; l, ^% I9 s9 p. Q    xor     di,di
' W8 n9 S  \/ T9 G; n# c    mov     es,di
! \) e+ D: |" l  N4 Q7 p9 k7 b! I    mov     ax, 1684h       ! q; X; ~- x7 x" s$ o
    mov     bx, 0202h       ; VxD ID of winice1 p6 p2 m" x7 @5 |
    int     2Fh
: m% n- T4 y$ h% b! ]    mov     ax, es          ; ES:DI -&gt; VxD API entry point- E% q5 Y6 L' M+ w  W5 G! J9 S
    add     ax, di5 [5 v. Y! [0 E# u
    test    ax,ax1 A- R; C2 r6 }- P3 l3 {
    jnz     SoftICE_Detected
$ F5 k4 V0 N. r" V; l
$ S0 a( Q' n/ l; `# [: ^" f___________________________________________________________________________
7 U2 H/ E: m6 {2 _) U6 [+ t. T- y+ X6 Q5 r
Method 040 d  ]0 m4 j3 {
=========6 b3 w( _# j& X

6 O: P3 j8 [% |7 X; cMethod identical to the preceding one except that it seeks the ID of SoftICE+ Y; R9 U& c. S  L2 g' p) e: z
GFX VxD.: W5 w$ Z% m' G" Q  R- [! x8 Q
  l9 Y( o/ G9 L, m) |
    xor     di,di. `2 `/ X( @: D) ^7 T$ U
    mov     es,di. `: X6 X  \" m# F3 p2 q
    mov     ax, 1684h      
: s# v+ |0 `- }/ G( N2 H, t, [( H9 W    mov     bx, 7a5Fh       ; VxD ID of SIWVID
0 j: Q( H  ]. t  w+ n* Q9 _    int     2fh5 E; B4 P0 S$ ^& X! n6 I4 k; }
    mov     ax, es          ; ES:DI -&gt; VxD API entry point7 M( Z6 T0 R: @$ v) Y& \- C5 D
    add     ax, di
6 |! _; T# X& h, C    test    ax,ax( a& N  U! m# M2 @* X0 X
    jnz     SoftICE_Detected" q, Y) i5 ~, z$ C. r5 ?
( Q% S( ]  L; [5 Z% n
__________________________________________________________________________
% @; Q; o: s. R, D( W2 h
6 O2 n8 I" `+ M' X
( o7 L1 g) q6 _* p0 X) p* AMethod 056 V2 |( A9 b/ {% i( C$ f
=========$ R1 F) ~+ t4 j5 i! L# c& q2 W
/ ~+ u  z  k$ s3 y1 r+ U
Method seeking the 'magic number' 0F386h returned (in ax) by all system5 ~7 J# ^  I3 ^2 x7 p! V% S
debugger. It calls the int 41h, function 4Fh.
; R7 u& m' f: r+ R6 ^There are several alternatives.  , ?5 D" \+ X; ^

/ o1 d& w$ n8 Z' vThe following one is the simplest:5 m* x7 T& ~* U5 J6 E
& X" F7 Q. X- i
    mov     ax,4fh
4 Y7 B- K6 ^# H" I" |# U4 F1 n    int     41h: t, j: G- l* l
    cmp     ax, 0F386
  z, ?1 P2 o6 T% d0 o3 v/ k    jz      SoftICE_detected/ h: Y0 C; {2 R" A# k

- M$ g; x4 v) [$ x" E& p8 q0 r- T1 q) s
Next method as well as the following one are 2 examples from Stone's
9 D7 F" j. f4 V4 \& N2 P' Q$ j"stn-wid.zip" (www.cracking.net):5 Z5 b, `5 J9 V9 Q' Y+ c8 m4 ~
2 H% G( \4 }6 M# `
    mov     bx, cs
8 @6 U  r  }) @4 g9 s    lea     dx, int41handler21 O" y! U; D+ j& X
    xchg    dx, es:[41h*4]  R9 K6 J- M) T1 t; S5 o: W: {
    xchg    bx, es:[41h*4+2]
' A+ Q0 v  X" i0 n0 i    mov     ax,4fh0 |9 l( Z0 w0 O$ w( r" h
    int     41h
) W8 W6 C4 q8 ^    xchg    dx, es:[41h*4]
8 N. F2 M# q" Z    xchg    bx, es:[41h*4+2]
0 r6 Y1 O* d  h6 k: {" X: I- h/ @9 R    cmp     ax, 0f386h
6 ?0 j' Q" w- r( \    jz      SoftICE_detected
& E" M! N7 j& l+ |0 Z. Z1 ]! r, Q; {: ~& j. Q+ z$ f6 i# y+ J
int41handler2 PROC
0 a5 R$ M' G( {, E6 h    iret
5 K; v- z2 u) G" r% K  nint41handler2 ENDP$ G! Z1 w9 u6 I

: z! A! \, ?2 ]; l7 u& C# P6 y3 i8 }
_________________________________________________________________________0 R* B" h  H9 w0 J

- J9 }1 j) i7 ^3 \8 d- O
. p$ ]& S% r5 C% NMethod 06, Z2 _. N: _6 I2 @! \
=========
6 A* ~) D' C! c; f; W, k
- g0 G% G3 V7 P* _- Y# A+ F9 w: X6 ~( T1 r! i
2nd method similar to the preceding one but more difficult to detect:
/ s6 y5 Q) }2 D3 ]
2 {2 a2 p, \/ X6 ^3 q+ F9 b( K
: W& E3 Y* w  Lint41handler PROC
2 V( w+ n$ Y, k$ i    mov     cl,al6 l# m: S$ ?0 I8 g
    iret  b* c% N# o- l: @" Y! {
int41handler ENDP
0 h: O6 E6 I2 G; h
( u4 ]$ w& k. Q0 E; Y# Y7 x2 u, d2 |# y- q' m  ~6 ?: h! a
    xor     ax,ax
2 b, `1 ?& Y; W3 ]1 w2 o$ l+ y9 {    mov     es,ax( l  q1 m* p+ I/ a
    mov     bx, cs+ l! _( _& w+ `' x2 O0 e
    lea     dx, int41handler
6 J( `' b! W- g3 v9 p" i    xchg    dx, es:[41h*4]
  s% W1 B1 w+ I8 j6 {: o0 E    xchg    bx, es:[41h*4+2]6 d- y! A4 N" F4 j" V/ b7 q
    in      al, 40h0 g/ u: |% Q* P/ Q9 b) r. Q
    xor     cx,cx
: s: X8 ~$ M: x3 |# b9 I" T/ `, k    int     41h
) t6 I5 ~  o5 h    xchg    dx, es:[41h*4]" q" p. L; i* Z8 w7 Z
    xchg    bx, es:[41h*4+2]4 r5 `* i* O: T- K
    cmp     cl,al$ T9 M* h4 X' A5 ~" }/ F2 J
    jnz     SoftICE_detected
1 f8 [* ?+ |! n0 X$ k: y, i% P# i/ {7 e8 Z+ t
_________________________________________________________________________
' f' ^& D$ V4 j6 B, N) N, \6 |! O& D7 D
Method 07
9 r3 m' ~; p5 I/ g=========+ {% R- M$ p9 t5 ]. A4 i
6 h) r5 `) v% h4 i/ N# L
Method of detection of the WinICE handler in the int68h (V86)0 V, l% s4 P& F: a1 v
1 _% g; I1 d/ o' t
    mov     ah,43h
8 q  I  u% Z7 v  [" ?0 h: \/ {, x    int     68h; Q$ A4 N7 Z9 h! F
    cmp     ax,0F386h- a1 V4 t) }$ w" I- Y
    jz      SoftICE_Detected
1 w3 g( w% ~6 c) R4 I* q& E, X; V$ R/ z/ V3 p& Y% j! `, Q. ^

% r  Q9 T+ z) ]( ]) n=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit& ]2 f' b# W9 f0 R
   app like this:+ [3 A& Z* L3 T1 }4 p
5 {* o6 R/ C" O% P# G# D2 ?! S. M
   BPX exec_int if ax==688 ]2 Q9 p  c) ]& H$ U3 [* b
   (function called is located at byte ptr [ebp+1Dh] and client eip is
) h3 @& J; X5 {3 b8 a+ U" f3 a   located at [ebp+48h] for 32Bit apps)
% _4 o. F' Q3 n9 n1 T3 \' g__________________________________________________________________________! [  Y# I  u% s2 e, }- C. i, c
: ^/ M- Y) w' Q: ~. C8 v" c! W

% _" ^# G2 d; O0 N+ U  EMethod 081 M0 ~  i0 F7 D' m# ]6 {8 u5 _
=========
8 C0 ?% t, j- I. z. i9 O) ~" A
+ ?5 x* E, P: Q$ Z+ {: y+ ]& ?It is not a method of detection of SoftICE but a possibility to crash the
$ u# g! _% ^( y" F/ ^7 k# f+ e' Bsystem by intercepting int 01h and int 03h and redirecting them to another3 W8 y! Y! B" V
routine.
+ W1 I( `& }3 `' p2 a; sIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points( `& N8 [1 U5 W% C4 a6 E
to the new routine to execute (hangs computer...)
. B. {) U3 y' `* ~- q" O8 K# n
    mov     ah, 25h( _2 h& h( m: U8 E
    mov     al, Int_Number (01h or 03h)
- O' D! X7 n/ c2 M- `0 i" R    mov     dx, offset New_Int_Routine
4 n. C4 f2 T: T3 D. g) Z8 E    int     21h$ Q  o: S. i/ ?) B. Z. ^
7 J; w. I: o; v% ^
__________________________________________________________________________0 Q$ Y1 ?; R! H) E5 I6 i

' Y" a3 Q  G9 v, S  qMethod 09$ K! t6 W1 O* q( c6 c
=========
8 N) ~! O% \. X4 b
& r: @" I; U% g( H4 s4 i3 l3 P1 ~This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
2 l0 @; H! J# {performed in ring0 (VxD or a ring3 app using the VxdCall).# F5 l8 i  _6 N' f$ Z1 p2 N2 {- j" I
The Get_DDB service is used to determine whether or not a VxD is installed+ W; I5 c  N/ Y( O7 ?$ m
for the specified device and returns a Device Description Block (in ecx) for
' D+ ^7 V, u3 W  L, U! ythat device if it is installed.& y. Z( L0 s( H& m  X# N

; @" |% ^' w/ B! @   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID, Q5 i7 j& D( b0 M
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-), N. F: Q+ }" I3 ^4 r  m+ I
   VMMCall Get_DDB; z  }7 }* ~2 p; X
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed: F8 Q) {0 e0 P3 U/ j
* |* I+ |# I3 w* o; u3 ]; u; j; u) z% @
Note as well that you can easily detect this method with SoftICE:% J8 T8 r# r7 [6 s! R
   bpx Get_DDB if ax==0202 || ax==7a5fh
3 G! h+ G! _( L9 f4 l) m$ O
1 Y. d- }1 G) T* L6 z- W; Z__________________________________________________________________________
/ ?; r5 r7 J; l; \& L" ^  [
2 k! L, O2 V0 l, n1 o% f% O) S1 r9 iMethod 10
' m8 E* i7 H: Z=========( G1 ?! |$ i' W
% v' ?. U8 p# ?* H- Q
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
$ E( {3 A" F! ~  G$ f6 @  SoftICE while the option is enable!!
! Z) V( v3 A- M; {& L* G( \$ j
, o' J, W% x/ f% D% CThis trick is very efficient:
, N' d: N) v1 I) j* V! R, N1 U% aby checking the Debug Registers, you can detect if SoftICE is loaded
9 L, _$ B6 D# w$ W" M7 P) q(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if7 _3 z6 s7 B4 x2 x$ \$ o- ?% @8 b# V
there are some memory breakpoints set (dr0 to dr3) simply by reading their& p4 _; E; V5 }) y$ A5 |
value (in ring0 only). Values can be manipulated and or changed as well% L' p2 U2 q; {  v# `, L
(clearing BPMs for instance)
+ D2 t) |3 I" z* V$ |; Z2 K+ u4 r0 [9 g# j
__________________________________________________________________________
5 `' \5 g5 J/ U( P5 [+ f. i3 O4 l. n) K2 s4 r0 f
Method 11
) r' N9 d( `1 W) ?. v=========1 s0 r5 D; [- b9 \% T9 e
9 q$ M1 M! M7 j. s
This method is most known as 'MeltICE' because it has been freely distributed8 m+ ~" j% O+ z' U- ^1 w" k1 h
via www.winfiles.com. However it was first used by NuMega people to allow' e' I; A  l8 X
Symbol Loader to check if SoftICE was active or not (the code is located5 l' X- \) V( s1 O
inside nmtrans.dll).
6 m1 t8 p! n% s
# D) C. A' D6 @* X1 l; Z4 A, ~The way it works is very simple:
* @7 U5 a) f" ~/ A3 RIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
& C/ h1 i8 x% @WinNT) with the CreateFileA API.
& D9 Y* O1 l5 n' S' o
* a- z5 D8 l* G0 oHere is a sample (checking for 'SICE'):- I1 U( ?9 O# c5 T
' ]5 [* K* S# h
BOOL IsSoftIce95Loaded(); V3 T* Y! u* v$ |  y
{
$ f! j1 Q, N) |% s   HANDLE hFile;  
9 n0 B+ W& \: y+ p0 Z! D) H   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,5 {* `" w8 N. f6 H+ [) e. M  J5 O
                      FILE_SHARE_READ | FILE_SHARE_WRITE,) P. e% g" p0 G) l& T1 I# D3 }
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
: O. f% P7 m8 A1 b   if( hFile != INVALID_HANDLE_VALUE )
8 J9 t5 {. ^& l5 l, _7 h   {
7 u( ^2 u7 p  J      CloseHandle(hFile);" T; P7 U, E/ \$ n2 Z. j
      return TRUE;
/ A* k  x2 `! I3 H: C4 M. }   }8 J9 t' K3 |5 h$ F" t* s
   return FALSE;# _0 X2 m4 u. c/ k) q% V% t6 b
}6 m) K9 a7 ]) |+ `  Z+ Q3 s

6 s4 |1 s2 J/ V$ F" z2 g2 h8 b4 PAlthough this trick calls the CreateFileA function, don't even expect to be
0 `4 a  t  `3 s: @6 j' y1 m) uable to intercept it by installing a IFS hook: it will not work, no way!; \$ a/ t6 \& b$ Y& ]3 A0 i% S
In fact, after the call to CreateFileA it will get through VWIN32 0x001F
, \- w3 O( A% ?4 h0 O! {, iservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)5 ~6 D+ `3 X" ?) |
and then browse the DDB list until it find the VxD and its DDB_Control_Proc+ o- M" O  ]5 e+ g. h5 W! \! C
field.
) e3 {  t) [% i/ OIn fact, its purpose is not to load/unload VxDs but only to send a
7 T9 g+ t$ N0 j1 b. Y) `1 L) vW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)7 w8 x6 K8 W: m( _
to the VxD Control_Dispatch proc (how the hell a shareware soft could try1 n0 }5 c" s+ i
to load/unload a non-dynamically loadable driver such as SoftICE ;-).# k2 R# c  Q8 Q+ s
If the VxD is loaded, it will always clear eax and the Carry flag to allow
( t1 c9 _# N0 u% Aits handle to be opened and then, will be detected.4 G) s0 |# N5 N" d
You can check that simply by hooking Winice.exe control proc entry point
, v; F* v6 _8 S( J# J4 owhile running MeltICE.5 V0 D2 i; V) A/ F
/ C7 W8 X' ]( v6 C) R; g
9 m) T# {3 a2 |; K% `$ b
  00401067:  push      00402025    ; \\.\SICE2 l" T7 w) {' P
  0040106C:  call      CreateFileA
9 j; t: E% `. z7 E( e; f, N  00401071:  cmp       eax,-001
( h! A8 L) D9 m$ W- i, @% B) l8 K  00401074:  je        00401091  q2 x3 A( q( z# w

9 n  {: o% n5 C5 f  g
  d& K7 D. r5 C5 {There could be hundreds of BPX you could use to detect this trick., p2 n+ c; ?$ L1 N  Z' [# e
-The most classical one is:
" K* d0 [) E7 P9 c5 h4 @: }. K' w+ n2 O' s  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
7 l8 q2 g6 a, E8 X6 S$ q8 a7 u    *(esp-&gt;4+4)=='NTIC'
+ {" x# T' n5 F) i5 s6 I4 _4 R3 \+ h. z
-The most exotic ones (could be very slooooow :-(
9 v. C/ |& J4 I2 b5 y! I8 J   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  6 T: E9 {" H6 o4 l
     ;will break 3 times :-(9 @! S5 a+ \6 W- U% K+ \3 |
. S- z  S: \, V8 i0 L) ?
-or (a bit) faster: 9 A! s" E3 u- I! c
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV'), l, R& q- e% N5 r1 l
$ {2 D6 G; k8 K7 U2 b. E5 h
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  ! F: b0 ~( g$ {; ?
     ;will break 3 times :-(
0 k+ O" f7 D, A& x" n$ {2 u
( ~6 I; R- f4 @; i-Much faster:
  q7 @3 h1 e. g   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'( r0 b3 o' z5 D0 B( m: [

, t( l) r4 @# E" hNote also that some programs (like AZPR3.00) use de old 16-bit _lopen
9 v! D) Q$ @( v- u7 Z5 ?0 wfunction to do the same job:
. G' N9 z9 o  m' |- V% R( E: b
: v0 ], v' W2 [+ y& c( u   push    00                        ; OF_READ  [. d9 r! Z7 V( H/ e
   mov     eax,[00656634]            ; '\\.\SICE',06 _9 {, ?* D( E" K/ h" o; k, B6 d6 e
   push    eax5 t- w8 E  e0 d( }
   call    KERNEL32!_lopen
0 B8 R% U" i% |9 K" S! c5 k   inc     eax
5 S* |4 O5 I: Y* x1 B/ B   jnz     00650589                  ; detected& P  \) M5 x. U. l
   push    00                        ; OF_READ/ l( ^' J# `* U( F
   mov     eax,[00656638]            ; '\\.\SICE'9 @4 l! L8 Q. |5 J8 b3 `) _. z
   push    eax9 ]# {! D! W( o! _  P* e3 w7 r* {# H
   call    KERNEL32!_lopen  y' U; J+ p: r4 o
   inc     eax
* `! G' s4 U& l, E2 `* T' U   jz      006505ae                  ; not detected( b" p% N, C% Z, I  l) c

; j8 k: F9 S9 W2 s, B* ~. I) D/ W4 e2 T
__________________________________________________________________________
+ D. C+ K  b9 l2 |! Q- O+ l  u# z+ \6 W' |8 L4 k' c
Method 12  ~& i- C! }( J8 e( B
=========
+ @1 @' w. u& u8 L" W1 S- f( Z1 K- Y8 r2 E/ ~2 T
This trick is similar to int41h/4fh Debugger installation check (code 050 D0 v$ V; P, R' G# ]
&amp; 06) but very limited because it's only available for Win95/98 (not NT)4 d8 q( |9 A! s6 K9 Y4 n
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.; Z  [9 W; @5 u# t$ V3 U
, r& R6 c  F; l; V+ y
   push  0000004fh         ; function 4fh
8 a' K, a9 I3 G+ L/ S* W8 J1 G   push  002a002ah         ; high word specifies which VxD (VWIN32)$ [& i' |( R" s0 S# }& m; o
                           ; low word specifies which service" V. t% w0 @  {. j) t
                             (VWIN32_Int41Dispatch): p  P2 z5 ^5 `% D& q# X( o
   call  Kernel32!ORD_001  ; VxdCall
, l( ~* D5 s' @8 x7 J. w   cmp   ax, 0f386h        ; magic number returned by system debuggers
4 ]( F+ a7 V. q" g& E   jz    SoftICE_detected
; p3 S; X4 q4 @3 O8 Y$ u8 c1 b: v6 H
Here again, several ways to detect it:
$ P% w  N. b, E9 h& O  t- N1 E' m
! G4 _5 {; L4 S2 ~8 g9 X    BPINT 41 if ax==4f6 Q5 r" W: [6 N2 s. J  X8 S
( J* J( i) h1 {2 b2 G2 ?
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
) `( U1 t- |1 W( R( t8 p! ]1 H- ?3 B
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A, s: k9 C8 q1 a0 g" x! C
( q, k3 L- w/ |4 J2 f4 y6 h
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
" n- F# p1 Z8 j' s( g! }: E8 a+ o+ U" b0 v
__________________________________________________________________________
0 x" i, V0 u7 j) b4 y% h1 ]5 v
/ r; y( Z- Z$ B) Q0 y2 \Method 13
! m$ f; D1 W  w! i% s& E% _6 C=========2 J# d# B$ Z6 W" c/ q0 Q

; a7 x) a3 v" H8 }0 o& h; O2 ~/ lNot a real method of detection, but a good way to know if SoftICE is! ^/ P& k, t, [8 W/ a9 r& Y' t
installed on a computer and to locate its installation directory.
2 W3 s1 B# W" z, N4 d0 zIt is used by few softs which access the following registry keys (usually #2) :
/ u7 H; u; ~' [8 w$ k+ {% K/ ?& M" o) j' R( G# p
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
) n9 P1 O- D# m7 U3 h% }\Uninstall\SoftICE
' c) w! Y" ^2 V0 H+ {-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE- m3 w, d6 Q/ K. w0 v
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
* R$ B6 m( Y0 ]6 J/ V\App Paths\Loader32.Exe4 k, B% U7 I1 B) P- H) N
) K. g/ A, u& R! k$ k  g* r, e- D

. w  g4 t( @$ y& @% TNote that some nasty apps could then erase all files from SoftICE directory$ Y+ p' D4 f0 `" p& w' r3 w
(I faced that once :-(  j- j7 j( s& |1 ]

- L0 ]' T8 _( K& f' cUseful breakpoint to detect it:
4 C/ k9 r  k3 Z0 v- o: f4 A
) t% O: s: x8 u     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
: V2 ]  @8 o. [8 {" s4 N0 I9 }, ^- z3 T
__________________________________________________________________________
# K& Q2 d+ Z$ Y6 Q; n8 B8 V+ I7 @2 G) s* _* U  Q# g; Y5 K

( I  p) L& r& T$ }) j: K  X( b$ {Method 14
3 H- r5 \4 k/ F=========
* O# a, d9 n& j9 m: ~0 J% L3 A5 ?( v( T/ \
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
7 `$ I, d3 U6 W$ M- N; ], E5 jis to determines whether a debugger is running on your system (ring0 only).
$ C" R3 v$ A0 g1 F1 D; G$ ]& p
3 _- ~8 _7 v$ G; t5 L   VMMCall Test_Debug_Installed
* M' k% a" l3 E% W0 D   je      not_installed
. }, K& M- T6 M5 X7 M5 O9 u1 n: ]+ q, K/ \" v  O
This service just checks a flag.$ ~( [) G+ t! q* y1 z
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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