About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500># C! j. ]5 B# I* D; {# t
<TBODY>( W+ W. `. U+ Y4 w5 s& s0 W0 N
<TR>
+ _. j  A+ V$ e) m+ O# R' T<TD><PRE>Method 01
2 z7 h$ L; T$ r/ j8 ]: e4 B=========) W" X7 m' c, p8 C: M1 V4 g5 ?
8 G2 m  Y" ]" [+ e+ f
This method of detection of SoftICE (as well as the following one) is
1 Z6 F  l3 k3 Y3 k4 ]used by the majority of packers/encryptors found on Internet.' k: C  a2 [; W7 B
It seeks the signature of BoundsChecker in SoftICE
5 G; [! X* ]% @% a/ J  U0 ^* \# u0 M+ P
    mov     ebp, 04243484Bh        ; 'BCHK'
: a! H, @2 T. h* Q- f4 n. f    mov     ax, 04h8 r. }# o, O: A9 r' ~0 D
    int     3      
$ R( X2 i5 W$ D    cmp     al,4
& M; Y2 `4 N( S: K+ @2 W    jnz     SoftICE_Detected
2 m  E. [2 R; e4 w
' w- X, d6 K( u% m% j___________________________________________________________________________' |9 ~( N$ H' T* D1 e! t
& M: m5 [7 q2 S+ G) w
Method 02  W. F  `& f4 O! l& \: T# r
=========
, k$ R$ E! D. v; r4 P
6 A! K1 e5 I1 e& L5 T# CStill a method very much used (perhaps the most frequent one).  It is used
- I+ ~/ {0 T. H$ E* z* Hto get SoftICE 'Back Door commands' which gives infos on Breakpoints,
+ a* v9 `+ S0 O/ C& H' H4 }or execute SoftICE commands...* z, Z7 r1 P4 r  K2 l; }
It is also used to crash SoftICE and to force it to execute any commands4 Q5 u7 {( s2 C6 w+ L3 q/ y* @" l$ Z
(HBOOT...) :-((  
; Z6 h( M) N7 S( y- q% Z- K
8 w0 J9 Y: d3 F. Q& K) uHere is a quick description:: }/ i" `4 Y) ~5 T+ t' J
-AX = 0910h   (Display string in SIce windows)! w+ Y3 W, T! B  J9 X
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)) P. J/ _: z  i, w& g) T
-AX = 0912h   (Get breakpoint infos)# o; [7 _9 n6 @
-AX = 0913h   (Set Sice breakpoints)! B' I& ?" s9 I# S* e1 q: u6 C
-AX = 0914h   (Remove SIce breakoints)
3 y2 t  K* I& g  x7 q6 c/ V( d2 a# g# h  r
Each time you'll meet this trick, you'll see:
5 T) V3 w% C: M! w# N4 [2 `-SI = 4647h$ }% \- S$ J, Y0 W2 I
-DI = 4A4Dh
: a7 e( {# l) O% j$ q* Z" ?Which are the 'magic values' used by SoftIce.  N: e# |5 q: i$ d- D) F2 l: ^( V
For more informations, see "Ralf Brown Interrupt list" chapter int 03h.
9 U& Q0 K7 V$ l- X. v; |
" _* C" ?  u4 l. [7 D5 eHere is one example from the file "Haspinst.exe" which is the dongle HASP- O4 n& |9 I2 g6 @
Envelope utility use to protect DOS applications:
( V6 E3 a  H+ _3 E, x8 `
0 w" ~9 a" j4 t" t2 j
7 G# J; g' R2 D" T# f4C19:0095   MOV    AX,0911  ; execute command.& l& t" S8 j: E) H
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).9 D6 `/ N% c( T* T/ T
4C19:009A   MOV    SI,4647  ; 1st magic value.; d' |  g) _9 W- ]3 o8 o' N
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
; ^! e( x, o, }; U( C! G3 ~4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
4 s0 ^) E1 \+ w* c( a+ M4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
& P; Q! ?  E0 K4C19:00A4   INC    CX# @  }! Z/ p/ S% Z1 G3 q
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute; |0 X' I1 H, p1 r
4C19:00A8   JB     0095     ; 6 different commands.& q; j6 ?. \1 p
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.( ^0 q2 P7 X$ D3 [: x
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)& X( G8 ?  U- r. y
2 O- l# ^" r) r* Y/ V
The program will execute 6 different SIce commands located at ds:dx, which* C1 A7 o4 n# _1 D
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.5 ~! }3 w8 i5 `; k: Z" s
% [/ j+ J9 Q7 g( e& R/ W& J
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.% p/ _# q. o# v/ k  h) y  b
___________________________________________________________________________( Y# F; P& l2 O6 W# c

8 `" \0 k# j% i) P$ V; V, m# S1 Q* X3 r
Method 03
: k1 n, R& V1 o* m, D) X' e=========
6 k2 R2 m2 s7 M7 ^& y& G' q
% N* }- a$ k  x( U1 F3 s- }Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h  v0 Z) b# `; D$ g+ B0 {, z( |
(API Get entry point)
$ u6 f. t4 H3 a: P! r6 C% @        
; z9 Q/ P( P  @
+ y  h; S/ t/ B" ^    xor     di,di
- }# }$ _" c6 G    mov     es,di
& Z+ Y  h. O9 T9 J5 H% Q9 `5 x    mov     ax, 1684h      
" l# }& E! j0 [& L    mov     bx, 0202h       ; VxD ID of winice
# c& N" z' ^/ o5 b: |2 Z/ P    int     2Fh; R# O3 _5 z$ \1 S
    mov     ax, es          ; ES:DI -&gt; VxD API entry point# S; @, s. G, D
    add     ax, di
( e+ I: S$ r/ J0 g    test    ax,ax4 X* d6 |+ X$ N2 v! a& L
    jnz     SoftICE_Detected
" E6 `( g1 z) d- \0 Y1 Z6 p! i" b- x! i8 `! V' t
___________________________________________________________________________# }/ E2 Q+ t! h6 d0 K9 `

7 d) D/ m& p. n4 S7 }Method 04
5 t" K# Q3 n$ ]4 q6 J=========
7 }. ~- A+ u# K- ?; q6 c/ ]/ \" j& |. B8 H/ x5 O$ x
Method identical to the preceding one except that it seeks the ID of SoftICE& J1 K! _  M; e' x4 p, W
GFX VxD.4 a  \3 [6 r8 V" s8 u% D$ R) N$ I, g

/ f& X6 x0 l' k  @5 J0 ^, Z* B& t    xor     di,di: }! T5 N% Q  K7 N" [6 W
    mov     es,di0 H% Q$ v1 r% S( K- L' y3 {
    mov     ax, 1684h       - u, }) M4 u. W% @7 P1 X
    mov     bx, 7a5Fh       ; VxD ID of SIWVID7 }, o6 |- S$ ?5 m" H
    int     2fh
: i2 Q- E4 r% q! t, o) k9 Z    mov     ax, es          ; ES:DI -&gt; VxD API entry point
' h  g+ P2 Z0 Q2 ]: F    add     ax, di
" H. L; ~- P; h! e8 R    test    ax,ax  i8 a9 c# j9 q  Q1 y
    jnz     SoftICE_Detected4 V5 H( p  Q4 f: j
$ }( V9 E7 ^) J2 Y% n2 W
__________________________________________________________________________" U; {4 b$ g4 x$ O

/ [, d+ v( y: G- s# Y
- @: `4 ?1 V  DMethod 05
4 E) b! u. k+ j- g$ a- h4 t0 v=========; M5 D0 o' G9 ]! u9 F; c7 W, H
2 p& T' E  Q9 {- R
Method seeking the 'magic number' 0F386h returned (in ax) by all system, ~; j: |; x. C  b
debugger. It calls the int 41h, function 4Fh.
! u2 u7 \' `+ B7 VThere are several alternatives.  3 M! L+ {& ^% A& B

* w/ Q' ?: z4 {5 H3 ]; F) _The following one is the simplest:
! B. \- V% z4 e% s! |& O: R2 W: I# }* P" x6 d
    mov     ax,4fh
7 I0 k. h2 |/ ?+ m& s; b7 g    int     41h
' R+ t' D4 {, r  Q    cmp     ax, 0F386$ X2 C2 ~% u9 c! v' p( r. u0 v' g
    jz      SoftICE_detected) z( r5 q/ p& Z5 A. s  ?' x

+ |: T8 K# r8 u. C
* |7 u  `/ a1 p; \' V. g% d) rNext method as well as the following one are 2 examples from Stone's * b3 R+ L$ p& z" b9 @
"stn-wid.zip" (www.cracking.net):- J& A" X0 g; a  G  u! x3 i0 ?/ a

' l1 N% _9 P$ i' u/ c    mov     bx, cs
- ?0 L9 H1 x" y    lea     dx, int41handler2" Y; `" u9 ^( Z+ I
    xchg    dx, es:[41h*4]7 g- i2 H# M- I$ V8 F, h$ \
    xchg    bx, es:[41h*4+2]
  R  M& ^; F; L    mov     ax,4fh
' E. Z9 i3 Z; w# z    int     41h7 d' [9 X" F0 w/ X/ r
    xchg    dx, es:[41h*4]
! X: d  k2 ]) h* h; R( H* t0 `    xchg    bx, es:[41h*4+2]
$ c" e; j6 I. d' f0 V    cmp     ax, 0f386h' h1 f' b; h5 F# ]" i$ U
    jz      SoftICE_detected
; \( `( \4 Z% u6 F
/ K2 r7 C+ V8 D' h5 `: rint41handler2 PROC
6 ?& s" u8 U6 f6 b" u9 q4 f$ v    iret% ^9 r: w/ o9 d# [& g" V
int41handler2 ENDP( Y  A8 m% q) Z5 _7 r

" _% I$ Y# s# ]7 \6 g9 X( D4 ~. |; W0 t# P% r5 h
_________________________________________________________________________
- j( `4 O' K: h5 I  P  D( X5 C
0 u; ~+ o1 |! s% }( G' K' l
* u& ]: @7 U# B' u. wMethod 06
6 K; L, [- ~' Z* X; Z# r: T$ m6 p/ o- r=========
: y: X- Z+ K. y0 V: K3 K& H7 `0 C4 j
+ Z1 d& D2 u& g6 B$ h
' L6 m9 m9 `8 h+ W2nd method similar to the preceding one but more difficult to detect:
) v" {1 v. k' m# Y6 ~1 s
- s1 c/ j6 ?" e: V. ^4 o
0 w) ]$ G5 c! a5 [) mint41handler PROC
, E: B4 a& }, o9 L% h6 s1 R3 m2 @# F    mov     cl,al3 S% s2 R/ c6 c% U- z, s
    iret
2 I6 L4 g+ k3 s" p6 q+ L. a$ dint41handler ENDP( w& V2 U- F: w, s5 G! G% L

3 n8 |# l$ j5 E) W0 r) e- S
' x9 g7 C" k# l9 b    xor     ax,ax
- L# V- ]# u7 e- J" ?- F    mov     es,ax
. m2 |+ A) w+ ^5 c- D    mov     bx, cs
: c+ h& M& I. e$ ]    lea     dx, int41handler# r  A" j/ }, u5 f: x3 \" G) L. _
    xchg    dx, es:[41h*4]+ f% O: A: i4 t8 i
    xchg    bx, es:[41h*4+2]  [% \% i6 P( D, L( q- [, B* @1 W
    in      al, 40h$ M. W# w. ]' z$ }
    xor     cx,cx
. {; w; y' r$ \5 g& W: q    int     41h2 M% v0 G3 j9 }# y5 D
    xchg    dx, es:[41h*4]
  h8 C( k( E% U    xchg    bx, es:[41h*4+2]# p$ v2 H& \* Z0 S2 U3 M6 R# @9 k
    cmp     cl,al
4 a9 A7 A8 p+ W( B+ [/ p    jnz     SoftICE_detected
* g* o8 |5 R- I& M' ?+ f# Y
8 ^  v4 ]4 b5 z_________________________________________________________________________( o' w' \" Q2 D! w4 Q1 r* M

0 Q; _" N7 n. [3 ^! n8 WMethod 070 e6 T. {! a; n# B1 r1 ]* x3 C
=========, z  @* m, D: Y; o. K; }6 Q+ G8 ~0 m
$ l; ~, \3 r( n+ J, {1 r7 F, _
Method of detection of the WinICE handler in the int68h (V86)
/ i" r! V; K0 c/ U1 d( B# u( W. G+ W" [$ f: r& R
    mov     ah,43h
# P+ \" \" {% {" i2 f    int     68h! W  }9 L4 m5 C, c1 p3 ]
    cmp     ax,0F386h5 ]& X2 y/ Z/ @' B/ J4 k) e
    jz      SoftICE_Detected
0 [8 e8 `; w* P, b# U# E; s: x5 x% w

# q3 ?$ Z& `* \  c) x; _; _' h=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit2 D5 X* \8 {5 d! M
   app like this:
2 t2 G1 F0 B" H( H3 g' J
& R- u/ D" E4 U/ I+ u% F. t0 H   BPX exec_int if ax==686 W' h& S& G4 _! I! W
   (function called is located at byte ptr [ebp+1Dh] and client eip is) J( B9 a5 |% y; [6 @
   located at [ebp+48h] for 32Bit apps)( d) H# y" d6 S) C: N
__________________________________________________________________________  `( w" Z( P* k) c; x" A$ k* S: |' W

! W! K( K8 _4 x, {8 S- l0 B' \
+ e: ^* f( x$ Y5 k% pMethod 08) L2 S9 H* r" R% E
=========
$ d( p, U, h) _' N" E" Y" Z" }
9 N- W* W* v0 G$ UIt is not a method of detection of SoftICE but a possibility to crash the, u; V1 |* ~7 W- `" L& |
system by intercepting int 01h and int 03h and redirecting them to another
* L* Q3 a- s% p9 Y/ Y+ a2 I9 eroutine.% W  b) a& N2 b, V
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points) J( B. L& Z8 O
to the new routine to execute (hangs computer...)
% G& s. g8 |5 u3 {/ T; k* }$ K$ Q
    mov     ah, 25h" b5 A+ D4 Y- c/ M# r4 R# O+ J  i
    mov     al, Int_Number (01h or 03h)! \) A1 H) O: v0 `) Z1 A
    mov     dx, offset New_Int_Routine5 e1 q1 y: h+ _6 z
    int     21h
, ?9 X" w4 [" G) h0 C
4 t8 T0 u. u9 R, V! f$ W__________________________________________________________________________
  U- s  M* `) D
1 G! E1 C0 x9 T/ X% [2 j, }1 u! HMethod 092 w* p, o. Q& B  d. g0 D  R" L! ?
=========
* Q0 S6 z. Q8 _2 C7 W2 B9 ^- G7 `/ \$ T. Z, v- V7 a& |. E/ ~
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
4 f" p- A1 n' D& d) Bperformed in ring0 (VxD or a ring3 app using the VxdCall).! c2 k8 u& u2 T+ J
The Get_DDB service is used to determine whether or not a VxD is installed1 y! A$ O2 G% |6 L0 A" Q" m
for the specified device and returns a Device Description Block (in ecx) for
4 t( H: k' s7 x7 H- A) \5 V/ Rthat device if it is installed.3 w- E7 R( J$ `8 O! p( s) j2 Y

" c( n$ L+ m+ ~& I; L7 E' z   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
7 n; p4 @* C& T4 n: M   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
( ]) S7 E. j# [. L. Y   VMMCall Get_DDB
4 p/ M' x7 P" H& |+ \+ O: ]   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed
1 I, J3 q# U% y( V& F6 t' q. I' d8 [: D, `  k: L: m# N( R7 p
Note as well that you can easily detect this method with SoftICE:
$ D5 U% `. L" `+ |. R   bpx Get_DDB if ax==0202 || ax==7a5fh
: L8 ~4 e3 d/ r  h- k
5 i" A) d/ P2 `__________________________________________________________________________9 h: P3 e) K# u1 S2 l7 I

) v& ~+ ^# F) r: I. X3 L  PMethod 10
3 f) a' L! d7 q( d0 s=========
# ?1 `7 {2 _9 d$ R
: S; U2 ~! V3 `6 j# I=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
4 i  @7 J4 u( |' i8 t2 y5 l7 z1 [  SoftICE while the option is enable!!
3 s! m( _2 ?8 H" e: i% B8 C
" G/ d/ I- N% DThis trick is very efficient:
& u3 k$ P& i7 `' G- U7 e1 ^5 @by checking the Debug Registers, you can detect if SoftICE is loaded
* C, \( u8 K8 a( i/ u  G1 h6 z(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
* |4 |8 ?! I2 Y1 D0 |) h) E9 Ythere are some memory breakpoints set (dr0 to dr3) simply by reading their
. P# [" d0 X% `9 z+ ^  Kvalue (in ring0 only). Values can be manipulated and or changed as well
, o. m/ m1 B9 t9 g(clearing BPMs for instance)
8 G4 p7 ?( \7 U1 v- R; H, m( ?5 e' s+ a8 K: J6 N
__________________________________________________________________________1 k; [7 T! c. r
  ~8 q4 D$ A& p- D
Method 115 K. h2 |; M. {/ o$ D
=========' s' p/ D3 A! b& H

9 `4 E. _0 g4 Q5 j* m8 iThis method is most known as 'MeltICE' because it has been freely distributed! Z; ]; P5 N" S! Q) `+ \
via www.winfiles.com. However it was first used by NuMega people to allow
9 S' f' v0 {" [% e  rSymbol Loader to check if SoftICE was active or not (the code is located# p9 o$ D" C( E2 P) R1 Z; a( |
inside nmtrans.dll).- \; g! A" `2 ?- v7 ]( W) W
9 U) C8 u5 O3 D4 r6 U0 G1 L
The way it works is very simple:- `+ \- s, Q0 J5 _3 W5 |" g
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
% t  {2 x, y; b6 X  RWinNT) with the CreateFileA API.
/ M; [5 U4 x- o$ w: p% W5 `- y/ t7 Y( T( ^! ?2 o, m
Here is a sample (checking for 'SICE'):. H( n. j. u- O8 j# f, X5 Z

" x2 v7 m- V+ F, L! lBOOL IsSoftIce95Loaded()
8 S  H2 ?6 J5 H6 s2 q{
% m7 T$ j4 `2 g( L6 x6 N   HANDLE hFile;  3 p9 h1 N5 m6 [0 Y7 f$ s
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,8 X! K- g8 ?/ s4 R4 o
                      FILE_SHARE_READ | FILE_SHARE_WRITE,
* @# b: }2 @# M' D- t                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);. t2 f! Q# n: U$ y1 U
   if( hFile != INVALID_HANDLE_VALUE )
5 d) h. K- Y% B. E7 A' w. S$ m( K   {$ R, j9 Z' R( ]
      CloseHandle(hFile);
1 |, D" U# y& k& U5 U" L" g- A. a3 s      return TRUE;, [9 n+ |% l4 P2 E5 {# K* G& C
   }
' y8 W! N; r, i8 Q2 e4 K9 H   return FALSE;5 s/ r& E& I" x; d: ^  N, U
}
" P0 G: A$ p0 o: o3 A0 o+ Y0 a3 s; T% n
Although this trick calls the CreateFileA function, don't even expect to be6 }: X; J4 c5 B& K, F
able to intercept it by installing a IFS hook: it will not work, no way!9 q! e# L  w4 H4 L' Y
In fact, after the call to CreateFileA it will get through VWIN32 0x001F! B& c9 g& v# k$ O
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)' o$ {2 b( J8 o; l
and then browse the DDB list until it find the VxD and its DDB_Control_Proc
4 `' \+ I+ ?+ [4 M# L  D4 g; n- Sfield.
1 t# A6 e' @1 {: \- GIn fact, its purpose is not to load/unload VxDs but only to send a
: c/ d) |+ ]' J3 r. ]3 R: s& cW32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE): l7 ^, i% Z$ M4 U3 y% I! r# |
to the VxD Control_Dispatch proc (how the hell a shareware soft could try
3 {1 m1 M; V1 n4 [to load/unload a non-dynamically loadable driver such as SoftICE ;-).
: I+ G' k7 z5 HIf the VxD is loaded, it will always clear eax and the Carry flag to allow
6 M# A1 ]' o4 W8 z8 Q. Dits handle to be opened and then, will be detected.% U1 W$ ^( G& V3 P% d1 T8 [
You can check that simply by hooking Winice.exe control proc entry point
% P% p2 O  @5 s: i0 T4 n$ ywhile running MeltICE.
- D/ V) |: h7 V: |( S) [+ W: o# v) h; C. \1 S. ~  W/ }% a9 b

" \/ L1 E) ^: ~6 B. J  00401067:  push      00402025    ; \\.\SICE
5 F3 `$ j+ r5 s) X- F- m  0040106C:  call      CreateFileA
' B  Q: t, p3 Q: w. C3 G- U7 r& w  00401071:  cmp       eax,-001$ Y1 t+ ^: {( w" Z; F. Q3 F, ~
  00401074:  je        004010916 n! ?% B, M' Z! A3 Z3 n* ?
* G9 W% H9 l, [6 n. ^
5 _% [' M8 M- k. |
There could be hundreds of BPX you could use to detect this trick.
( X7 B9 |3 ]& F) A& n) C# O-The most classical one is:
/ ~, I: N2 d, N" n  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
7 v. J. H0 D, U) n* O6 }    *(esp-&gt;4+4)=='NTIC'
- t: ^8 ]7 I/ u+ O) s+ e
# r, H& `0 |! N" N2 O) [/ e8 a-The most exotic ones (could be very slooooow :-(
% ]+ ?3 W' N3 n$ Q   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
7 J7 W  E" X+ y     ;will break 3 times :-(- \$ j- a" |: ?; A4 f1 v# k% h# o

4 u) ?/ O5 F7 j- u* G-or (a bit) faster: - ?  B; U: G: C
   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')5 [8 Q9 k- ~. Q5 @2 I

4 B3 u2 }; i$ @4 n. e: {! k   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  3 T! d8 s6 Z2 r
     ;will break 3 times :-(
! M: m/ b! ^3 o' ^( ?: S1 I4 e1 H  Z  J9 ~
-Much faster:
% Y" |) u$ X3 j$ t* d0 M   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
3 M9 ]) s$ Z, {$ g4 }/ V
3 B* Z0 U" ], l2 ]7 j( tNote also that some programs (like AZPR3.00) use de old 16-bit _lopen
/ B2 O+ n4 b( H$ L, N  `function to do the same job:  y, o* @; P1 U  G
2 M; E2 M$ o5 G. r! w
   push    00                        ; OF_READ) f8 Y" u" q& C# p$ H
   mov     eax,[00656634]            ; '\\.\SICE',0" t0 E  l6 L9 f; E9 `8 J+ D
   push    eax! q; X; i5 x; V9 Z
   call    KERNEL32!_lopen/ b4 x0 D9 e/ B0 [
   inc     eax
' L. }6 Y6 g9 ^5 C9 E9 E   jnz     00650589                  ; detected7 n( t! q" O4 V/ [8 a/ a5 j
   push    00                        ; OF_READ
, }2 _) \: V8 {# l   mov     eax,[00656638]            ; '\\.\SICE'( v8 `; Y9 n1 i( M6 N
   push    eax
# z* }7 B& ]6 p! c+ s& i; R   call    KERNEL32!_lopen! N: b9 X# i& N! @
   inc     eax( U* H7 w  P/ b# q
   jz      006505ae                  ; not detected, x5 u# K4 z3 C9 _  J" d
# t$ c# k( u0 Y6 m8 F

" w8 N/ J; H9 X$ H- I% r; |: Y__________________________________________________________________________9 w; W$ r# T3 x5 n2 t. }
, X% Z1 O) ^: R/ k& i8 c$ ^
Method 12, l3 H8 d/ H) ^# f2 L$ V
=========
' R0 [# O. F$ p; g+ s; w5 S
& s2 G, F  p9 z2 p" iThis trick is similar to int41h/4fh Debugger installation check (code 058 m3 S" i7 _% D7 k# j
&amp; 06) but very limited because it's only available for Win95/98 (not NT)
/ a" c* X! u5 k5 Ias it uses the VxDCall backdoor. This detection was found in Bleem Demo.) M) ]" i, g% p5 c, y

  u  }7 j8 q3 U! f1 y7 |% m   push  0000004fh         ; function 4fh
, ]' n* Y0 C; R8 b! [. o   push  002a002ah         ; high word specifies which VxD (VWIN32). C  l( G8 A1 P! S
                           ; low word specifies which service
( F% K: `, k5 P% G" O! r, @! [                             (VWIN32_Int41Dispatch)5 N$ Y- z' n& i2 ]: l( k2 a: Y
   call  Kernel32!ORD_001  ; VxdCall
4 l. M6 u+ s9 r. n8 @8 y2 J   cmp   ax, 0f386h        ; magic number returned by system debuggers
# H$ X& d( B2 u5 N. ~   jz    SoftICE_detected) C8 F* A, B7 n  _! H
: D* U( Y% T( }8 s6 U, b0 P! k8 F
Here again, several ways to detect it:
" @  v/ c1 }5 U3 Y3 L2 y: h7 D2 A$ g# n' \7 I! b" D8 g" S1 l
    BPINT 41 if ax==4f0 _( N- A: M6 Q8 ~
  W! r* t8 k# x& A2 H. S5 N
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
: g' b5 L' U, F! v7 D6 y& |. X% M3 ]& t% Q1 w1 m. a2 q+ Y* W
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
. F$ ^9 n5 ]% L/ h. M8 R; U- g. ^) k5 q3 Y1 L
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
& w1 A  F. V2 q- x, L
0 n4 B4 ^3 P. I8 ?1 k( o7 D__________________________________________________________________________+ |6 h2 p" |! `. V
; q9 u; y$ e5 l
Method 13
* N, U  m$ M# L/ \=========2 b* \4 F! @8 v% m4 s7 T0 t0 I
4 M  Z& C+ z$ G3 D  N; x( R
Not a real method of detection, but a good way to know if SoftICE is3 I# m1 x4 k$ H& D
installed on a computer and to locate its installation directory.
( z; J& V) i$ T/ g0 _+ VIt is used by few softs which access the following registry keys (usually #2) :; i- k- x1 L( I
! ^7 R' A7 b1 @/ z  a
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
! C& H3 H5 w8 L9 ]1 s4 _. p9 R\Uninstall\SoftICE
! p+ a# p6 v7 c$ Y-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE- |( u! N( @# I! a9 B2 B
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
! C- A0 R) \, Y/ x* R\App Paths\Loader32.Exe
$ v8 B3 r1 s) N3 S3 X) }( |  D5 D" J6 M9 y; S1 b) M

3 B* I! y6 Z# X6 ^6 W2 K: HNote that some nasty apps could then erase all files from SoftICE directory
+ ?& ^* l3 ^  R; @; v! v! g  T(I faced that once :-(* G0 K% r( w1 Y; G3 t

& q% w3 y$ ^' J7 Y4 f: S' UUseful breakpoint to detect it:4 w- U0 S- l; E

- h4 _! f! L( ?     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
! i5 A  l! d  h# N' l8 ?5 E0 X  M/ w! z8 U
__________________________________________________________________________
; y7 Z" T: U4 a  m; V( e
, K7 P! i4 r2 z0 o# `1 ~& s5 Q3 Y* x# f1 _, `! W
Method 14
1 V; E! k/ `; a. h6 p1 G+ a=========
% j* J2 Z1 y( g9 d1 H! O
! j$ y( j0 G/ e0 K) P* G* YA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
( f8 [6 j( q* u; ^is to determines whether a debugger is running on your system (ring0 only).! w! R8 H2 f5 \% i  ]2 I* W. w
3 m% a4 u5 ?* Q$ X6 a' r/ Y
   VMMCall Test_Debug_Installed
$ s) q, I. r! [  P" [/ o   je      not_installed
9 \0 b  h  _8 i0 F. I- B* g7 m8 O  ]6 I4 G2 Z0 Q
This service just checks a flag.( ~0 I% z- Y6 h0 x
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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