About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
$ m1 O3 l, V* V<TBODY>  A. a3 \0 ?0 _! z  g7 `+ z: ~
<TR>; C( a7 ^' \7 L: L
<TD><PRE>Method 01 3 X  j  A" o6 P: @; Y
=========
/ c* h! O5 H3 z! E) H9 O/ b9 V7 B% ^  f% x7 F' a4 j; U
This method of detection of SoftICE (as well as the following one) is- Y9 @' o+ I/ g' n- p5 Y
used by the majority of packers/encryptors found on Internet.
1 h8 H  Z8 T& X" R- oIt seeks the signature of BoundsChecker in SoftICE# g; n3 s& z# X4 g
7 ?- j) j! }# ?3 U6 y# \8 _' g
    mov     ebp, 04243484Bh        ; 'BCHK'
2 n8 |& r+ L9 b4 j3 H1 Y: U) Y    mov     ax, 04h( \( R6 z/ I- a1 |  t$ h& n
    int     3       * m! e+ ?4 k8 D$ K
    cmp     al,4/ b, R0 \" P" h, w. A0 L+ D
    jnz     SoftICE_Detected9 Z6 Y* J9 q$ A6 @

* R; b1 S) o# L  e( g+ g6 Y; \" N/ \/ r___________________________________________________________________________
& Y* j# U" R# s* p  i  L* `
$ u; q) l% C  n9 _3 t2 DMethod 02
5 Z7 l4 b1 X% e/ R=========
, B+ H( N* C7 }* C( ~5 X/ s4 U4 k) Q& F& x3 f9 h2 H
Still a method very much used (perhaps the most frequent one).  It is used
8 c) a7 r3 m) Dto get SoftICE 'Back Door commands' which gives infos on Breakpoints,
5 q2 D0 x! x' U  m5 X* m* T2 kor execute SoftICE commands...2 k9 v8 R& w, ~! ~6 \* H2 W
It is also used to crash SoftICE and to force it to execute any commands$ C* a5 n, {5 C* A+ V0 a! G" p
(HBOOT...) :-((  
7 p. T/ b1 F) H! u" x7 T$ w9 ]6 C( N3 C# j
Here is a quick description:
4 I2 Z# d7 ]' }1 Q  e) e-AX = 0910h   (Display string in SIce windows)6 b( p+ I* |1 G4 ~3 c
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)* F9 d8 e- w# h. x2 s
-AX = 0912h   (Get breakpoint infos)% h3 o/ q: Z. r4 _- o- l
-AX = 0913h   (Set Sice breakpoints)2 P+ Z& N$ U& V/ C5 M  n
-AX = 0914h   (Remove SIce breakoints)" I8 U8 v# n. U* f  r4 p

8 ]! d# s( D$ ^: e9 g* h4 \* s6 n6 LEach time you'll meet this trick, you'll see:& X, Y0 r9 N7 l
-SI = 4647h
" }( G6 {8 }' s% {! `# T2 R9 F-DI = 4A4Dh5 f( W2 @: Z, R9 U' d0 F
Which are the 'magic values' used by SoftIce.. ?' R! L: T2 b' n5 r
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.; D* H) D8 |9 E) q4 _# w' N  M+ `
1 c2 {1 `# z5 O% S! S% {' Q, N/ s! s7 u
Here is one example from the file "Haspinst.exe" which is the dongle HASP
, E  O3 H  n3 i1 L; e# p, [4 w7 ^$ @Envelope utility use to protect DOS applications:
$ {6 a/ J4 w2 [! i; ?
5 t. X; y  N2 F- q  C- T" y8 N# r) L6 r" _
4C19:0095   MOV    AX,0911  ; execute command.
5 N4 F" f' G; S* D4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
9 M5 _0 C, h# S, X9 z; m: o: l+ I4C19:009A   MOV    SI,4647  ; 1st magic value.
7 Q  v* T; p# Y# k6 Y9 F4C19:009D   MOV    DI,4A4D  ; 2nd magic value.. k3 C3 c" k' m
4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)) C" Z" J  v& b* X) B1 J/ u
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
5 K& q0 _# Q; ]# w( q. l4C19:00A4   INC    CX
. v4 v; u/ k, ?5 C8 v2 _/ B4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute2 V; l5 o5 X3 Y
4C19:00A8   JB     0095     ; 6 different commands.
6 A8 O7 c2 R, b' z4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
) b0 M9 ~) y+ P; i5 p; L4 w4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)0 I7 `6 @/ @" O9 Q

' b' C" I/ j, k3 qThe program will execute 6 different SIce commands located at ds:dx, which
8 p1 H2 o7 m* J5 Hare: LDT, IDT, GDT, TSS, RS, and ...HBOOT.6 v# g  j/ A8 |
# V2 L) m* }9 I5 S
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
6 V  E" u4 z9 X% f___________________________________________________________________________
. _/ L& ^, i, ]( u) b$ l3 J4 M( Q5 U8 M. `' H1 ?

5 M- ^& ^' r% V( AMethod 03& W" N# e# r7 z. w0 c5 g
=========3 {- k& {# N# H0 o

) y2 Y  f% k+ OLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
7 Y2 k9 ~5 u# ]* ~3 j(API Get entry point)
& s% j4 ?  |. C0 P" V$ B0 D        
3 x) [# D! P7 {7 i
% U( ]8 s, Y, H! x: y    xor     di,di* k6 J2 q; S% \! Y0 \" k+ c
    mov     es,di
, g4 w3 ~$ t4 D! x$ g+ C$ z3 d    mov     ax, 1684h       2 K6 t1 o4 I& |4 y
    mov     bx, 0202h       ; VxD ID of winice3 Y1 W9 O0 r" x" j- {! ^- K* ]1 Q
    int     2Fh
) D+ Q5 i# L; f    mov     ax, es          ; ES:DI -&gt; VxD API entry point& r" @! i1 t0 L) j
    add     ax, di. A- ]0 n/ g, Y8 A
    test    ax,ax
+ A% N. }* k+ H8 H% A% Z5 n    jnz     SoftICE_Detected
% ~* ?9 A# P9 _$ k( M" ^; w, m: B7 t! F0 C! n" Y3 r( N
___________________________________________________________________________
2 c& d4 X9 I8 R' m5 L; f5 b0 l& x
+ R5 d9 J- D  U; AMethod 042 x3 z8 l' C0 z' ~6 n: {% A
=========" T7 ~" \$ E6 F, p6 w8 l& q

6 I4 \! M2 q6 _  ^; AMethod identical to the preceding one except that it seeks the ID of SoftICE& F1 b9 c' m; J4 r4 J* K# B# i
GFX VxD.% G. r* z! c7 f

# S5 p8 X' O/ q2 w. Y    xor     di,di
9 |/ D$ X- T; h% ?# t    mov     es,di
/ ~+ [8 ~/ l9 a% ?# h2 f    mov     ax, 1684h       7 T! }6 W8 j% R+ F* |
    mov     bx, 7a5Fh       ; VxD ID of SIWVID) p! z# S8 Y2 ]3 t7 F
    int     2fh
5 a: A0 G5 y/ h9 W& B( X* o" x    mov     ax, es          ; ES:DI -&gt; VxD API entry point
7 B( q' o7 J  h    add     ax, di$ K4 `& k8 v* y  r; `# _7 }
    test    ax,ax$ r9 Q, B/ r7 D5 u6 Z
    jnz     SoftICE_Detected
' s9 Q; d* B) C% }: m
6 w7 L) g  c6 ]+ e__________________________________________________________________________
; K, H+ |2 ]2 l% F
& [# L: e; n) t  P% M
4 L, ?5 k, W& o6 WMethod 05- Y: P7 B% V& [& o7 W9 K- @
=========# Z, \9 l. d5 x* I& }6 f
" H6 A% N- E* y6 c, r1 F
Method seeking the 'magic number' 0F386h returned (in ax) by all system
2 B7 |9 t6 R5 H* I8 M+ ?" K2 Tdebugger. It calls the int 41h, function 4Fh.0 u: T5 I6 c9 c$ L; J& p
There are several alternatives.  
* L% g+ G3 Y4 d) u: Q# E/ N- h: V- ]0 {- \2 f* \
The following one is the simplest:
* x% }$ e- o! ]1 y% {7 F. \; d" h: r% G: \# k  J- V! l/ _5 N
    mov     ax,4fh0 V0 g& M6 l; w" l' d( c5 ?
    int     41h1 a4 J9 O# f8 y$ o8 V% x
    cmp     ax, 0F386
9 b) ?' }) m8 f$ l) o& B    jz      SoftICE_detected1 ^0 p+ U9 Q: h2 j, m
. t; |& m+ ]4 R( }

3 g* U7 Z% v5 o8 y7 V- [Next method as well as the following one are 2 examples from Stone's ) b/ _& n% U) o9 G  b1 l8 e
"stn-wid.zip" (www.cracking.net):. M% N$ {; K! l, C
* F3 `7 g! j# j$ P
    mov     bx, cs1 a/ b  S" `4 _8 u* I+ p+ D
    lea     dx, int41handler2- j# t. \) G2 x8 {
    xchg    dx, es:[41h*4]% n' W- M# _$ z% D0 i
    xchg    bx, es:[41h*4+2]
+ g. r7 ^- q0 u$ ]; c    mov     ax,4fh* J6 i9 N0 r* k
    int     41h
