About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>1 h: ~, g+ E; s
<TBODY>
9 |& V: Q/ L7 T) n; e* h2 T<TR>9 V" b8 h+ `- y3 {9 v
<TD><PRE>Method 01
7 z! h1 `8 t; W0 X  l5 q4 G=========
- `  G0 F  G$ S8 c. c, N/ r1 b% ~- [2 \8 R& Y- v+ n) t
This method of detection of SoftICE (as well as the following one) is/ z4 G8 V. ~  l! r
used by the majority of packers/encryptors found on Internet.; P" E# R- `9 d* |1 Y! O
It seeks the signature of BoundsChecker in SoftICE
3 P% o- j4 [2 w. a8 a5 M
1 s/ a5 A( p+ ~5 ~    mov     ebp, 04243484Bh        ; 'BCHK'
  ^7 g: H. ?6 s7 x- b    mov     ax, 04h
6 N( @" R( R- ]' `    int     3       ! S0 U0 k& J/ R( `. C
    cmp     al,4$ g: G& W% F+ M; }+ x# P
    jnz     SoftICE_Detected4 ]3 J' N6 L+ b) v
% z, Z) [- A6 `( Y2 U, k0 }
___________________________________________________________________________
1 S. r' n9 R  _/ x9 E; r* E& e0 v! d3 @+ ^
Method 02$ ]& w4 [4 z0 B2 ?% s4 x0 u
=========
4 I( H% d( F) e- I- a4 w& Q# k! a* v5 V9 @. u8 n& T
Still a method very much used (perhaps the most frequent one).  It is used
4 X8 y# O- }& M8 t! v/ @& Y% pto get SoftICE 'Back Door commands' which gives infos on Breakpoints,0 e3 a6 J5 O! Y; ^: |7 Z+ S0 X
or execute SoftICE commands.... p' ~" E. [1 S. a& P4 L
It is also used to crash SoftICE and to force it to execute any commands5 g. h9 }( K5 t7 z& j2 ]
(HBOOT...) :-((  
, m- V8 i/ W; A2 Q# _0 ?
, @4 a, v, r; P% M0 iHere is a quick description:
9 V  {" |5 T" ~+ D6 o4 t-AX = 0910h   (Display string in SIce windows)/ v! ]3 y( Y- J+ E7 w7 E2 o7 i
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)* W: C; F/ g( J8 w" t0 J- N/ f
-AX = 0912h   (Get breakpoint infos)
9 F2 _4 n- G6 u9 C-AX = 0913h   (Set Sice breakpoints)
0 K! Z9 @9 L* w-AX = 0914h   (Remove SIce breakoints)+ b0 ^2 m) h; s
) A# x8 y9 \, A% k) c
Each time you'll meet this trick, you'll see:
, \* w  S9 v" J3 \& Y8 @; Q-SI = 4647h
+ e# C: [3 k; ~/ }, A-DI = 4A4Dh# j) |0 {$ W" ~3 f9 v; P
Which are the 'magic values' used by SoftIce.
0 }' u0 ?" c6 z0 I  y* B( m1 jFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.% g! ^* D$ \5 J7 p

6 R* p$ \- b& pHere is one example from the file "Haspinst.exe" which is the dongle HASP# g3 n! s  W5 }- T* M6 I
Envelope utility use to protect DOS applications:7 t1 c5 V% W( t6 ]6 x- m

$ P. P# Y, ]% {1 G* k/ y. `5 H& Z, E* N5 c" I4 v% q# p- n
4C19:0095   MOV    AX,0911  ; execute command.
+ O" y6 P: W, F4 |3 Z4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below)." f( I! u3 E$ s6 r5 U
4C19:009A   MOV    SI,4647  ; 1st magic value.
: h. F2 C3 B' {6 @: r" T4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
% q" [6 |! H( |7 @- U* ?4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)3 [+ c% m* ?; p4 ~$ a
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute) i  c2 h2 O  x" }, [# z9 U
4C19:00A4   INC    CX
/ G6 z! N1 f1 e! x4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
8 X2 u$ o) O1 \+ }* W' k4C19:00A8   JB     0095     ; 6 different commands./ e5 y1 s; A) R: ?1 }0 e
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
) h' u" b2 U) [* t4 D! n* E/ t- I  D4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)# V7 Q8 |5 V4 h! {. T
( _( I! y* ]3 S5 z9 Y# c
The program will execute 6 different SIce commands located at ds:dx, which- U6 _1 a9 ^0 x9 ]
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.
" P) ?1 Z5 t$ H+ x  t8 o* d. i. u
* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
  h$ h& y, e1 _4 `___________________________________________________________________________) c( q! z% {& w. O0 K  b  @
* @+ R0 x, F8 D. K) V

3 x( k$ f8 u: ^, PMethod 03
* d, |/ r, u. f8 I! i; K=========
- n- u, e. G" ^  ~: i' ~1 y) T+ ]" U9 ]) [/ V" I
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h' Z  u1 \& c7 V% ~2 r) w8 f
(API Get entry point)8 M* T. D0 J4 n, i4 p. s2 k( W+ {
        
6 M9 Q% ?1 D$ P2 ~& Z7 A* K. U1 I& L; W' K* G
    xor     di,di
# t( ^1 m3 k5 T    mov     es,di/ N; Y+ W, P" T
    mov     ax, 1684h       ' ^% I4 }/ u- H+ d; J+ U% v
    mov     bx, 0202h       ; VxD ID of winice
$ k( Y4 M! C. I, _, m% y    int     2Fh5 ?* `, k# O) E. {3 \
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
* Z- }' t- ]) |/ V+ I    add     ax, di
  a8 L9 l. J4 p9 \. c  Y    test    ax,ax
