About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>* @% R- i4 v& M+ N
<TBODY>
* \( l. I( M( |+ Z5 _<TR>
4 O0 U  r  a0 l" q1 Z<TD><PRE>Method 01
, v. F) k. r6 F* p$ F% ^=========% b% t/ {, |( N- Q

6 `* A7 a- F6 rThis method of detection of SoftICE (as well as the following one) is7 r  Y8 f! `! h- g2 V
used by the majority of packers/encryptors found on Internet./ Q7 c. k3 }+ S1 T, l! {( y  P) y  C
It seeks the signature of BoundsChecker in SoftICE/ ]5 u5 b0 G& U. v" B

  {9 U+ T/ A+ ~2 J    mov     ebp, 04243484Bh        ; 'BCHK'7 r3 b* P% h+ o' Z$ ]
    mov     ax, 04h# L7 J( D/ n: R: @# Q& w& [# r
    int     3       # l1 H- I, q3 w, u" t
    cmp     al,4) a0 z" l2 y+ u% s2 r% B
    jnz     SoftICE_Detected
! l- P  I- A- l* A9 a& J1 u* Y) e1 m& _
___________________________________________________________________________
7 t9 T! T" p; J: w% _0 Z" r; p7 J$ M$ Z+ W( [" m% X
Method 02' v9 |3 w6 H" A( _! y! a" m
=========
7 @# @0 _& A# c3 w* I% f* f) E$ L  }+ a5 S9 }
Still a method very much used (perhaps the most frequent one).  It is used' L4 F3 D8 u1 \' n1 q2 L
to get SoftICE 'Back Door commands' which gives infos on Breakpoints,
0 o# ?9 }' S1 j- R& Bor execute SoftICE commands...
6 A) Z) n7 U4 R1 T" [# WIt is also used to crash SoftICE and to force it to execute any commands
% j% R8 B; ]/ m& w8 s3 _9 D(HBOOT...) :-((  
+ i! O6 |$ z5 S1 J# S6 @
8 [7 W1 u0 e! i& {3 ~. iHere is a quick description:% v* r2 @7 h( M
-AX = 0910h   (Display string in SIce windows); G- H1 s" ?# X
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)
: Q7 J% M  |/ ]1 R-AX = 0912h   (Get breakpoint infos)
$ ]. }6 r7 L: w/ E. I-AX = 0913h   (Set Sice breakpoints)
" h) q: `8 z4 R. D-AX = 0914h   (Remove SIce breakoints)
6 C* Q7 p$ a' u. {' v  {+ k% p: l$ t3 S
Each time you'll meet this trick, you'll see:
3 V- G* j, y) b4 Z. F: l1 ?-SI = 4647h
8 Y0 Z! q" z( ]7 @8 B! V, z-DI = 4A4Dh# _8 D4 ?) b$ e) f
Which are the 'magic values' used by SoftIce.
1 F6 C  g0 ]% S7 VFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.( b8 {4 W! \" g6 e6 R# k7 T8 g# o

; j7 t2 h+ J4 f4 j9 X) H: p6 `Here is one example from the file "Haspinst.exe" which is the dongle HASP
' x0 i# A( }* X  K4 m' j/ X0 U; EEnvelope utility use to protect DOS applications:2 R3 j2 }' K- r1 `
& V# g+ u4 u, h9 t3 Y9 G- m/ t5 p

& h; T; m) c6 h( s$ a' `5 l# t; c4C19:0095   MOV    AX,0911  ; execute command.8 |4 n+ N9 N. C5 r1 U
4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below)./ \( ^5 |$ O0 Z: T
4C19:009A   MOV    SI,4647  ; 1st magic value.
* n0 Z7 g3 k, H, a0 [4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
% K* ~7 B# S. {0 ?$ S; @4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)
( @* v$ G+ P& Z, N" S, `; q% b4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
' g; \% h  r) Y# A4 L( T" j4C19:00A4   INC    CX( a$ ^7 A5 _# A% c, k& [) k
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
' r" `! x( w6 _- G; @4C19:00A8   JB     0095     ; 6 different commands., e- l: W+ ~4 V' Z' r) ~
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.7 {; e+ }# n4 m' J. a& I* ^9 T
4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)! T: j1 P6 j( z' P
# W- N8 |5 U1 \3 c
The program will execute 6 different SIce commands located at ds:dx, which1 F9 C( |! I0 K. ~3 v. P3 n+ V$ L9 W
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.& l- N, ?1 Z" b) }3 X

1 n" k+ t; f5 p$ O2 \+ _* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
$ {" U' R) Z' w; V9 }% L: M, H( o___________________________________________________________________________! f! e  i2 [9 |, V% F# B4 z. j) j
$ ?  u; a" _( X# b4 M8 g5 `

7 ~) a) q# O9 @Method 03
  [+ T: b* v. d5 \=========$ u7 i3 |7 {; r  R8 L+ ~

1 a$ k- U9 ~4 u0 OLess used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h! _) \; j- m8 c( J3 C0 P% Y5 L6 d
(API Get entry point)9 B! b! m) K7 t+ f$ j8 ]- H: I
        
: w. a5 r- o4 ]
% L$ E  J& G, `. _4 t6 W* A    xor     di,di
, L& q& _1 f3 p) Z' Q9 Y0 j! [    mov     es,di
  m9 ], \) G2 N, R# L; b& [% S    mov     ax, 1684h       ! u# P; {5 Q4 }8 E: D# R
    mov     bx, 0202h       ; VxD ID of winice2 S% X7 l6 c* D; \) `  N
    int     2Fh
! r" X. Q: _) j( N* R+ u    mov     ax, es          ; ES:DI -&gt; VxD API entry point: Q) \5 n1 |& d# e& u: z& q
    add     ax, di& P, d# J4 I' O+ r1 R3 b1 M( v& E6 j
    test    ax,ax
2 S8 h! u: i4 o4 B; j: R    jnz     SoftICE_Detected5 ]% n* P* W) r' {) c# T  T
8 P. l! x' I) `! I
___________________________________________________________________________
6 p  \: J% z  s+ j1 x9 P. o
( m" N7 r! d/ C: C% }8 E& Y( T& x7 a# FMethod 04
* Y8 Q, H8 C$ I=========
/ ]4 K* p& v3 H
6 h8 e) K% I8 r0 cMethod identical to the preceding one except that it seeks the ID of SoftICE; Z& ~; ]( p  F* Z; O, W9 A, s! S
GFX VxD./ [9 U  g7 F6 a0 K1 s
0 A* A5 T( y2 r; `* \/ k5 v2 ]
    xor     di,di
9 g# T9 M, f9 H( ?    mov     es,di
' h: B7 s* R* k# f7 x# m    mov     ax, 1684h      
& j* T" o# Y. z& a+ |    mov     bx, 7a5Fh       ; VxD ID of SIWVID& r; m1 p7 c; M+ }, m/ l
    int     2fh
/ \. G# K0 ~; \* S' m* F    mov     ax, es          ; ES:DI -&gt; VxD API entry point+ j$ ~5 D4 L! y& ?2 @
    add     ax, di
2 Y) d% S3 A) X2 f    test    ax,ax: a( F; k4 ]; r' N+ W
    jnz     SoftICE_Detected5 K1 y1 R8 q9 j' \1 E& T6 F( Y$ d
" D- V5 L6 Q* s
__________________________________________________________________________
0 q. U) b2 a# N
& x8 c" X# q5 D: i# Z; J0 |$ v$ p- o) B
Method 058 {8 @) L# I9 h0 g0 l' Y8 {' \
=========
# C# n$ _/ @* @, i; k- `
# ^: J9 f/ ]4 e+ U5 [Method seeking the 'magic number' 0F386h returned (in ax) by all system
& z9 b* [" p' Q$ a1 O5 g, gdebugger. It calls the int 41h, function 4Fh.
: f: K6 L2 c0 h3 L# X8 u4 ?There are several alternatives.  7 [- }4 O! \+ W2 o9 h& b/ U' P3 Q) u

2 Q7 c  }) \, k7 l! P% `3 k* N- b( [8 rThe following one is the simplest:
) T; {# j; T  B8 n: K, I# ~- v$ X+ }" \% f& K
    mov     ax,4fh6 B5 d' M$ z+ i4 Q1 N% K& l
    int     41h  b) y$ V4 R3 W. j/ z: }) o
    cmp     ax, 0F386
, a/ u, R, f9 D9 v/ J) f7 b% `    jz      SoftICE_detected6 Z, _5 s8 C1 q7 Q! ^6 t& u
. v% g+ c$ F; o" g. Y  C5 _' `

5 h" A2 A. Y+ ~5 K& [Next method as well as the following one are 2 examples from Stone's 0 N$ Y. {: J9 C) ]: P) s; ]' b
"stn-wid.zip" (www.cracking.net):! ^2 L/ l7 g: I, j

8 G; ]5 }+ H5 w% r  v) m    mov     bx, cs
6 ^6 u2 {6 g' D" Z6 }' k    lea     dx, int41handler2
: |& P8 Z3 r1 N+ |1 {    xchg    dx, es:[41h*4]& t/ u/ I/ w" }# q
    xchg    bx, es:[41h*4+2]% j8 s2 ]+ D& t
    mov     ax,4fh
$ z& ^0 f( ?# I. ]# E7 z+ r    int     41h
; j5 _4 [. ]$ X: w) A    xchg    dx, es:[41h*4]
! E# k4 w( }: p$ @' U2 ^# b8 s5 d  M2 T    xchg    bx, es:[41h*4+2]* Y5 S  A2 k  F/ A) ?4 q+ R
    cmp     ax, 0f386h- N7 Q+ j0 z* F! h0 n
    jz      SoftICE_detected
1 G( W/ G" x: v$ B
) t. Y4 B! g) n; Lint41handler2 PROC
# K, [/ i; n9 U2 b( O" r    iret9 M0 d* z; D/ R% J  Z# s9 ]( r
int41handler2 ENDP
5 }! r5 l* e/ p' K) C9 N! U, s
( g2 c& B: C8 a
/ E+ _; t* W/ U1 J_________________________________________________________________________
! f! _, r+ |1 r& r7 z& y
. F) Y4 C4 c7 H1 T1 K9 E' i' O' t+ X! ^  J4 A0 G1 q
Method 06
4 J$ C8 b; G9 W! W+ p7 Z% g=========
% M/ i8 V% {1 c3 i% r) [2 r( T$ {- v3 p5 E* Z* G
7 T6 v; z0 T4 w* D. _2 a$ g
2nd method similar to the preceding one but more difficult to detect:
/ M3 Y  ?1 M9 A5 d6 l
4 B! `' `9 s; n- n) S
! L% E, L0 C. I, Y' wint41handler PROC& K% V1 Y/ _" Y9 L! u. b. `+ V
    mov     cl,al
1 }0 [2 \& k+ B+ }7 P    iret4 D" `, z) R! j* [
int41handler ENDP# @& w; M3 ?; ^0 z- X4 Y0 w

. N3 ]+ J+ k1 L; q7 k' N5 `  U7 F' o
- j! t( v" W, B: G    xor     ax,ax
$ e! G# p- F! u: E    mov     es,ax
5 H- Q- t' `0 o% z, W( [5 E    mov     bx, cs
9 |7 Z% t* p4 C3 u* U4 q3 r8 V    lea     dx, int41handler) u/ Q6 O  Z# b' c3 H
    xchg    dx, es:[41h*4]% l1 ~$ ?! b- k3 o( f% Z- {9 h
    xchg    bx, es:[41h*4+2]
$ B' t. H0 G/ r* j" d    in      al, 40h& W6 Y4 r$ }/ P, X9 M0 U4 L
    xor     cx,cx* \% ^; I& p8 U4 a
    int     41h6 p2 g$ a- S# `, K5 W
    xchg    dx, es:[41h*4]/ Y) s8 J) p+ J1 {! ]
    xchg    bx, es:[41h*4+2]6 z6 [2 o: A/ r. a- Z: J2 U
    cmp     cl,al
5 q7 \: z- L* M3 j" X) c* p1 Q) `    jnz     SoftICE_detected8 r8 P' a0 a. |7 m/ i
7 Q7 k2 Y5 J1 u8 O, w4 l/ r
_________________________________________________________________________
" W1 R1 ^, h/ X/ G5 k' n: z  A7 x! c( _% w. u/ H% H) A, g0 `
Method 07
2 i/ w% }; A5 Q% f( v=========0 p6 k9 v# o8 {+ ^% J) c

4 u8 l! t1 |/ _Method of detection of the WinICE handler in the int68h (V86)* ^7 V/ i. W+ z# m% ~
' \* s/ M( `8 f, Q. \' |# G
    mov     ah,43h# [  f, E5 T/ U$ l
    int     68h
5 K5 P, ]8 G0 V, U' n' r9 h    cmp     ax,0F386h
5 S; B: y6 f  h) W& N    jz      SoftICE_Detected4 f4 e( J7 d% q
8 ^5 j' w9 r! T! ^
- U! o! \3 ]3 ~! N8 V
=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
6 c5 c! I2 e0 [, |   app like this:
" C: J' ~9 y8 r: ^( ?6 J, O& Q6 c$ R7 l/ c6 V7 I( `/ B
   BPX exec_int if ax==683 t5 R/ q2 v* \# |3 t& Z
   (function called is located at byte ptr [ebp+1Dh] and client eip is
& P* e; s* F9 b( F   located at [ebp+48h] for 32Bit apps)
$ F. @: x0 W+ }! ^; A! g* z__________________________________________________________________________
. J3 d% u- O* T) Z' g9 {* Q
' `2 r/ L! @; l" O+ b) ^& y! L: V  C/ X* n" F/ D! b
Method 08
, d8 }+ e/ s1 S$ r4 a- O  F/ x8 Q: s=========( V1 l, i7 v0 C# z+ ]' L
( L$ O+ A; r; G& a/ Q
It is not a method of detection of SoftICE but a possibility to crash the2 r5 n3 }: T( O
system by intercepting int 01h and int 03h and redirecting them to another
1 O2 z, ~# b* A0 n2 }routine." S9 l6 G9 t3 \# B5 \9 _, F9 g
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
3 O$ S$ R1 J. K$ Ato the new routine to execute (hangs computer...)& |2 p1 ^. f4 t9 i
3 _" }, B4 D# L) u7 O' b
    mov     ah, 25h: d$ l4 \/ X% P+ P
    mov     al, Int_Number (01h or 03h)
) M9 [& `, v$ A6 \    mov     dx, offset New_Int_Routine/ t2 K# N! b( m
    int     21h0 D' h) g0 l( I! I& S8 g/ @4 ]

# I: I# V) A0 a9 B__________________________________________________________________________
  R7 m( q3 c( x5 {- T+ _6 N( a8 c1 f7 q
Method 09
+ o, U. z! p. R2 p=========" w9 n: _' r$ _

$ j# P; |" ]8 S/ U7 xThis method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
3 {; V$ A8 s$ y, C7 Y% V- Y+ Iperformed in ring0 (VxD or a ring3 app using the VxdCall).! j+ ?2 e! Y6 M, n( V/ E
The Get_DDB service is used to determine whether or not a VxD is installed6 k% N4 J) P3 [0 o5 [
for the specified device and returns a Device Description Block (in ecx) for5 x; x# \0 L. P+ X9 S
that device if it is installed.( A$ K7 b, [. }0 K2 v

; h7 k, e* X$ \2 E2 `: Z" j   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID2 L1 Q* \4 ]0 |- |
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)3 h) ~3 |# X" a% c8 N# R
   VMMCall Get_DDB5 M3 y; a) f8 ?! q
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed( k! l( t& a" {6 X3 T6 a
  `' T! X& R- ?+ o# I9 k
Note as well that you can easily detect this method with SoftICE:
' ~" @! v* ]' H9 t6 X+ l' t   bpx Get_DDB if ax==0202 || ax==7a5fh
, h3 G9 V  w- U9 Y9 R* O/ _" `3 h7 W
__________________________________________________________________________
% l+ p- `" X* [) J* e; C$ y8 u0 [% w0 M
Method 108 s: F  s0 C+ J/ K
=========
, {& L5 E2 y/ l# A# f2 D$ j/ Z) Z* i% X; C% c" D& t
=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with" I) z! ~/ A- t8 c9 g2 \
  SoftICE while the option is enable!!9 P4 C9 r8 Q" ^: L# L. L& Z" a
. M+ P- k" L) k( `: r; L
This trick is very efficient:
7 t0 }. w$ c1 z) V3 Bby checking the Debug Registers, you can detect if SoftICE is loaded# S, v- [6 C" Z* n4 E6 Z3 L
(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if1 X( \1 n" A& \
there are some memory breakpoints set (dr0 to dr3) simply by reading their
# }3 r7 \7 c$ s" v! h% w$ S& z1 Evalue (in ring0 only). Values can be manipulated and or changed as well
6 e( _8 b3 y0 [, y5 S9 r7 {7 W( l* u# i(clearing BPMs for instance)
8 ^3 |+ R. g1 C/ e0 x3 ~6 R. S  F
1 a* p' F* g& I- X5 d9 |; F0 L8 P# U__________________________________________________________________________
6 K/ N' `4 c0 |) O7 p6 p6 j
) y; u/ \+ h% x8 g* L1 pMethod 11
' F( ]8 z2 |/ X2 q4 J! w+ B4 |( x=========
/ c/ g; f& x* y( t9 \2 [/ Q  Q. Q- F- X3 }
This method is most known as 'MeltICE' because it has been freely distributed
6 f) ]1 s5 o+ S, i* o; V3 M7 mvia www.winfiles.com. However it was first used by NuMega people to allow
3 z- T: [5 k% ~Symbol Loader to check if SoftICE was active or not (the code is located
3 t* e4 |# G9 F9 Z! ?inside nmtrans.dll).
% o3 m, ]  b9 V& P% [: z3 s$ x$ H$ ~
The way it works is very simple:
" P8 ~/ v6 @: f9 n" u  M/ RIt tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
, d, l1 J: k/ q' E% o/ n/ F' tWinNT) with the CreateFileA API.
  q9 M! M$ Z0 |5 @. Q# }: D; O  d, E" s
Here is a sample (checking for 'SICE'):- w7 W/ q/ |9 m8 C" c/ ^
1 I* @5 t9 [: p& D3 Y, V. a
BOOL IsSoftIce95Loaded()" `& b* {& F4 }
{
; o) e; \3 ]3 y) B& V8 M. h   HANDLE hFile;  - P7 W/ \- |$ @( x; |
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,+ A2 K1 U5 o8 N" s
                      FILE_SHARE_READ | FILE_SHARE_WRITE,
! v! M8 f; \2 {+ h" ~4 {+ e                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);: P: ]$ g0 Y9 Y; L1 I5 F6 I
   if( hFile != INVALID_HANDLE_VALUE )1 _) [! B6 k' ~) y: A
   {! ^* L9 }2 B$ h3 R- W+ ^
      CloseHandle(hFile);
( f% m- L# x" W+ }1 u) C      return TRUE;
& @! p- ^+ X& n6 W% ^! ]5 [. f   }% M/ N, d' c  v
   return FALSE;
2 Q  ]' L3 n$ _# w}( L- u  {7 T  c, C) J  q
0 n1 O1 s) E4 Y& b0 i/ n; x$ A
Although this trick calls the CreateFileA function, don't even expect to be
0 P! B6 {  j% W+ C* zable to intercept it by installing a IFS hook: it will not work, no way!! L' ^8 E8 o" F* x6 A+ p3 ^
In fact, after the call to CreateFileA it will get through VWIN32 0x001F, N6 M2 e, [+ F/ s* T
service _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)7 k* Z1 N' a# b" G
and then browse the DDB list until it find the VxD and its DDB_Control_Proc" D4 _1 g- ^+ O
field.. E: I& R) q" c% s3 J; M4 [
In fact, its purpose is not to load/unload VxDs but only to send a 1 N, m( g" O6 q3 S) H
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)" k% H: \0 t) d$ R8 K
to the VxD Control_Dispatch proc (how the hell a shareware soft could try
- q1 m" O& M4 h9 V# rto load/unload a non-dynamically loadable driver such as SoftICE ;-).3 L" k5 X5 A8 N8 n/ g
If the VxD is loaded, it will always clear eax and the Carry flag to allow/ B: b# t1 j' V6 s
its handle to be opened and then, will be detected.& b& \. y. P# N8 c# U
You can check that simply by hooking Winice.exe control proc entry point
: O' |2 S( `1 o  fwhile running MeltICE.
. l* |3 ]4 y& A2 R. p( p* Q- ~1 @. a5 m+ P3 S# D9 v

. {# `* U/ X. @  `+ w- z; o+ C0 ^  00401067:  push      00402025    ; \\.\SICE* R: _5 W( d1 n3 i2 D& P
  0040106C:  call      CreateFileA
' d+ j' N, I! \$ V* p  00401071:  cmp       eax,-001
; N, q+ J- R4 ^: i6 O2 _  00401074:  je        004010917 \# [8 H# k6 q
0 L! n8 t9 \- I* V; R# j
7 R0 n9 j3 o! i2 Y' R
There could be hundreds of BPX you could use to detect this trick.
/ K! P# u( `+ t4 I8 a8 h$ |-The most classical one is:  ]3 A9 B4 X, X* n2 x0 i7 o) t  M
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
7 |/ A5 V' n4 f  j% q8 z' B    *(esp-&gt;4+4)=='NTIC'
" O+ i! J  a/ a6 ]3 K1 W# K
- v- `! r2 \* A-The most exotic ones (could be very slooooow :-(
1 U9 V! v* L$ q' z- S5 B! G   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
* v$ z: K/ Z% b" w+ D( ^9 F     ;will break 3 times :-(6 V6 q$ d) j  O' y4 I+ m5 y( Y. W7 {

5 C$ D' L+ J! ]) c3 H; S-or (a bit) faster:
6 h" a& x' F) x2 A" S   BPINT 30 if (*edi=='SICE' || *edi=='SIWV'): ?5 {( v4 w/ o, Q, T

8 A9 u: n! ^5 b; f% U4 N: p6 A1 ]4 ~   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  $ M+ k; w: h  P9 X5 f+ X
     ;will break 3 times :-(
* a5 Y0 U/ w) k& [: X' L/ n; s8 n) x+ W8 z# n/ j
-Much faster:$ i6 B4 r/ \. Y" {# {, u# }5 ?
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'
; s& T$ h& {% `
1 c% x6 k6 ~# y4 b4 k/ [Note also that some programs (like AZPR3.00) use de old 16-bit _lopen% K: A' G  k6 _9 h
function to do the same job:
0 m/ F+ p6 P: d" G0 {5 P. N$ L# o& ?* c& t7 @( @
   push    00                        ; OF_READ
+ V7 }$ G. D" c" z3 n   mov     eax,[00656634]            ; '\\.\SICE',08 g, u4 M- z, {( I
   push    eax
* D- L. D  {/ i) u) e! f/ ]- b1 a2 k- @   call    KERNEL32!_lopen, o6 X' W) s6 c' J% T- l  @4 S
   inc     eax' y8 j7 q; J/ a) |
   jnz     00650589                  ; detected
* k. A' t% f/ V6 W   push    00                        ; OF_READ* A; w+ T8 ?7 R: `/ e0 H9 \5 g
   mov     eax,[00656638]            ; '\\.\SICE'
: z0 g; v. f, U   push    eax
; C6 s6 y/ Y* s& O( P/ @; {" _+ g3 R   call    KERNEL32!_lopen% c/ T3 [: x8 I$ p- R
   inc     eax3 g/ u$ b4 K7 v" n/ a' N+ a7 z
   jz      006505ae                  ; not detected' K$ c4 E0 U( }# ]3 P  f" ^: y

: S/ ]% ]# \9 ]" _5 j( R# k
, q4 M5 K- W0 \! j0 R& q__________________________________________________________________________
) e+ c7 M/ \) J, Y
1 ~& D! ^& v  T0 q6 fMethod 12
* A* }/ I/ y7 _) I& ~=========
# R1 P  U8 d- {
9 `% @4 S3 W3 \' w' uThis trick is similar to int41h/4fh Debugger installation check (code 058 [5 @$ H% j7 Y0 K( {& q+ x0 E
&amp; 06) but very limited because it's only available for Win95/98 (not NT)# j- t8 K! H2 }( ^# a5 t! W4 ^
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.' y: H) N! H- T- |' g; f/ t- _
4 S) p4 o8 \/ K( }  d5 K
   push  0000004fh         ; function 4fh
; I; y/ W+ @# C   push  002a002ah         ; high word specifies which VxD (VWIN32)
, z) l. X9 G& [6 f# P2 x                           ; low word specifies which service) \; w9 ]. m; {  x& b/ z' ?
                             (VWIN32_Int41Dispatch)2 V& d0 b% _+ r/ I% W" \
   call  Kernel32!ORD_001  ; VxdCall/ |7 V7 v" a1 S5 S' ~
   cmp   ax, 0f386h        ; magic number returned by system debuggers
) y( ~& @3 M. Q1 k# F   jz    SoftICE_detected
; a) p1 Z) q# W! X7 Z; \6 M* L1 l# s2 c3 L1 e9 j8 g  p/ I
Here again, several ways to detect it:
. n* A6 s6 Y: O1 {# x9 @, x  D  i" n, Y5 n5 r/ n2 U0 S/ V
    BPINT 41 if ax==4f, w2 ^' K% P0 W% b
+ I' R- m* z7 _, p
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
2 e+ I1 L- C5 l% Z7 B/ T7 i6 r2 H0 a: l" l6 R1 L
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
* ^; W) Z  s6 y5 g! Z9 a
9 ^2 T  u  Y3 F+ B0 B3 h6 t3 Y+ T& o5 ]    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
' q1 x8 A. Y" A; }+ w( g+ Y& _( r5 `( L
__________________________________________________________________________
# e. ^% O" M' L, r+ I1 h
4 d' O; d+ y6 ^0 H$ I$ tMethod 13- Q. P5 y0 o3 M
=========9 c0 S  g2 L. Z, e: d0 ]
' S- Y3 r6 U/ m  j! O
Not a real method of detection, but a good way to know if SoftICE is
% `& S+ B- I' ]: {6 z1 P" Dinstalled on a computer and to locate its installation directory.
8 P! X7 h) ?6 X- G& ]It is used by few softs which access the following registry keys (usually #2) :
* H( H7 n3 H: {1 h) z& i% ~' r8 X4 ]0 u+ _$ P4 m# o2 ^! [( j5 t
-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion: I9 |3 f: v2 i8 \
\Uninstall\SoftICE! e$ U: y$ m' ^& h7 l- Y
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE' I. c2 k' e  s9 \$ q0 T( }6 ?
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion, h- Z8 }; F: n
\App Paths\Loader32.Exe- l9 l; F) W8 k; U' x

# L2 C0 c9 A8 f5 O; X( U6 O/ k9 ]1 ~. o) J3 Z4 e' @+ w0 k
Note that some nasty apps could then erase all files from SoftICE directory
" \( U# P5 z6 D( m9 s- n  {+ i(I faced that once :-(
" K2 C4 T0 a3 z: e
9 v; P/ Y$ a7 ~  o7 t8 i- d8 hUseful breakpoint to detect it:
! w0 o5 P0 F0 }! r7 i6 u+ t) C, d+ a  i% b6 m! Y6 S
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
# O+ V# E& m; [; G+ a. s) [' O9 F% E& t! Q8 D) Y3 v. D
__________________________________________________________________________
, \3 k) J* n- p9 P6 ?9 _" n0 @
% t/ \, W0 S4 a! `/ G7 m
4 W. C* W# p- G, q' W1 R& HMethod 14
0 h3 S8 X# [; G2 z# m9 e! O=========3 R# ?& O) p# x' b* o
1 {9 I7 V/ R* A6 K( U1 y/ C4 m
A call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
2 M* P+ o$ K) O, A. E' |! N+ sis to determines whether a debugger is running on your system (ring0 only).
; T& @' J. L( U5 N
% g. a# @7 M/ o) k% R# S$ m  t   VMMCall Test_Debug_Installed# R! f2 ]) D4 i$ k" L3 o
   je      not_installed
8 n' @3 E& k/ T/ n4 i& x- i0 g6 L: d
1 S: @3 w4 o0 e8 tThis service just checks a flag.0 N8 ^& f( u; n* {  \
</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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