About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
& L, S6 p+ [- ~0 J. f* M<TBODY>3 Z( V: M+ c9 t* T1 |( i7 W0 }/ O
<TR>
$ U& V3 S7 i' ~) h9 |<TD><PRE>Method 01
8 X% }% h; j& h=========
+ P2 K9 k8 ]! t& A/ D4 O* U+ [6 C/ s4 A& e$ i0 ]# X5 B
This method of detection of SoftICE (as well as the following one) is
& i1 v9 s" m, k" Cused by the majority of packers/encryptors found on Internet.8 Z) Z; ]  ?! W7 q% o- r
It seeks the signature of BoundsChecker in SoftICE
9 M( G' U1 o8 \; C" T1 F& z' K
5 L) S6 g4 j5 S8 _& M" ?% o    mov     ebp, 04243484Bh        ; 'BCHK'
; w% R( c+ C. a/ M1 e    mov     ax, 04h" R! P- G3 P; p( M9 L6 k5 W
    int     3      
/ @3 P+ a  P6 T! {    cmp     al,4
3 m6 i4 Q# w6 i$ ~) I    jnz     SoftICE_Detected: u# g9 B. G! @# G4 l- \8 a5 V7 @
" e! l5 V! S6 o3 Y, Z( b; Z
___________________________________________________________________________
7 X' b! p, S  f( P1 p
' g' Y" {/ J7 \: ?Method 029 q; g) m. H+ A/ D
=========
: I0 r! C6 {+ ~. |/ \* `# x1 M: i/ O
Still a method very much used (perhaps the most frequent one).  It is used
3 A* ?' K% m- v- Yto get SoftICE 'Back Door commands' which gives infos on Breakpoints,4 @5 `( H; q3 E2 g% H
or execute SoftICE commands...
7 k3 t" b/ a3 H& Z3 v! PIt is also used to crash SoftICE and to force it to execute any commands
. x/ i3 g" P4 ]7 L7 b: ~(HBOOT...) :-((  - F0 t$ D7 V! H8 T$ J7 @
' P; O2 b# R3 e) k/ a& }* R$ T+ [
Here is a quick description:
( T) T4 p- M. Z: a2 O% l/ t-AX = 0910h   (Display string in SIce windows)
' c# P5 N$ M9 n' e1 v-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
3 |% x* z& b3 v+ g# G1 f+ p-AX = 0912h   (Get breakpoint infos)
' F. v  p8 o8 B5 s2 x-AX = 0913h   (Set Sice breakpoints)
& e9 I! K0 p5 [; I- m. O- n" C7 S-AX = 0914h   (Remove SIce breakoints)
) [4 g( F/ f( T) b3 x0 v6 A6 {9 I& T' j: e( S2 Q- r
Each time you'll meet this trick, you'll see:
6 l. ~7 ?2 r4 i& v; W2 v' n-SI = 4647h4 Y; ~7 F0 ^/ x6 b
-DI = 4A4Dh
$ L1 Y( S  p1 h1 W9 _" kWhich are the 'magic values' used by SoftIce.- @$ H9 I6 |1 d. h8 Q4 J6 |. C: \
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.( Z8 K$ x+ M0 m! s, T/ R8 F  W% S
# g5 U# ^! P) l5 r- t" G8 r9 N
Here is one example from the file "Haspinst.exe" which is the dongle HASP
) @% g4 c7 T. _, W- V, i/ x2 @8 UEnvelope utility use to protect DOS applications:
, C( q1 p; ]4 ?0 ?" l
& c2 W" r% _- _
& G( X. U6 }. t; @$ a, R4C19:0095   MOV    AX,0911  ; execute command.( g7 a# J; D2 F$ S1 J" ^$ z) j
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).; D! N, ~7 W: C; L' ], q6 W
4C19:009A   MOV    SI,4647  ; 1st magic value.
1 X/ J9 e- I! u+ s7 C$ W; Y4C19:009D   MOV    DI,4A4D  ; 2nd magic value.7 Y9 K+ \1 j) i( f: P# f6 ]
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
% s3 z* F1 _$ a( m3 x7 G4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute9 ~1 }) M4 i1 j9 ?5 g% ?: P
4C19:00A4   INC    CX: K/ ~+ J: {0 n, @7 w; U
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute' ~7 Y4 p: I6 h
4C19:00A8   JB     0095     ; 6 different commands.% y& N$ A  r$ o# C& c2 @3 ~& _
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
+ B. V3 E8 r  i% {5 d/ s" A: i$ `; ^4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)9 Z+ d- t; Z5 L

$ g2 C. w0 V( c& G- X( ~: a4 G: v' N" QThe program will execute 6 different SIce commands located at ds:dx, which; f3 [' z& |0 G
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
1 z7 {/ A- W+ d0 R5 d2 ?! ?) i+ r' w* E! g% P
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
  L/ |( i" J5 [___________________________________________________________________________
" G4 l( C/ l7 L' ]; n: e  c
$ G' B. u/ o! A, m2 D" m! N) `1 C! ~8 l9 x1 F$ u/ U: V* S2 Z
Method 03
6 F. s" D6 ?# U- f8 w" q=========3 |% y& W3 s9 u7 a6 N& f& E9 o
1 \5 [& D# F  A; u
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
; r9 C( O3 I$ E5 d2 J(API Get entry point)
; S) O0 F7 _" m' L# g0 |        4 M& F8 K! w$ }2 S' \6 H4 }

4 H" A  J5 L9 B0 ~! @    xor     di,di
* S# ~" B5 v6 C& M3 H! u    mov     es,di/ c9 k4 l; a. f. v( }
    mov     ax, 1684h      
5 i) f9 C1 O0 }4 }/ O    mov     bx, 0202h       ; VxD ID of winice3 c- }6 r; V: n% Y6 |" K
    int     2Fh
& l+ y% T4 \3 u8 V. K    mov     ax, es          ; ES:DI -&gt; VxD API entry point
8 n( e8 j, X1 k1 F# x" A    add     ax, di
$ O* p" ?+ x, R/ I    test    ax,ax
7 y! C8 r4 g# D& \    jnz     SoftICE_Detected
5 Z; _7 _- ?! G$ s  G  i
3 n' [7 \5 ?  A# X___________________________________________________________________________
3 L0 U% X) m! Q6 u8 V  [/ j4 L7 \0 K/ m; `2 R$ `7 o1 y
Method 04
- _4 p7 Y1 a: d  @+ O4 S: s=========: m9 l8 g& s$ N. e8 t7 ?. @' ^
6 M; p- M) I; ~" A
Method identical to the preceding one except that it seeks the ID of SoftICE
0 J5 |/ H2 X: H' J8 c$ u0 jGFX VxD.
+ S( M5 Q" E8 ~2 N! E& p
$ u+ m% T4 G$ m" A. c7 Z; o3 E    xor     di,di
& \( [/ q: r" b+ n) y    mov     es,di
) R; Y3 f6 i9 I, C+ T' n    mov     ax, 1684h       5 E; |! R& i- P6 ]0 F
    mov     bx, 7a5Fh       ; VxD ID of SIWVID
' L# q: e' l  `8 {; B4 N6 y    int     2fh
" p3 }/ R6 t/ \. B- S& N, G7 C    mov     ax, es          ; ES:DI -&gt; VxD API entry point
9 S& b$ q: j( F$ T# M! S4 H    add     ax, di
% I) f3 U" I( X    test    ax,ax( y4 r6 ~# E+ y7 q0 d6 X
    jnz     SoftICE_Detected1 }) L0 E  W+ Q- o5 R. L* E% z
/ l* @1 C: P  m" D
__________________________________________________________________________6 L1 @' L! P! b3 i) M
9 X" Z! n/ D7 f) V
1 B; ^; j; d8 k$ ~! j* l
Method 05
6 Y6 h) l( ], _=========
  u* S8 W. K1 {1 f* N" d. ]
$ I0 [7 e, I% PMethod seeking the 'magic number' 0F386h returned (in ax) by all system
) N/ x; _$ j% d6 P: F+ `debugger. It calls the int 41h, function 4Fh.
6 o* ^# W) S' C6 kThere are several alternatives.  
1 T* l0 D/ l5 y3 t' J( z# T" R& s8 p8 @/ z8 _) Q& @* t
The following one is the simplest:9 o$ {" x3 w0 M
4 r; r/ H0 g9 S2 x
    mov     ax,4fh: l: p. o9 h4 F* y' ?" X8 t
    int     41h
* H" z' Y+ U/ `' _7 z, F; R; |    cmp     ax, 0F386
' \; O  {. P7 c! \# z6 h4 T6 x    jz      SoftICE_detected
9 D6 }2 R2 ~9 `% t+ J8 k7 Q' G1 o. g  Q2 V+ _$ l

2 g/ c- O+ t3 Z) wNext method as well as the following one are 2 examples from Stone's ; L0 G' a7 Y% _, s- ?+ H
"stn-wid.zip" (www.cracking.net):4 R3 x: W3 l1 L9 {, h

5 H6 K* B/ E- i5 V& z: W* I    mov     bx, cs
  h1 D  s8 k) V    lea     dx, int41handler2& O) [4 W& w3 Z. t
    xchg    dx, es:[41h*4]) `% d  T* G& Y  ]* ]5 X
    xchg    bx, es:[41h*4+2]+ S$ C7 P' l( K* Z/ _
    mov     ax,4fh
$ F9 K: p" R  U! \( K    int     41h" o2 w9 o* n7 G" G/ O
    xchg    dx, es:[41h*4]
3 c/ J4 _! x. O1 E; n    xchg    bx, es:[41h*4+2]
* ~$ z$ k1 U6 C: P    cmp     ax, 0f386h% _# p( K7 z: E; Z0 a/ {
    jz      SoftICE_detected5 C5 d+ e0 _% U, ~; l

( Q# I$ _# B3 j. q' x/ sint41handler2 PROC
# S+ l, Q5 a9 y# y8 M) m    iret! r& J; k( i) t/ A
int41handler2 ENDP: X4 D. t0 |6 Y% E9 ~  {$ d

. u* d1 _% b+ H8 B- @" [# S% g& q1 |% d) j& t8 s1 a$ m% ^* u
_________________________________________________________________________
6 p  r* \- J* P% W7 m; c- R% a& @. }" \# T4 e. g/ x1 U

0 K4 B5 J" P5 @( t4 {Method 06; x0 G3 D* ~" ^. l' \! H
=========0 g" J  t) Y" ]- F5 m3 r% B1 h' c

1 P( M' {/ `# ]" i' N) @2 @3 i) w/ {) P( o  v6 }7 u6 \8 i
2nd method similar to the preceding one but more difficult to detect:. R' E# P# [  r

; K; t0 m1 p3 x# l, I8 Q  U5 v2 B# Z+ q
int41handler PROC+ z- d9 t; U& d* i1 u7 G
    mov     cl,al2 X7 C; ^5 b+ w6 U- D7 N
    iret
6 _$ l7 ~7 g4 w* E( iint41handler ENDP
  I$ b: M7 X+ A0 t$ @5 P" k! O+ y$ R/ m9 O7 w% O7 i
2 m5 N) \5 n; A
    xor     ax,ax2 P' l( T6 _6 S- l! g& U* [' ?
    mov     es,ax
9 y) V: z4 N. E8 a5 Y( Q' N% R    mov     bx, cs
+ V! R  d3 u9 Y0 O$ Y/ e" V- Z! E    lea     dx, int41handler5 j/ k  s3 W- v3 Z% L$ G
    xchg    dx, es:[41h*4]
. v. c" r) \* G7 x. Q* r" H# |5 o    xchg    bx, es:[41h*4+2]+ |' G. ]( H0 A4 m
    in      al, 40h
4 R- l" \7 t0 @    xor     cx,cx6 l. }9 J5 Q5 o) [1 e
    int     41h
* ?5 i; ~* S1 w3 Z0 O    xchg    dx, es:[41h*4]; n! o6 k! p. Q/ [5 Q
    xchg    bx, es:[41h*4+2]
1 ^8 e2 I& u% G9 N6 N    cmp     cl,al( U% a. u7 @  z. ?0 }
    jnz     SoftICE_detected! A5 L2 {. a3 X" t  O# y* o
5 _& V# c/ v: w- W' W
_________________________________________________________________________' t4 X1 s9 ]7 x( u. {0 c
3 a( |& \$ M4 S0 j9 C
Method 07
" R* @. s2 N+ I8 M; g  s3 x8 L=========3 |, p8 |. g# `4 F7 W9 s. S7 O( h& |

/ e4 G. X+ J# b/ w, bMethod of detection of the WinICE handler in the int68h (V86)/ `1 K8 m  Q4 |) h  q
2 H2 Z( Z2 W: y' y4 W5 L# A; p
    mov     ah,43h
- \; @; x5 T) i- }    int     68h
: _; y) r8 X1 z, H: v" V    cmp     ax,0F386h- w8 w) Z+ u. G: X" ]9 I( ^
    jz      SoftICE_Detected" ^) C8 a- v6 E8 M- Q
* O8 Y+ G1 j3 Z3 n5 ^

( {5 d- {! T5 l6 ~8 v* ?! c=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
! ~8 K* n' W4 R: ?7 d   app like this:$ J) t( N" D/ ]: b  {" w$ P( _/ C

, T# W! R- g) S0 |. n8 ^   BPX exec_int if ax==68) ?, N$ E+ B( U- F; o1 H
   (function called is located at byte ptr [ebp+1Dh] and client eip is
# G; h# V1 \0 ~; b1 J8 Q, s; u   located at [ebp+48h] for 32Bit apps)$ ]4 s) M$ F/ D/ d3 q' D8 r
__________________________________________________________________________
. i, y! p& p/ T! y% P) E' v
4 b4 i! r; P* k) d) T: ]4 Z
* L' v: _7 U- ~) G$ L1 WMethod 08
  C- _. |* r0 e5 D=========
( \! N- ]" g( @2 Y6 ~* O
6 I$ o* N, o1 n( B& W6 s/ {It is not a method of detection of SoftICE but a possibility to crash the
& x5 y9 O! F" ]& Q2 J+ h/ T+ r# k2 Asystem by intercepting int 01h and int 03h and redirecting them to another
7 M, K% Z$ h7 `& A* y7 y; n/ Y# M& `routine.
/ q7 q8 {1 a3 {. u9 |It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
4 C$ A& E/ \9 R- lto the new routine to execute (hangs computer...)
) O$ \- s6 Y5 i3 p9 k
, F6 V5 b. P: L8 V) m    mov     ah, 25h
+ C4 Y; b: z0 s& J    mov     al, Int_Number (01h or 03h)/ n! c# }- D0 o: R) l' u/ E
    mov     dx, offset New_Int_Routine( j  \, C* u) ~- |
    int     21h
  x+ V+ U6 ^$ o- ~1 v3 A1 ?6 X6 d" m
__________________________________________________________________________$ l, s2 h$ B. _# L" N

0 i( B; P$ K- C. S" s' E) sMethod 09+ `, A7 v' o9 {3 r5 q3 m
=========
5 J1 B4 s) L2 V4 i7 `; i% v6 o
- A9 r& V2 H6 l5 c3 E8 ^7 YThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only. p# L4 c7 m; \6 i
performed in ring0 (VxD or a ring3 app using the VxdCall).' w% H2 B* g; A3 _( G& U- A& d
The Get_DDB service is used to determine whether or not a VxD is installed
1 m9 J, n% g( `1 ^6 ^- Ifor the specified device and returns a Device Description Block (in ecx) for2 R6 Y; B* p7 h. a
that device if it is installed.
8 J7 o0 p4 J' F5 {
  O6 j$ ?7 d# g. v; B/ }   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID; X. }& _5 x# P. I3 t' u! L. ]  W
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)3 [1 c, @' J4 }9 s
   VMMCall Get_DDB
; \* Y: S- g5 H  \0 \   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
+ x2 |% d* }+ Y6 h) w2 ~6 v$ X% ~: \/ C( f
Note as well that you can easily detect this method with SoftICE:
5 Y  `6 }5 D; M$ _. z   bpx Get_DDB if ax==0202 || ax==7a5fh
# w# _# `0 _: g  T, W# D- T" I$ i/ r
/ r5 v- e/ H+ n% O" Z6 T; i__________________________________________________________________________
- R* y8 B$ P. m1 c) }; _- _2 B8 a8 @0 d( L6 K7 g
Method 10
( K5 j$ Q# O7 B3 ^# g=========
* R; y+ Y: j4 M* b$ a7 k$ R. O+ b# s
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with6 `7 M3 |% a5 A9 [$ G: I
  SoftICE while the option is enable!!' V5 f/ y" M, g' `
2 Y: a# o0 w; H  ~4 a$ J" i& |
This trick is very efficient:
/ b. u) E; }) y- C- ?/ X4 `by checking the Debug Registers, you can detect if SoftICE is loaded
  u, e  V5 Y' u/ f& `(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if' T6 i. r! a( R, g" Q
there are some memory breakpoints set (dr0 to dr3) simply by reading their$ n! l! V0 d" i8 U3 S% y6 _
value (in ring0 only). Values can be manipulated and or changed as well4 ~: X8 p) i4 z. _- `" S4 P1 j
(clearing BPMs for instance)6 \4 x, P! v6 p. I, i  @/ E
/ w8 ?. k7 U  g
__________________________________________________________________________
. |  K- u4 ]9 [% o6 C1 W! D( _$ u
Method 119 F7 a4 q! ?/ u9 b  ]
=========5 ^, v2 Q: N5 M1 f
  \$ L2 r4 ^, o$ _2 U
This method is most known as 'MeltICE' because it has been freely distributed
1 O+ z6 O; c# o3 ]" m5 Nvia www.winfiles.com. However it was first used by NuMega people to allow+ H! b* l. S2 U
Symbol Loader to check if SoftICE was active or not (the code is located$ @1 g6 ^7 {. C  T
inside nmtrans.dll).
; z2 ^& D0 p8 S* Q3 M
3 m  H' z* q$ BThe way it works is very simple:
+ s: R2 K  x  {! B% J0 ]) `5 eIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for4 T+ u- Z" s- h, j- ~5 M: n" W
WinNT) with the CreateFileA API.. T* C5 f- W" G2 b7 F" \
( y, g! E9 x& K8 ^. Y9 \, S
Here is a sample (checking for 'SICE'):8 W2 |3 O4 }5 a7 ]: [( X8 O

$ b5 g/ O! ^- HBOOL IsSoftIce95Loaded()
  y; m8 o" Y0 r: `: I, X4 o! f{. l% K5 r7 p9 \- C
   HANDLE hFile;  
( I, n5 c; R" H6 t   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
0 |4 f1 O4 A( k) E                      FILE_SHARE_READ | FILE_SHARE_WRITE,/ [; r& R: S, f( {
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);7 c( a2 C1 ]$ s6 P4 }; r
   if( hFile != INVALID_HANDLE_VALUE )
- B1 ]+ S, N8 F& _' L1 K+ R   {+ \% D! Y& q: ~, _( u  j9 |3 @
      CloseHandle(hFile);
8 o% w( I4 g7 q1 j# p' t8 d      return TRUE;' a1 t4 q8 m# I2 M
   }
5 |. H& t" y/ u   return FALSE;
' ]1 }* j, r1 `5 ~5 x}0 u' ?; q, I. Q/ G

  }# X6 q' g, j6 z- u6 T4 _  sAlthough this trick calls the CreateFileA function, don't even expect to be# ^& c* U+ G' Q+ r
able to intercept it by installing a IFS hook: it will not work, no way!
3 r: h; H1 n' l- H% XIn fact, after the call to CreateFileA it will get through VWIN32 0x001F7 r" \) V" e! u9 O$ N) w1 R
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function); S* n, O  E% E+ \: ]2 N
and then browse the DDB list until it find the VxD and its DDB_Control_Proc) t  c  L! K4 R1 I, N7 k( Y2 s8 C
field.4 X, o: U, z7 f0 ?- X
In fact, its purpose is not to load/unload VxDs but only to send a
) K4 l" I+ o, m0 O! `/ J( [' k  bW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE), t/ |8 u1 ~2 t+ x) e
to the VxD Control_Dispatch proc (how the hell a shareware soft could try
, U( n  M' B- Hto load/unload a non-dynamically loadable driver such as SoftICE ;-).
& j) q/ G' z. L7 O  sIf the VxD is loaded, it will always clear eax and the Carry flag to allow$ O6 {6 Q6 B2 h2 v; z+ c) r) W: I
its handle to be opened and then, will be detected.
2 y$ O) C8 {6 k$ u5 T# W$ H1 oYou can check that simply by hooking Winice.exe control proc entry point
1 l' f1 B6 V, B* m6 G# Zwhile running MeltICE." p3 w( g/ T! ^0 _
6 e0 {1 N" J7 A5 F! u7 R

9 B. c) c* o5 P  00401067:  push      00402025    ; \\.\SICE
* f( Y4 N8 W" l! q$ H% C  0040106C:  call      CreateFileA1 H" Y* l# o+ p$ y# p2 G
  00401071:  cmp       eax,-001' W$ l# b* I! W2 Q
  00401074:  je        004010916 a+ p, U$ b2 `6 ~
, j2 V: [8 O5 \- ^/ y: J

( c) ?) f2 b7 ~, f; n2 w1 ]# t# ?There could be hundreds of BPX you could use to detect this trick.
& Z! H9 H0 B( C: o' B$ P-The most classical one is:7 _/ f) e* J2 I4 l9 k: X
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||0 E8 i, F) F$ d: j
    *(esp-&gt;4+4)=='NTIC'
" v7 q: C; @: l' ~% b/ n
- k" P2 o+ Z) g; ~( x-The most exotic ones (could be very slooooow :-(
2 m( F" w; h8 \' h) j; O   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  6 w. }9 A! K+ o2 M) d6 n& H( U  @8 h
     ;will break 3 times :-(
6 @0 |# ~! T; C0 T
5 K4 O0 J9 W+ A: S6 w- w: J7 K-or (a bit) faster:
0 g9 o4 M+ M/ T8 d( t$ Q   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
# @1 @0 E2 `% u$ k$ o4 g- s1 a" D. ]2 z) E* s+ P
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
6 Q5 H2 X% q- r/ w/ Y: i5 O; I     ;will break 3 times :-(
# [2 Z4 z5 A, S: A+ B( z3 Z0 x* b0 o0 q
-Much faster:2 E7 F5 G' p1 H8 \, c8 L7 f
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'- G2 y- T7 {2 M& o: q
% _8 d$ J( r4 ]! ^, Y6 c
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen
/ B, N. s+ f8 w' Bfunction to do the same job:+ P% C2 W% p: D* C. f
  n9 ^0 D3 R1 N6 i) B
   push    00                        ; OF_READ) u& D& I5 k+ g1 d
   mov     eax,[00656634]            ; '\\.\SICE',0
  y. d; h2 t; O/ P- d5 t   push    eax
) @0 J* _- _7 c! W4 Q7 Z% J$ F$ E. Z   call    KERNEL32!_lopen/ f7 U# {! K/ z# s1 d
   inc     eax
% |/ {: i* d" O$ P, e9 Q   jnz     00650589                  ; detected2 }! p, E6 g3 K  Y! f: h
   push    00                        ; OF_READ
# Z5 v$ H; i( w$ {& }" x   mov     eax,[00656638]            ; '\\.\SICE'
, [. {9 q- {( W   push    eax
* F% y7 s8 V' C% H1 N* r7 z, E. A0 Y   call    KERNEL32!_lopen, P5 K% N8 g6 c# t% a- E; M) B
   inc     eax' q7 X* m* `) }) m/ @4 \
   jz      006505ae                  ; not detected
4 P+ Y8 E4 R- p2 z. i
& X1 O7 T& ?4 x' c+ u0 ]; ]: L
; T) _( L5 q8 f# h) X  O__________________________________________________________________________
! N  @5 M) k! A. }2 E, F: Q) G( D* i$ K6 v
Method 12
' e: o% F! C3 q=========6 G8 i2 U9 d$ ^% G0 G5 Y

# ^1 P* m1 |! t  {& p& f& v8 v. OThis trick is similar to int41h/4fh Debugger installation check (code 059 W* h# [* y  x) {# _- u' A; W3 c
&amp; 06) but very limited because it's only available for Win95/98 (not NT)
% U# t8 s3 |) U% u( W9 tas it uses the VxDCall backdoor. This detection was found in Bleem Demo.7 n( x2 E9 g+ _' b1 b/ J; R

) v! L2 H8 t. s   push  0000004fh         ; function 4fh* {$ U2 V& k# E7 q' k  k
   push  002a002ah         ; high word specifies which VxD (VWIN32)( x" W3 t7 u0 z8 B) |7 q# C
                           ; low word specifies which service
' s9 j( N/ x. D* d) r/ b' _                             (VWIN32_Int41Dispatch)
# g2 l7 n3 u4 x  V; y7 h. U5 `" j" s   call  Kernel32!ORD_001  ; VxdCall9 W# v1 E; W0 D" G( N
   cmp   ax, 0f386h        ; magic number returned by system debuggers
4 Y. O3 W; t9 }9 x* e. [   jz    SoftICE_detected
4 Y# ?% i+ h- D7 W3 j$ t2 m" b9 k* q! R, e; k
Here again, several ways to detect it:
7 [! J9 O' P0 Q: s" o4 u1 g2 t- h& s
, R# K5 l: p+ z$ M" g6 R2 Z    BPINT 41 if ax==4f/ a) G3 _  p" L4 i7 m% S$ {
7 p7 v+ V# F$ K& W3 Z8 e
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
9 j/ S. n; W' G% `
; A  @- W" \6 T    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
3 `- W! H6 q& i
9 B$ P- u: F6 D  k* g    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
( e. e% B  a( c3 X6 O* a+ D0 z9 O! G5 D9 l  y4 b
__________________________________________________________________________; R) l8 ?) P' S4 d2 r4 {  Q
1 Q. [3 K; @! e0 T6 L% \+ Z
Method 13
+ i9 n' k8 Y0 i5 F3 z+ g2 h=========
1 r- O6 c3 j" ]0 a( h1 ?
3 B7 r7 D( H4 I% M; U6 G2 iNot a real method of detection, but a good way to know if SoftICE is
$ R3 T+ G- _9 ainstalled on a computer and to locate its installation directory.* A  W# F' s  s2 o# Q
It is used by few softs which access the following registry keys (usually #2) :
$ C8 C3 T1 N: D& q  h4 h0 j4 n$ _
: [# U% D* f2 i8 {-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion  v8 D$ V5 p. t& L# o0 t/ J' _
\Uninstall\SoftICE
2 Z, d) q& ]6 D9 j. i* ^& h-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE6 n- A1 d/ l# k6 P9 ^  i
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion, ^4 w7 h( h# Z8 [$ ]1 b
\App Paths\Loader32.Exe
. I# `! ?2 @0 h: c" R3 k# \3 b7 n% O: x5 `- r. b/ s4 S/ f$ ~
/ x6 s/ |6 m$ G9 Z2 N9 K9 N
Note that some nasty apps could then erase all files from SoftICE directory
( f# ^2 R' r/ p# O: X(I faced that once :-(6 S- y0 V4 R- d# X9 M$ M- x
' Y, K* a5 |) L8 l* Z
Useful breakpoint to detect it:
! t" I2 O2 v% A
( s* I7 l) z1 v6 K7 V! E* ^     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'# W: u8 L4 u# e: W
, Y5 Q  i5 U, B9 O
__________________________________________________________________________1 I% |; G& g3 s$ |; u; t+ ]5 C0 K

+ {# E- f7 K$ g0 _7 `7 r
( g3 O* o8 Y& ]) r( [Method 14 , @; z0 o; o' G/ s0 }# ]" T* k
=========
$ r% Y% j$ b: l2 o2 @
: g  ^# l8 }; {- l& L, P# ?A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose9 k8 B2 c% b, A9 `7 S5 a( p+ E$ D* A
is to determines whether a debugger is running on your system (ring0 only).
: c% R0 c) n7 k# Y) }0 }
  D" k& c, e' `9 S+ i   VMMCall Test_Debug_Installed1 Z. g3 v8 P7 c4 L0 f
   je      not_installed
/ E- J5 p1 I" \' q: n. V2 `3 g% P0 d2 k2 O  J/ [* ~3 v* F5 O' }2 Q
This service just checks a flag.7 A5 V2 \1 ^6 U4 N
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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