. ]3 ^( S: p6 V    jnz     SoftICE_Detected
5 ~* g+ }* u) v2 d" P- \5 ~& V1 Z/ A$ n8 _) Y5 Q/ o2 `
___________________________________________________________________________2 l5 P& s% P1 J4 v; P

6 M& E9 \8 U/ p$ vMethod 04& r: [/ ~8 G' T( r" H' z9 ]* N
=========
: k! D$ c2 |% l6 ^6 D7 z( I
  C' r# Y0 R& m. C  QMethod identical to the preceding one except that it seeks the ID of SoftICE; v* ^( w3 w" O$ h
GFX VxD.
& ?/ ^7 N, S1 ^' [* S: Q. |8 o* p7 E: h
    xor     di,di
- i8 h! I; i4 [2 b. p' C    mov     es,di
$ ~' A( s( j. T0 a' P9 K    mov     ax, 1684h      
3 p& A; G; r8 C; l$ o    mov     bx, 7a5Fh       ; VxD ID of SIWVID$ L: ^/ E. D6 q+ l8 ^: K
    int     2fh
( ~& Y; Z5 t4 _% D0 G. L    mov     ax, es          ; ES:DI -&gt; VxD API entry point+ K: R* Y# C, t. G- ~( O  H
    add     ax, di3 L$ U/ _! w2 A; g
    test    ax,ax
% r* {6 n8 j& ~% E$ C+ E* Q! m    jnz     SoftICE_Detected# n5 {6 o* v% V* ~9 b: W
: R$ m' l( q+ ]/ [5 ]- \7 R9 p
__________________________________________________________________________0 f  h) [& k" `0 ]' W3 z

+ R0 A' ]" k. y8 N2 ?. n5 c
; S; t, L) ~1 Q0 `3 C7 ^Method 05# C& a8 s9 _2 [9 q" R! }
=========' F( m$ }% g) o; {% _, T0 {) X' g
9 C6 F  }  [+ Z4 s3 k
Method seeking the 'magic number' 0F386h returned (in ax) by all system
2 y" U" a/ y4 v3 G( ydebugger. It calls the int 41h, function 4Fh.
/ }0 K9 p' B" Q. C' A" y( MThere are several alternatives.  
4 Y/ b/ C% ~$ x  h$ a' Q! k$ E9 j# w
The following one is the simplest:
( ~( a* F/ a7 d  ?4 i$ g$ N5 l* k9 r& S: s5 A/ A
    mov     ax,4fh
) |8 j" ^) P9 f    int     41h  B* A. D, [6 t- O9 i8 P1 K' b
    cmp     ax, 0F386% m8 _6 y. E: i1 [* f
    jz      SoftICE_detected
0 f* C& {$ Z% u; {
) p/ U& t+ P: W( b, P  o+ s1 T2 T3 B, y3 z8 x9 y" I
Next method as well as the following one are 2 examples from Stone's
* N+ {. p$ N, y1 C# v- X  o"stn-wid.zip" (www.cracking.net):1 u! e) l& E8 ?/ [* |" k

& R) E0 x3 m: w' v    mov     bx, cs
2 Z* \. [9 A% ?0 D    lea     dx, int41handler2
: c; i$ K- Z9 e0 O. P    xchg    dx, es:[41h*4]
( B- j6 C) Z( Y8 `% Q5 L    xchg    bx, es:[41h*4+2]) `2 w; Q: c/ t) D$ a+ M1 a
    mov     ax,4fh. Z9 f! P" K7 P: |. ^8 X
    int     41h
4 [; p, g# ?& o- S; V! T0 U, t: E3 z    xchg    dx, es:[41h*4]. `# z/ w, L8 h+ ?  R" N
    xchg    bx, es:[41h*4+2]
: M0 w6 o( M1 `& _/ s8 G, g    cmp     ax, 0f386h/ K0 v1 Q! a+ a* p9 e; f8 N5 }
    jz      SoftICE_detected
+ ?; K$ x3 u: `$ q* r8 Z  z* I
1 F; i/ Y+ C  T( w( P6 A" xint41handler2 PROC+ S( E+ \& b- \9 V( U) o6 S$ _4 t
    iret
7 S$ N' Q9 }3 p3 N# @: k  {int41handler2 ENDP
; z& m) C' T: U" d7 I
1 r% n, w4 M  W, p: t- E) d
% @) j3 }, Y0 E4 m, P! A0 c/ Z_________________________________________________________________________
+ c9 _# ^9 n8 Q' F2 b9 v: C
: A( O: G3 \* X' r1 X
  B) e1 q$ B  E. C- m$ d8 }Method 06' k$ G4 _; ]9 \6 T( e" a* w. |