. ^. T0 }9 r6 g& J7 o    xchg    dx, es:[41h*4]0 ?! x7 l. f7 T2 T
    xchg    bx, es:[41h*4+2]
, V& N3 Z) h' U    cmp     ax, 0f386h
! c/ E2 e% p2 w% ~8 \1 D! I    jz      SoftICE_detected4 o7 _3 Z0 J) E$ K. H

' ?9 w- m5 R! [2 _; P! ?2 Pint41handler2 PROC1 O  P8 c/ \' C/ n
    iret% A, M4 _. T' |7 l9 u
int41handler2 ENDP
  p' D, V3 h& w# T6 G% X! m$ e
- t' q) w, z& i8 N) g& K
* x, T/ ?5 ?* T+ G8 j: ^_________________________________________________________________________# P8 F3 N* Y2 @/ b0 X( D3 {

! |+ Q2 Z3 ]$ \! {; `' B9 |2 `- ^" H- U7 i1 u+ w5 p2 f
Method 06
) f6 R+ E' ~# C=========
/ ]9 I7 d4 D9 w. D. e5 w
  p# |% C: P  p& M  y/ S$ u* L6 p  c. z0 a) W$ H
2nd method similar to the preceding one but more difficult to detect:
) J7 Q; Z* E/ M. |$ u. O3 Z2 c8 ~$ Q1 ^9 P% g
9 ^% P0 f. `' E' j4 s2 C$ n9 d
int41handler PROC4 s1 }  s5 G* `1 e( w. A
    mov     cl,al- w, n" o' M0 b2 ?$ C
    iret
! i6 t  ^- q; ]& W  f. O% mint41handler ENDP
8 s! X! Y) s% m* i. W) T% `" G, y" S8 n9 u

+ m1 y; ]4 T* J    xor     ax,ax  C/ X3 ?, s: _) o
    mov     es,ax
" |' @6 N  \( i- k! `9 t4 ]! j% _    mov     bx, cs
3 b( d& X6 e  D3 a# L    lea     dx, int41handler
. {# @4 |7 |+ T- _9 |    xchg    dx, es:[41h*4]. i+ Z% ^3 j& y9 X! K5 ^
    xchg    bx, es:[41h*4+2]
$ h4 U/ q* I( s# V* C4 B, d    in      al, 40h
" |% x' i6 T3 P5 q/ F% P' e    xor     cx,cx
" ~6 V  f) x! b* M5 A    int     41h3 `6 q2 a0 F) s  j) J+ g
    xchg    dx, es:[41h*4]
' B. u: i. ?0 D* C# x  X4 H, v    xchg    bx, es:[41h*4+2]; [$ m* M% f. j. ^/ J9 R8 |+ ]/ W4 m
    cmp     cl,al
6 }$ [$ y" @3 ]. e* D    jnz     SoftICE_detected
5 i- I( ~! O& w8 t( [1 P" ^- b# E3 s: X8 Z4 b) h' ~
_________________________________________________________________________9 J! j9 z0 N4 s* v
+ P+ L- |- F0 I! @( B* N
Method 079 T; t+ k2 K2 V1 X% d, _
=========( [2 h* _# T1 Q
, ~7 T4 ^1 D' k7 Q9 S1 R2 G
Method of detection of the WinICE handler in the int68h (V86)
7 q6 I; F' B' H% G# _7 ]5 J% f: H* V* j  E0 g: l7 \+ r: ]
    mov     ah,43h
& D( V5 T- Q2 a: S- @+ w1 j    int     68h& \' o6 n9 @7 u/ T  }
    cmp     ax,0F386h( m; l3 }" B6 {+ d1 N: b# V
    jz      SoftICE_Detected
" D- C- {& @& d* \; |
& j/ o3 ?& G# s- V3 O; b' G
3 y' j0 o/ w) Z+ {9 G=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit9 W  A& D9 U; f9 C  T6 M
   app like this:) _/ b5 [/ w0 D& i0 G; R0 r# T
/ }% x# Q- [  H3 R+ A) U
   BPX exec_int if ax==68, ?" O, E7 y& C) e
   (function called is located at byte ptr [ebp+1Dh] and client eip is0 H9 |1 n  a; o# k! w8 A7 N. Q
   located at [ebp+48h] for 32Bit apps)4 r- F( _  Z) k3 c& _
__________________________________________________________________________
0 A; d& m# l9 e: |4 U2 Q
% N" C0 ?0 C8 _* I) A
' I% x/ ^) w3 U$ i- zMethod 08
6 k7 w% w9 S* f7 u2 {=========
- v' y% a# d: T9 I+ a1 L, {
- ~5 \) ]! a% j, ~" C  n* T% G1 BIt is not a method of detection of SoftICE but a possibility to crash the6 @: B* U9 Z; {
system by intercepting int 01h and int 03h and redirecting them to another( L6 d, o- m; J! i; C
routine.$ t2 j5 i4 ]) z9 H3 N4 w- s' k
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points6 t+ G" N8 n: G4 r5 C
to the new routine to execute (hangs computer...)2 {% m6 G8 u, Q
+ L2 }2 X* ]3 M  q- ^5 O# o  H
    mov     ah, 25h) W) L( _  d  B) s1 P- ?
    mov     al, Int_Number (01h or 03h)# ?. O6 n* z# |' ]
    mov     dx, offset New_Int_Routine
& c* V' q; g* L& t: b; S4 |    int     21h
- ^( P$ ~! I& u0 {) ^, e
  s7 E  N  a6 X$ n  Z2 [6 ^__________________________________________________________________________% X1 @% t. ?3 c$ J: [5 e1 y

$ G0 Z$ [4 t6 s( q6 D% BMethod 09
) D5 f* d3 p% X=========5 U  _* w1 Q" m/ W
6 h5 ~, m2 H6 s5 J2 j
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only" Z2 E! k* g7 B2 O! A" p# {2 x
performed in ring0 (VxD or a ring3 app using the VxdCall).
2 v& y* s: i3 C9 o' Y! w4 H! r* \3 _# u+ ~The Get_DDB service is used to determine whether or not a VxD is installed
- }* k8 W2 {) H) Q0 y# a# Jfor the specified device and returns a Device Description Block (in ecx) for
/ _. B7 @/ p5 ~; ?) d0 [% c' V: Dthat device if it is installed.
) L' h- r6 j: Q3 [$ z& j* p6 z3 p/ [/ L1 U$ W/ G! C
   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
* I9 t4 V% b0 O2 q6 J- f/ |   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-). a$ D0 G5 k2 H# b0 f7 N! N
   VMMCall Get_DDB/ g4 R9 G1 d8 P* G2 ]
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed' x0 n& n# e4 ?1 L
( P2 l3 l1 H! r
Note as well that you can easily detect this method with SoftICE:
0 z) w+ x6 p3 L$ L, A' v  u   bpx Get_DDB if ax==0202 || ax==7a5fh: H- c1 z0 D/ W. |8 Z: f6 i1 S
" F. L- N8 ?, j5 m
__________________________________________________________________________; C3 B1 v* C5 ^: _- H9 d

8 ?$ _1 X- X7 eMethod 104 v& X6 G2 w! S. _
=========
& p2 x8 o3 [" e% ]$ S( g0 Q- a2 _/ f& ?8 K3 O8 ]
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with  f2 N& h$ M8 ~# f! n
  SoftICE while the option is enable!!
; [. @9 C: |/ [& A: m! P2 E; u* t. e/ c% f+ |# Z9 e
This trick is very efficient:" i! Y: ]' a# N: |! |$ `2 ~
by checking the Debug Registers, you can detect if SoftICE is loaded; w% ?# ]7 e' _- \
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if3 n7 b5 R1 O' y; Q; J* |: p
there are some memory breakpoints set (dr0 to dr3) simply by reading their
" a4 Q& s# d( s% S  }  mvalue (in ring0 only). Values can be manipulated and or changed as well
8 i. g" Y9 ]9 ]$ \(clearing BPMs for instance)
2 U9 i) |, {' ^* o1 X( P4 ~9 L, T1 G, c+ I, d! ?& V: }
__________________________________________________________________________
7 F* i" U6 U9 g% `( G* R8 j$ {/ r; i. T! u5 K0 s' y; V
Method 11& B6 b+ _' r5 D; ?4 ?+ N
=========
: Q& |( e; d, G: [$ H  h& n2 Y- W; `2 t
This method is most known as 'MeltICE' because it has been freely distributed/ b$ N, `3 N, |  R; ^4 C
via www.winfiles.com. However it was first used by NuMega people to allow
1 |3 w1 b: j' r8 _2 |9 ~Symbol Loader to check if SoftICE was active or not (the code is located
2 \$ A- z. ?3 l+ h7 f2 Q2 Uinside nmtrans.dll).$ x5 T- w  Q: [9 C6 ?- ~  H

6 j' H+ @6 T" _The way it works is very simple:
/ p* H. x8 p9 Q' FIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
  f/ Y; N8 K  ~4 F* zWinNT) with the CreateFileA API.( M( Y: |$ q1 \6 t1 G! q
0 p4 l- ^' a9 @
Here is a sample (checking for 'SICE'):1 [) Q0 m, A0 Z$ K9 X+ v$ |

  B" Q; e6 _+ ~) M2 tBOOL IsSoftIce95Loaded()
6 a. ~5 Y8 H. }{
* e: Z) \2 k; U4 Z/ u; K, F   HANDLE hFile;  
8 G# |0 v9 y5 o, }+ I& V2 m0 d- L   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
4 ]; i3 |( |  [3 P; J$ D( V                      FILE_SHARE_READ | FILE_SHARE_WRITE,
: L8 ~! c: @, @# \% @2 D# W4 A                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);; }$ V3 C/ P4 r1 Z$ {" p
   if( hFile != INVALID_HANDLE_VALUE )
3 F8 H+ e' B# U" L" `7 f/ M   {
+ ?, L! Z; o* J$ y, u      CloseHandle(hFile);
. t* D& p  W8 F9 ]+ J, h9 ]      return TRUE;- k, ~0 o! [4 a8 _- }8 q
   }- o, M8 F. w4 j. F  Q! p
   return FALSE;
  p' O2 v# {9 X! P* f5 M}& h  l4 n5 f' p9 T3 |
( K; B- W; q# w
Although this trick calls the CreateFileA function, don't even expect to be5 w; B6 S4 Y" k$ u, t% y
able to intercept it by installing a IFS hook: it will not work, no way!& l$ _' m  _6 _7 K& B$ l' m
In fact, after the call to CreateFileA it will get through VWIN32 0x001F
' o+ c0 f& m" |* }% g6 Q: |) tservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)( p$ b) X% S2 ]6 I
and then browse the DDB list until it find the VxD and its DDB_Control_Proc
$ ?" \- [- ]: S# d% T" J3 ufield.
$ ]+ i' ^* F. v6 b4 o% cIn fact, its purpose is not to load/unload VxDs but only to send a
- a2 }  H2 g7 h7 K/ \$ K! D5 sW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)5 |$ S) E- g' R' I2 h/ i7 `6 t3 _
to the VxD Control_Dispatch proc (how the hell a shareware soft could try
! _( Z/ L0 S1 W1 D5 kto load/unload a non-dynamically loadable driver such as SoftICE ;-).7 s4 S) a+ I- b
If the VxD is loaded, it will always clear eax and the Carry flag to allow/ y% Z1 c3 A5 [2 [
its handle to be opened and then, will be detected.- ]5 f9 K+ I+ I3 r! j
You can check that simply by hooking Winice.exe control proc entry point
5 e: C% d& _! |. C: iwhile running MeltICE.+ T. }. D" p( l

( N. P! U* V& p) v2 }6 t  K0 J/ h% W8 ?. h1 P$ K
  00401067:  push      00402025    ; \\.\SICE5 U- f: ?- w  a# S) M1 P
  0040106C:  call      CreateFileA5 K7 H% B3 Z( w: {
  00401071:  cmp       eax,-001, S2 ?/ J, d; X7 e9 t/ L8 o% B" h; h
  00401074:  je        00401091" N* D, M4 {: S8 t) ?
# q3 A! D3 y2 X9 u9 `1 d) z
: y; m! v- \4 W8 c( q4 i+ m
There could be hundreds of BPX you could use to detect this trick.
( P: k2 k' _; V) v-The most classical one is:
  D) X, Q2 h8 h  F% y0 Y  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||* z. c, u  S7 G1 i
    *(esp-&gt;4+4)=='NTIC'
1 Q4 X- S0 o4 A; S4 P/ E3 _* L0 d6 }9 `# j. l! X1 m
-The most exotic ones (could be very slooooow :-(+ i$ w$ _. A6 i
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
1 B) F" j! W6 ]/ w  a, ~! O     ;will break 3 times :-(. p- C- g0 H7 z5 ]2 j$ x0 q
. x% G  d: @" u. K5 ~
-or (a bit) faster: " J  f+ g  K+ q; g
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')3 n+ p# w) T) R9 l
/ l! k( F+ C0 K: R; s
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  % D$ h2 h7 D: h0 J4 r
     ;will break 3 times :-(1 q) q4 N- g' t9 ^; E, z& j
& ~' e8 [$ b2 ~, d
-Much faster:- \2 w- T  K% a5 U, |: T
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
. |0 u# k9 L) M( P- F" d( M# \5 `. b+ `. ?! I/ H
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen+ V; ~+ r( f) \
function to do the same job:: t! ~* {' Q3 I4 t9 d$ E5 X
# O% H" ]7 R3 n9 N$ D
   push    00                        ; OF_READ2 L) C! i# L  W: w& ?% n2 L. u  ?: m
   mov     eax,[00656634]            ; '\\.\SICE',00 O; s/ }, b% d
   push    eax! P" h3 Z( ~7 i5 l! z' ~9 a( Z
   call    KERNEL32!_lopen
) o' p7 b. u1 Q7 s0 X- d   inc     eax
/ J2 E. W; h; d1 H2 M   jnz     00650589                  ; detected
. [$ o( I  w4 i) F   push    00                        ; OF_READ4 |9 p9 X0 D; i$ W. R3 `. \
   mov     eax,[00656638]            ; '\\.\SICE'
1 P3 t& n" v  c/ S2 J! y6 A, k& P3 ?   push    eax
4 U9 w, X/ H5 j) |) y! `! d) p   call    KERNEL32!_lopen" T  @& C0 |) i8 c7 Q* N
   inc     eax
# z5 @4 p- Z  r) l: B   jz      006505ae                  ; not detected
8 o5 }% ]! I1 _9 n' ]. \' a9 ^3 Z1 R. q4 R0 w
$ H( d% ~: r- z+ V8 Y7 w! U* w
__________________________________________________________________________* e  p; ~, V* M5 J, N1 t
# ~$ D0 V1 e9 n0 d: I) h8 K
Method 12
& {2 u4 F9 T/ u5 F1 x=========
, D* g# G: j' p: ^& Q+ Z3 T6 M  M! `6 L
This trick is similar to int41h/4fh Debugger installation check (code 05
) h1 e8 m% o2 Y  S4 X&amp; 06) but very limited because it's only available for Win95/98 (not NT)6 `: [; `% r7 ~- t1 f
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.
5 ^% B  F+ j6 r0 ]- m7 B6 N
# y) I: m5 Q- v   push  0000004fh         ; function 4fh8 N: j7 _# C; ~1 d1 y$ }+ V
   push  002a002ah         ; high word specifies which VxD (VWIN32)