=========* G$ v( n' w3 H# {

& Z4 U& H2 ?4 X; c. B$ f7 p- A3 B6 ^0 c/ ~1 c
2nd method similar to the preceding one but more difficult to detect:
3 i& P2 m/ _( ?) b3 v$ o
9 B5 `2 X5 N/ Y3 L4 f# b
6 L$ _2 J, T0 s, hint41handler PROC
$ f% C1 U2 D  B2 K0 q) x7 Y    mov     cl,al
" `* M" X8 n4 V1 ^* u. O    iret+ Q% ~  I- }# _& L, Z2 K1 u
int41handler ENDP9 V) i- _* ^% u! x
' w: I, |1 H9 F0 W" c4 y4 c) ~7 ^
& k2 _. j: b& {
    xor     ax,ax
, T) @7 e8 @' n: H3 m! k& E8 q    mov     es,ax
7 ^9 \' x9 S) h: T0 y1 D    mov     bx, cs+ R5 V/ Q+ p4 r5 n- ~- g
    lea     dx, int41handler4 a' b/ O+ ~/ a+ S' r3 o1 \  z
    xchg    dx, es:[41h*4]
$ t6 C7 M5 x  s, ]8 \& h; A    xchg    bx, es:[41h*4+2]/ V$ o7 B1 b) i4 J) {5 ?3 V: M
    in      al, 40h; p: |; J' ?- Y8 M1 D" s
    xor     cx,cx
. ~4 H1 C/ n" C' k+ h% L    int     41h
3 k& B1 \1 M0 D, {    xchg    dx, es:[41h*4]
5 v' i8 k' }) c; w9 t    xchg    bx, es:[41h*4+2]* g, K' Y; f: @
    cmp     cl,al