( v/ |; u6 e6 A                           ; low word specifies which service
: ]  Y( T0 R* \+ u                             (VWIN32_Int41Dispatch)- P3 p) [* `. [9 z4 b9 f) b
   call  Kernel32!ORD_001  ; VxdCall
* P$ P1 h; S1 M- a/ `- c4 J- y   cmp   ax, 0f386h        ; magic number returned by system debuggers
3 ^& I& R4 r0 O% v5 Y- n9 ~; R. T   jz    SoftICE_detected
" j+ V5 Q! x: L1 D+ l9 r+ t0 M2 t3 n! ^
Here again, several ways to detect it:
0 U, R5 x7 ]$ P2 [2 n8 q) d/ c, s- E) \# {  q0 i) ?3 E% Q
    BPINT 41 if ax==4f9 o4 H$ _; }  T$ X# {

4 S* b. |, O! M+ H4 B1 i: Z3 n    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
, I& u% v$ t, Z# ~& _* k% h# }! P  S  e2 I5 K7 w# ?0 S
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A* b2 w$ J* e2 S, t! `- o
& _2 n* S' g, w6 `1 A- s
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
3 T8 X, W* q* A8 C" p0 X# z6 C- m2 F8 s7 l0 C
__________________________________________________________________________
" V4 R$ v$ a) z# k; H/ s
' R9 d& t( ]5 V8 sMethod 13" s0 g7 O; g$ @( g, J- \: O# k4 n
=========2 P/ M0 v" ^5 C8 G/ N1 C+ M/ L0 y
5 G7 ^" U0 Z2 c3 \$ }  h
Not a real method of detection, but a good way to know if SoftICE is: M1 Y# a6 v- H  z9 `2 ^$ y9 q5 [, ~
installed on a computer and to locate its installation directory.
. r' F! x% t" NIt is used by few softs which access the following registry keys (usually #2) :& r* z/ ^8 P7 n* |: \9 B
/ a6 i% n; m: h8 [: r8 x4 ?
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
9 A4 X7 ~3 s$ u\Uninstall\SoftICE4 K# m% i% d; E8 L5 Z; r
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE( z8 V$ M5 j5 f' o( X2 s- I& d7 L
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
0 D! }' L/ Q+ \6 }# H& ]% C\App Paths\Loader32.Exe. x- e* `# J) F1 }+ b! `
6 W+ i0 p% }8 Q& _5 X% c# L* `
9 x/ ?* o: j/ G0 Q" w8 t! Z' R. u
Note that some nasty apps could then erase all files from SoftICE directory& ^. S  _' `" d! P$ L
(I faced that once :-(
* A; f" B: o4 u8 x. C: G5 `  m7 g& M0 Q* w! M: ]4 N
Useful breakpoint to detect it:5 X2 l& n1 y% }6 ~) W- |3 b1 w
) _# Y" u8 u# v# X
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
0 ?* I( l; U/ `: m$ O* |' ]5 i. ?+ K6 \# S: i  K. g* [
__________________________________________________________________________* o5 A) J5 X8 v4 |& R1 G1 ]6 ]* ?. r
8 S# Z; c% c$ w+ y* i

1 n4 a; T6 `5 Z# K) EMethod 14
1 q3 v' x* T, ^" c! q+ {=========& p- t$ V4 K$ A- E2 f( K
9 i; l$ x7 V: x  U+ P/ \
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose1 @) `# p: q; a( k2 Q( J$ R0 ^
is to determines whether a debugger is running on your system (ring0 only)." Z* v) a# N1 K
1 }9 U" \/ J0 \
   VMMCall Test_Debug_Installed
3 n- [8 T  I0 K! h- E   je      not_installed# z) \9 V8 ]6 d& Z

* y4 o! P) S( G8 VThis service just checks a flag.
: s, w5 o' K+ y! E, F</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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