/ z4 _, ?2 |0 H. c( P" R    jnz     SoftICE_detected) c. K$ ^# ~5 i4 b7 @" `' C# a0 t

' c) O5 X) O0 n* l7 ?6 W9 K_________________________________________________________________________/ ?7 o! Y7 F2 w& o5 r
2 E# I1 _" Y7 ~5 Y4 o2 v
Method 075 l# ~/ v, O, Y# F8 n# ^, m
=========( m% H, r5 d5 ?2 r! H

/ k: E) A( x' M. X( F, HMethod of detection of the WinICE handler in the int68h (V86)1 {! u& b% A/ ^( s5 C$ E5 T. G

# b6 l; @* b3 Q( f" U5 m1 ~    mov     ah,43h
- F- g7 l" |$ H6 z% p- d* R6 j2 }    int     68h) D& s8 G3 W* t
    cmp     ax,0F386h
+ W+ h' f6 w* y) [' z    jz      SoftICE_Detected
6 D3 k& f! t* N1 {% K  b
, f' i/ E3 I) r1 K1 x% H( a
  |+ ~: w& p' _  i' ~" R=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
( C! G+ q; z" f% C, T   app like this:
2 l# e2 ^/ w% E$ k* l/ d9 @
2 |" Q" Y& Q2 i* A   BPX exec_int if ax==68# e2 N+ v  h" Z) \: r
   (function called is located at byte ptr [ebp+1Dh] and client eip is
% m8 ~/ l3 A! J   located at [ebp+48h] for 32Bit apps)
; R+ M' p  @7 U2 P: @, b__________________________________________________________________________
. {# c- Y# n" A$ H- L
( L5 Q; Q9 [5 w1 [3 z3 u# a* S; g% O1 r7 v6 J
Method 08
( m) `1 X1 R4 c3 W, C=========
+ k! O- x7 }- g% J' r; b2 S, U
/ E9 L( G2 q/ G5 F$ N9 JIt is not a method of detection of SoftICE but a possibility to crash the
% `; a* _) ?8 L7 ^9 P" Q8 Dsystem by intercepting int 01h and int 03h and redirecting them to another
1 R$ j3 `4 H$ V6 a. T* H4 ~4 n; jroutine.
1 Y# [7 M9 u3 M' J. h4 J4 i5 [7 _. H8 bIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points% p" @; G8 C, ~1 p9 J5 o( i
to the new routine to execute (hangs computer...)/ [5 K8 p* _& d5 S2 p, Z

& y1 M& Y, ~, s    mov     ah, 25h
0 A3 A& ]! m8 @& F! @* z0 |! Y    mov     al, Int_Number (01h or 03h)
* C& P3 S; L( ]  S; h    mov     dx, offset New_Int_Routine
3 U' G( o+ X. L    int     21h2 i+ Y5 S8 ]7 i

3 e- c* c2 l$ R__________________________________________________________________________
: d8 C  T+ v' |+ G" _+ Q5 D" n3 I8 [/ F7 A
Method 09
$ J* g9 @# C- l=========: f2 @& s! \* B- A5 G$ Z, y9 U. z2 O
8 c2 Y) Y3 p* ~, p4 K. ?# ^% z
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
. U: `5 c- O( q$ O2 @; i" F' X1 G3 Vperformed in ring0 (VxD or a ring3 app using the VxdCall).
/ c1 t+ q& Q9 ?. E7 gThe Get_DDB service is used to determine whether or not a VxD is installed3 K* `" C( X( o, L, O
for the specified device and returns a Device Description Block (in ecx) for* i6 L% v) a9 Q. A+ W1 Q# d
that device if it is installed.% u( Q- s; Z( g

" @$ y2 z6 X& T1 D4 ?* `/ t- o   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
) L+ o7 R9 F' s5 m   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)0 `1 k1 X& F3 |& [/ z1 z
   VMMCall Get_DDB: C- p% K/ X9 l3 b  m& H
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed" Q# ~7 c& ?! O; o* T# c
8 M) w# B% `% d) i
Note as well that you can easily detect this method with SoftICE:/ x+ U  l, f: e, [8 D
   bpx Get_DDB if ax==0202 || ax==7a5fh
4 L; a# B6 b7 ?( ~1 Y# B
1 b, W; j- x" P7 t__________________________________________________________________________1 {% K  O/ _4 d3 J: k5 _1 R

5 |  l3 v& K3 vMethod 10. v( e; j5 \& g- q3 w
=========, L8 ^: [3 |1 ^' D  G" X% K
# [' Q2 H' s: U8 a
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
3 s0 z& W( C7 x1 l$ e" H0 ]  SoftICE while the option is enable!!/ U+ p. B( l2 R' H* _8 q! }
. Q. R2 ?# _+ z$ Y: V+ D% q8 `* \: T
This trick is very efficient:
/ h# n& f, }5 U; Uby checking the Debug Registers, you can detect if SoftICE is loaded' Y. P$ g5 D+ e  V  w
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
) u: R, E- H' q2 N# H/ Vthere are some memory breakpoints set (dr0 to dr3) simply by reading their( D3 h% Z5 P' U; j
value (in ring0 only). Values can be manipulated and or changed as well2 S+ b. G& _2 G
(clearing BPMs for instance)
+ {7 h) t* P* o' _! @# m. r; s0 X' R& ]2 S6 d1 G' ?6 ~
__________________________________________________________________________8 ~1 T  c" d7 V4 x; H) @; @

* i5 P- c7 t6 E5 x4 U. Z, R6 ~Method 11
, B3 C- ^! ^7 ^* W=========
  m; n" E2 u- V* ~8 H) F8 j' P3 b+ G! H' p2 T1 w. ]
This method is most known as 'MeltICE' because it has been freely distributed# i+ U2 \1 V3 i! e1 x' w7 \
via www.winfiles.com. However it was first used by NuMega people to allow/ {" J9 T& ?/ K9 Z7 Q$ _6 R
Symbol Loader to check if SoftICE was active or not (the code is located
3 _% y! {7 J  {$ ~1 zinside nmtrans.dll).
6 T" W, u$ M$ o, N3 x. G/ U9 G9 z7 E( ^. N) M
The way it works is very simple:! I  I7 p8 U$ f9 Z4 O$ r! s
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
% s; G: a- V1 m, c, G- dWinNT) with the CreateFileA API.% _0 M* E4 k9 m* O8 s
1 B; b; a. M/ {6 V) b" z
Here is a sample (checking for 'SICE'):9 D7 m0 e' a# _, N" [! b; E

4 T# |( o5 ]2 OBOOL IsSoftIce95Loaded()
- n% |# Y' S7 W7 N) o) _0 r{
0 F' [+ V; m$ O! e   HANDLE hFile;  
0 y% ?$ p, r1 R3 j! J/ t   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,
: ^: n- x/ F% n- l) ?% V0 X                      FILE_SHARE_READ | FILE_SHARE_WRITE,5 |; e5 o& t7 |- x4 [- m1 e/ f6 _
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
# W" m; Q, V- W/ b2 P   if( hFile != INVALID_HANDLE_VALUE )* f0 o" R' M+ F6 W- i  J- z
   {
: C2 I6 k8 j3 |$ Z: S      CloseHandle(hFile);
: v" Q+ S# ]- j/ U9 h) ?; Y$ e      return TRUE;
! @& b# X' c9 H2 K* z   }
) y. I2 F7 n1 k2 r   return FALSE;& ^* o2 y1 V9 a6 T8 B
}
# B2 N& N# c  A  @, c8 w( F
9 y+ V3 m3 w' h) _0 |, IAlthough this trick calls the CreateFileA function, don't even expect to be
+ E5 e) {9 _! l  \7 Q6 p( O7 Wable to intercept it by installing a IFS hook: it will not work, no way!
! O* V; b4 L; l. }9 jIn fact, after the call to CreateFileA it will get through VWIN32 0x001F7 m/ |, x- I0 c( X, U
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
, I4 M) T+ {. u; _) V+ F# @3 eand then browse the DDB list until it find the VxD and its DDB_Control_Proc1 a2 K, V( h4 s0 y. L
field.
' M/ b6 u+ `6 p. o: h8 K$ QIn fact, its purpose is not to load/unload VxDs but only to send a 0 _* J4 L8 A. D: j( ^! ?. ^
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)% E' Z: ]/ q7 D
to the VxD Control_Dispatch proc (how the hell a shareware soft could try
7 c% L9 H% x; T& \to load/unload a non-dynamically loadable driver such as SoftICE ;-).
- T. M& n; U& I( e8 b2 ~' `4 hIf the VxD is loaded, it will always clear eax and the Carry flag to allow
) z8 w. B5 W; y8 s% D+ yits handle to be opened and then, will be detected.4 n0 W: }$ |3 y; [. L
You can check that simply by hooking Winice.exe control proc entry point& V3 T! x5 R; e- ^
while running MeltICE.
' r9 J$ ?6 t/ H' z% U- a* g, y; c2 D+ c1 |
( @0 x. E' W2 K: ], h
  00401067:  push      00402025    ; \\.\SICE; p& f# j! J& k1 Z
  0040106C:  call      CreateFileA% j+ T6 E' ?5 e0 W& N3 z7 V
  00401071:  cmp       eax,-0017 w+ y3 e; s( |8 J2 z
  00401074:  je        00401091
) h& N, m7 U3 q; \7 K* i, E# Q
  ?  ]! [# l  f8 j$ t+ Z% J# R1 D0 U' y- J, A3 h. O
There could be hundreds of BPX you could use to detect this trick.: j$ U7 N- N+ b
-The most classical one is:
* S' B: P8 A" [5 Z, K! C$ U  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
5 d, ^9 A9 |: l$ i2 k    *(esp-&gt;4+4)=='NTIC'
2 y' A& @% c; F/ x' t9 }6 z- V
& K& @% p5 Y- A- q7 W% q-The most exotic ones (could be very slooooow :-(% [& j6 e, t1 B9 K( \2 h
   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')    \& m; B3 d* d" v) e  Q# t
     ;will break 3 times :-(% z* a$ a# H( R6 J' ?

: o2 O' _# h' U2 X9 v' e-or (a bit) faster:
* {! u9 U$ n( M# K# n   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')! Z; o% F* h/ |1 k! \; ]7 g1 ^

( [$ l6 k# X4 {" G1 `" h7 ^   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  8 Q5 l9 w- ^! f3 b& k. n
     ;will break 3 times :-(
6 Y0 q) U8 o) f' X" c. h0 n
8 y8 K) V' t) N, A( F-Much faster:% [3 Q" R% T* y& h- O
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
6 d; b, [: G: m4 i; }! j' Y$ {: K6 [! H7 m. x2 Z
Note also that some programs (like AZPR3.00) use de old 16-bit _lopen
) h' Q0 M2 j% ^0 |( Bfunction to do the same job:
' a) U# {" F! m( z& N% a
* E" s, A- _8 C3 S7 Q8 \, T   push    00                        ; OF_READ5 Z2 x! c0 B0 G5 s/ W
   mov     eax,[00656634]            ; '\\.\SICE',0, b* f) O8 P" W; W; @7 f3 t6 t1 L
   push    eax8 f& _0 g0 B7 ]' q2 X) I8 Y
   call    KERNEL32!_lopen
! A  |( L8 s: o* [. `   inc     eax- n! _  R2 e9 k  Z
   jnz     00650589                  ; detected
1 H. h, P' _. G2 K   push    00                        ; OF_READ
3 }7 D+ l' Q! C# ]0 V0 t) `9 r& O2 P   mov     eax,[00656638]            ; '\\.\SICE'
3 n- @( o$ w; {9 z/ [. U9 L9 F   push    eax
" q! Y$ p3 _' O( E) n" Z2 @7 w   call    KERNEL32!_lopen: y6 ?  q) n; Q8 D
   inc     eax
! n6 m/ e6 s% [# s, J   jz      006505ae                  ; not detected7 P; J9 _) X& p* W+ _7 H

. u" n# o& Z. m; Q& r8 V& o4 C' b$ V! h7 d; O* k
__________________________________________________________________________3 a! L8 m5 ~) x/ W" v3 q

% @. ]7 L9 y6 U& HMethod 12
( d( ?, @6 o/ Q& p=========8 L1 h4 j8 l7 B. f' h$ p
- a% T& Q. _+ O: H4 \  }
This trick is similar to int41h/4fh Debugger installation check (code 05
2 u( X8 ~* ?% ^4 i' f! f. I) d&amp; 06) but very limited because it's only available for Win95/98 (not NT)& f8 I( d& ]4 M0 Q! i! m8 n
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.) P  M4 w' q' U

) O" y# I5 H" x# i# H) y# r   push  0000004fh         ; function 4fh
( T$ z, l, x+ f4 s% }   push  002a002ah         ; high word specifies which VxD (VWIN32)
2 g# T1 C( _; L# A' ?& r                           ; low word specifies which service
' X0 H( W2 d3 x; S! p, ~                             (VWIN32_Int41Dispatch)  l4 [, |! d% ?0 ^
   call  Kernel32!ORD_001  ; VxdCall
5 Y3 p8 s% b9 h  e7 `/ D# S& d   cmp   ax, 0f386h        ; magic number returned by system debuggers- k$ s! Q2 K6 m) T5 c
   jz    SoftICE_detected! f# j$ Z; Y# j' ~3 [7 K

* D# F. M4 t( ^  VHere again, several ways to detect it:) F; o3 m' }3 m' _5 \
# j8 u+ Q9 _) {3 G' `
    BPINT 41 if ax==4f
9 c% C# a" w' k5 }- H
5 U# m; d6 f5 [    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
- G" ?0 O* m3 x
6 }2 [! p6 Q5 V" _3 V' C    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
8 h! t+ z: @4 m: N8 E/ u& }; I& D' }2 Z' u! N& {
    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
4 n1 Y  M2 t) H7 f3 w/ a- {
; }, x( g2 ^& |3 Q. K# l  Q__________________________________________________________________________
/ s8 @: O: W5 `& P; M$ }! u+ I$ J% M8 {# y" S
Method 13
1 }; h% @1 F( S1 h- u6 h=========$ {# |  e* ?$ T3 ?$ }5 U

( N, ~. z- u) E! a1 b" tNot a real method of detection, but a good way to know if SoftICE is( k6 @* ?. Q/ C5 n. E
installed on a computer and to locate its installation directory.7 k7 A5 G2 ]  O: B, p0 a9 M
It is used by few softs which access the following registry keys (usually #2) :; U  b# W* l. v4 B' f1 x) v; M+ R! i
4 h! x' K% u' q, `
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion) M& |2 T4 g6 s5 N
\Uninstall\SoftICE
( Y+ g3 i7 C. _. ^-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
2 u. c: v% n. w; c8 u$ P) W-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
: z) f7 a) x) r. j: v9 y\App Paths\Loader32.Exe
5 X3 E) ^9 ^6 @. `- F" H- G& E& L% N: g+ O! J. A
+ j3 d* j4 Z# n- T  ?9 Y! ^
Note that some nasty apps could then erase all files from SoftICE directory1 w0 p# f( R* c7 v/ F
(I faced that once :-(, E& t5 T; p. {% a

0 \' j' [6 _$ x: NUseful breakpoint to detect it:
, C: Z3 y3 C" q1 _# a  v! m$ b* u# `$ H* Z2 g; ^
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'0 U6 e" h$ T1 M& G/ r. z

8 p" F) M- `( X+ i__________________________________________________________________________
" d" D$ G0 L9 l$ C/ Q8 B- {: K6 S, d- ]7 _+ b8 R; q" F

' H8 b/ \, J- o3 J: M& x% A  vMethod 14 9 B+ S* ^; }# L
=========
1 s* K' p! B9 O" H% j$ C/ E
$ q7 M" E. h1 t  b& U+ _A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose( x' y; Y$ M. L+ ~& p$ g7 e
is to determines whether a debugger is running on your system (ring0 only).) X! e" y) Y  c9 t

2 U3 h6 f" F" u4 g4 W   VMMCall Test_Debug_Installed
4 |+ Q1 Y  x) J) e8 ?   je      not_installed+ [4 h3 N$ N: k6 j" \
* t4 [( B2 x7 z9 c& D* `
This service just checks a flag./ y: ^1 X: [5 h$ C% t: y! X  N
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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