About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>* f9 _* x" J4 o; r: T( E9 Y
<TBODY>7 N2 g. h3 p, W
<TR>; t8 s2 g. q# w+ _5 k, j
<TD><PRE>Method 01
' A5 v+ [- G+ c. O3 U9 D. T+ c5 W=========
/ K8 ~' U& P$ y6 D& Z. H. a! A( x( Y6 X/ r# L5 ~+ r4 X
This method of detection of SoftICE (as well as the following one) is
% A1 U7 B7 h/ R- S0 _used by the majority of packers/encryptors found on Internet.
% w9 i- s- T  lIt seeks the signature of BoundsChecker in SoftICE
4 |' h! A. b9 Y8 J) K) b5 z
5 B. Q5 C  h" I) |- O    mov     ebp, 04243484Bh        ; 'BCHK'! E; I5 p( Z9 n3 F9 |- a% q
    mov     ax, 04h
' U& V6 k+ g) u* A& n6 V    int     3       " H+ N) l- D: N9 K. G, c5 e
    cmp     al,46 b4 M$ i/ I6 N  @4 j) g, h' e) O5 x
    jnz     SoftICE_Detected
: a& A0 l& w# n# c- {
0 B  |; i) c5 x9 J" f___________________________________________________________________________
+ h% f0 o- \+ e' t8 r# ?; ^5 y  }
3 k" y: A( ]: K0 [) fMethod 02
8 ]2 b3 W9 h; X6 q=========
% r  W0 J. M, O% t. `/ V2 `  ~
9 ^- J0 F! i( r+ q- bStill a method very much used (perhaps the most frequent one).  It is used
8 U3 a1 ^4 s' I5 H5 X" y% oto get SoftICE 'Back Door commands' which gives infos on Breakpoints,2 r3 [1 R+ }* u7 y2 @( _3 g: Y7 _
or execute SoftICE commands...
3 S6 [- U4 a( T: o# ?It is also used to crash SoftICE and to force it to execute any commands& ?% @( [9 V* _3 \# U7 X% ^
(HBOOT...) :-((    M* _! C/ e! l  X; b
; V4 J% E4 o8 P* Q3 d
Here is a quick description:* i4 e) U# m( h- z  Z5 i. [% p
-AX = 0910h   (Display string in SIce windows)
* k, i3 e7 Y' q# a8 S-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)1 {% O  @. e4 k; g$ n: ?
-AX = 0912h   (Get breakpoint infos)
0 H: X: @+ f/ X" v-AX = 0913h   (Set Sice breakpoints)$ N' y( t( L5 |  s, _* H
-AX = 0914h   (Remove SIce breakoints)1 S" z4 \5 N& v9 G" k

) z, d+ h- U& v2 q- Y8 a5 q" `Each time you'll meet this trick, you'll see:
* y% [/ l2 `. v+ c; F-SI = 4647h
( g) V$ m+ U& i1 [8 e6 j9 z& ~2 ~-DI = 4A4Dh
' \- ~6 A7 n% s6 f1 ?+ nWhich are the 'magic values' used by SoftIce.9 I2 C0 |7 K' i* |% ?' |! D8 H
For more informations, see "Ralf Brown Interrupt list" chapter int 03h." G" H5 Q0 k# z9 c6 w

' L0 [9 ?% ^; wHere is one example from the file "Haspinst.exe" which is the dongle HASP
, r! C  ~+ @% Z6 jEnvelope utility use to protect DOS applications:
- T0 k, t. F/ [) f) b
& o: q/ n, [+ E& w) I
0 I8 h, C9 ~2 \4C19:0095   MOV    AX,0911  ; execute command.
; F" o5 u& A* X/ H# U, ^! H% H( [* L) r4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).# d( P) m# V: v8 \
4C19:009A   MOV    SI,4647  ; 1st magic value.9 c. U& G* F! ^( R# I- B5 a0 e$ q2 U
4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
. H* ?1 H! {7 H% s4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*)% l/ n+ J$ W4 W" m3 J9 y9 `
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute
, Q' d) M+ I: y: m  L# d, V7 w4C19:00A4   INC    CX1 B7 o. `7 P) c8 p
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute
" K7 \. F( A; s- O4C19:00A8   JB     0095     ; 6 different commands.; T. o& a5 J2 V( k
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
' e; S  W% ?/ |: x$ Q7 s4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
: }7 o$ Z; p2 a1 @" ?. H6 K) r1 |% G- G* S; @- p) q
The program will execute 6 different SIce commands located at ds:dx, which" |$ |9 s; ]; C4 T# u  b* S
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.8 G* ]6 \/ Y% K1 ~, [0 ~7 f& }

/ M' {# g0 M9 Y8 g% g9 w% y* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.% O, s  x7 Q0 e, P" T
___________________________________________________________________________
* D, V' W7 U; ?4 O) P4 K2 h- ]1 k# L5 t0 {

/ {1 W8 }. ]7 ?0 vMethod 03
, J4 v9 F8 Z4 T/ H; \; m) `=========
0 z  U, D5 U% ~6 v" W! e3 w; Z% ~& K: m& I' r9 ?4 h* A
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h
! D- n: S( V7 I8 o$ }0 i(API Get entry point)
7 R4 k1 `. H" m+ J7 J4 M        
1 u# |+ E: T" h6 Z+ t$ i4 G
/ n2 D4 W: i2 K' ?. ]- c" U4 i$ F# h    xor     di,di
9 R6 U2 v  z( M* U: Y0 \8 Q    mov     es,di
, i- J1 E* `4 t- R: h( c- Q    mov     ax, 1684h       5 `2 b* p! K+ R: O7 G1 z
    mov     bx, 0202h       ; VxD ID of winice/ G; w( {0 {5 _
    int     2Fh
& s% ^3 E3 U; G$ p    mov     ax, es          ; ES:DI -&gt; VxD API entry point# l* S9 _% k3 ~: c
    add     ax, di
' c  o- X. y, G# d5 z    test    ax,ax' ^# e) c1 S& i8 A' d$ Y
    jnz     SoftICE_Detected
' M+ X$ ~" e1 W1 t8 `2 D7 q5 A7 _
/ S7 P% v7 s: h: ^___________________________________________________________________________# e6 k* }* B% {: l
1 D: w9 t8 n/ V. Z3 ^
Method 04& ^" E! P) i$ E* R
=========% v: ?8 }  S  ?' _$ C
# x) K( e* I/ c: j
Method identical to the preceding one except that it seeks the ID of SoftICE
7 A3 v2 J$ g6 C8 TGFX VxD.
1 b# ?' O! ^" W
' ]* F$ G& }/ g, {% C* y% B    xor     di,di7 r( C# Q! x7 e5 _, g: \4 ?$ Y. _
    mov     es,di7 I. r/ _3 Y; x& f) y
    mov     ax, 1684h      
8 ^, y) I: \- i6 B) V5 x  y    mov     bx, 7a5Fh       ; VxD ID of SIWVID( f- {5 y" o4 t5 Y6 X8 I. |! X+ e
    int     2fh; x! B8 H% K) ~" M4 q' i! n
    mov     ax, es          ; ES:DI -&gt; VxD API entry point
, a8 |) C- ]! i( M( O8 o& O# F. D# d    add     ax, di
) L/ c5 M" [# X' G$ c! F$ C0 Y4 B    test    ax,ax
" h4 G- u9 I/ m) z1 g    jnz     SoftICE_Detected
4 ]/ w: h. q: z
* A. l+ @% Y1 ___________________________________________________________________________( a" g1 S8 S) V* d& y5 o4 `6 x. x
$ C! E5 p  }$ [0 |2 B  }+ s" H, c
& k- d6 k. S* J; B: ]* w
Method 054 I9 `! [4 I* ~4 S4 \) M
=========
; @8 M' a8 m9 I& O" u/ c) Q" f$ [3 D3 f( Z9 r9 R& s, t: j
Method seeking the 'magic number' 0F386h returned (in ax) by all system1 l) x: B' j4 ]# H6 o8 s0 L
debugger. It calls the int 41h, function 4Fh./ a+ W1 F* T. X  G2 b
There are several alternatives.  
2 n% `7 }2 ?  }  y# o3 v/ X/ `$ M& }& q" r1 |- l
The following one is the simplest:
" o- b% t, |" ~& V# D% \8 h) B) c; p4 o
    mov     ax,4fh
% b4 f1 b8 c6 n( U) y: M    int     41h# x) U- F3 h  {0 C
    cmp     ax, 0F3865 f$ g, G8 q; a. Z* B
    jz      SoftICE_detected; P2 B: _1 H" g
' q$ _3 S  J6 x! ^- U
5 R8 X( `4 ?" C% w5 Y
Next method as well as the following one are 2 examples from Stone's
' N* Q: q! m5 A, H"stn-wid.zip" (www.cracking.net):; Q2 E& u7 h7 Z

! [% g3 k( D* _, ]: A    mov     bx, cs9 p9 L8 t3 k3 k0 ]/ o& e
    lea     dx, int41handler28 k6 Z( D4 o# ]' k( N' g
    xchg    dx, es:[41h*4]! H0 N0 _. M) }# J; m0 U7 h+ `
    xchg    bx, es:[41h*4+2]. `9 Q3 i0 k0 J% e
    mov     ax,4fh+ F" U, v+ ^, }; Q  J
    int     41h
8 [! E0 f& ]4 A; z% ~* X' t5 z' {; D9 Z    xchg    dx, es:[41h*4]
" D( f1 M, g% D    xchg    bx, es:[41h*4+2]
" l: {$ ?, W( ]    cmp     ax, 0f386h' q4 u2 B' d( [2 n; F
    jz      SoftICE_detected
: `3 b+ [7 d; D) h7 g
' q) ^# L2 ~: [9 @int41handler2 PROC- y! n7 X' @2 T9 x
    iret) R/ i! q2 A# N! F8 |" Y/ c
int41handler2 ENDP
5 ?! h; I2 a  r3 u3 i& P, G: `& n
' J1 T: p6 s" u  h  \9 h' e; y) [2 V; ?: k& j# G
_________________________________________________________________________& @7 B! X/ U3 ^& j2 J

( c- v' M" G7 s- j2 T% r7 M! t/ l8 o6 D
" a; K0 L4 i! IMethod 067 m" B1 ^( X  X
=========
: T& ]* `$ |- M5 B" O, ?. _! |( w
2 C8 y# P$ i% O4 k3 [7 A- T* S
$ p4 w; R& m/ x7 E5 `2nd method similar to the preceding one but more difficult to detect:/ H7 G% T+ Z) p) \" W- K' F4 y9 ]
& k, _- p2 ?: X0 O3 @- R
; D4 @: |* y5 b8 k  L- x+ Y. T
int41handler PROC& b, v" s* Q( o- b
    mov     cl,al1 I" A. \0 B' S# Z* r+ F9 c, _
    iret5 E9 b: w1 r& o* L  y6 ]
int41handler ENDP
6 q) b% `; J# p: K' v" @/ V/ z) B
+ }. `" s$ u$ B6 e1 e! [, j3 k: e) d* d9 C: {! _
    xor     ax,ax; n; c! Y: b9 w0 m+ [* g
    mov     es,ax
- X2 ~5 W/ G8 V0 f5 d% B8 h    mov     bx, cs
- G( |  i$ D& t) D, J0 H8 ?    lea     dx, int41handler
' f0 m  R4 o3 z    xchg    dx, es:[41h*4]
1 s  j  K" ~; H8 L; b2 E* N, x    xchg    bx, es:[41h*4+2]
9 \& s4 [0 V$ J9 ]0 ?: t3 V) {, q    in      al, 40h
, b& y. w0 r! c# ]0 a, `    xor     cx,cx
8 t2 I) E( X2 k0 E) V. W    int     41h' ~+ h1 [+ [' W; L% K6 A( ~
    xchg    dx, es:[41h*4]
3 Q1 v- L( b0 W9 Y3 x) c    xchg    bx, es:[41h*4+2]( e2 g3 L: F5 M; r% M2 C  {
    cmp     cl,al% r! V$ ]1 u' d/ Y
    jnz     SoftICE_detected3 v- U! K. W+ d9 W% u+ n
, _* w3 S' y& N, |# ^
_________________________________________________________________________2 ~2 ?0 _  ?1 c2 L

4 M" a* g$ {! u$ ^# n: VMethod 07- B2 ?! v" Y( c$ |1 N; |" S- j4 \
=========3 t0 g  q8 ]( f( l
" n* |% L+ G$ Y' J
Method of detection of the WinICE handler in the int68h (V86)0 j6 D4 D( J5 d! i

) j; B$ ^% Y* T/ b# K% K    mov     ah,43h
8 h4 ]: j: h$ X) }7 J    int     68h0 F. j" @; l- o% l( e9 m5 j
    cmp     ax,0F386h
: G, E2 p/ Z4 n9 R$ n, ]4 L    jz      SoftICE_Detected( ?2 j* o5 ^# \7 s: c2 f; n
1 k1 [6 o  a: _+ `: O7 U/ y

% y4 \$ H5 H9 d. n, a! V=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit
. @4 I1 M4 [5 J8 ?3 X7 T; L   app like this:, M8 Q; w8 G* _% Z

7 O5 p( y7 A7 `: Y4 l1 [   BPX exec_int if ax==68
) f6 z0 g3 p- H: [$ t6 G: o3 e6 r   (function called is located at byte ptr [ebp+1Dh] and client eip is5 Z' ]* v6 K  R+ h& @2 f$ T3 B
   located at [ebp+48h] for 32Bit apps)
' I) V4 O* @4 z& m5 M( x__________________________________________________________________________
2 A0 m/ W& g4 O: I! F9 U; S- c3 _5 Z3 _2 |* Q5 T

! X7 K+ _0 B; T, M* kMethod 08
; r) P. L! C% i  G: A( C$ ?=========( b  r$ n0 _' f; k1 {

& m- ^0 p; E5 JIt is not a method of detection of SoftICE but a possibility to crash the; o; f/ w  N3 q6 W+ G& f, N0 X
system by intercepting int 01h and int 03h and redirecting them to another
. ?( S4 _% n& y* croutine.$ p2 ]9 y( w8 |$ n. a
It calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points; ^* \+ s* l/ }, z% z! O
to the new routine to execute (hangs computer...)
* R8 s" Z2 ]! z4 l  r# s7 f$ p" ]. d' x) o; X) A
    mov     ah, 25h
5 E. m3 c/ M0 [2 C4 {    mov     al, Int_Number (01h or 03h)
, A! A! a* T5 g9 I    mov     dx, offset New_Int_Routine: V' r4 z% ]' V0 D( v
    int     21h
8 }& d% M5 l' X4 x4 a% q0 s. J# J# ?5 J
__________________________________________________________________________' T9 Q. {/ R5 ?1 p
% K4 _6 s% I& r* L8 l: g! X
Method 09
6 |2 T5 F. K  J& M6 r5 q=========
$ X: E5 C" G. @" V4 V0 f$ |1 D# T$ ]
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
5 j, g% K7 x. k" \performed in ring0 (VxD or a ring3 app using the VxdCall).
; L& \  ^" n- u/ o: bThe Get_DDB service is used to determine whether or not a VxD is installed
: b- ?. X; z! d+ r  ^- ofor the specified device and returns a Device Description Block (in ecx) for
, n$ X! r5 r- B( `% V5 S" p6 d: q& othat device if it is installed.
5 O- Q9 n. u6 {2 U5 L# D
$ O5 [- y; M+ w   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID
; F0 z: ~0 ]* t4 g& Y& W   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
% }4 [' B  Y* _* T. A: U   VMMCall Get_DDB" c, F+ p1 }5 v7 S0 N
   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed1 j5 ~( m- u7 |

  L3 {; @" O) d$ I. LNote as well that you can easily detect this method with SoftICE:
$ ]4 I, v/ A9 @9 M; P1 y5 o( S   bpx Get_DDB if ax==0202 || ax==7a5fh' N& |0 Y. |6 c1 E3 r4 k: `1 E
% ^# P# U# X% d5 w0 x
__________________________________________________________________________. O( m( ?5 ]6 ]
) j: r5 y$ E1 T, E0 f" O4 G
Method 10
- p  x, A8 K* q' Q+ g=========
) Q  a' n4 l. S# j. ^- g8 d- C" m
, |( k! x2 j3 C1 R- n$ H8 n8 C=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with
$ Y' z1 k6 f- C5 a; e  SoftICE while the option is enable!!- B, |# i6 M6 v1 L$ W3 n; i
0 G& }7 `' l* U- D& T
This trick is very efficient:
$ m- r& ~: X* b/ ^! bby checking the Debug Registers, you can detect if SoftICE is loaded
7 z& h* Z7 C: J$ a; D- ]& _9 D(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if
, s3 M, x' }% Z! w% K# I, U6 M% qthere are some memory breakpoints set (dr0 to dr3) simply by reading their
% t. [% q$ m* w) }value (in ring0 only). Values can be manipulated and or changed as well
. E, b9 m. p' s% n, r(clearing BPMs for instance)
5 y( o$ r  e! ^8 r! _* M8 U5 ]" j4 t2 q2 J( y! u1 l; |$ b/ Z' f
__________________________________________________________________________
9 h/ f4 c3 Q& G1 R. w4 Q* n7 a1 e0 |( A- t  t: ]
Method 11" M, Y6 z: K* \: Q# ]
=========0 A4 T" O+ B2 S" R/ p' W9 S9 u( r
$ i. C. [7 {" ?( R
This method is most known as 'MeltICE' because it has been freely distributed% b; a3 x& u, W/ l
via www.winfiles.com. However it was first used by NuMega people to allow
2 w$ N! V  f3 D1 q7 t: l/ z4 B/ ?Symbol Loader to check if SoftICE was active or not (the code is located/ }+ N  \4 w/ f! L% h+ ]
inside nmtrans.dll).
5 E. J6 s- V1 X% L! e2 J2 x1 R1 l
# _' l1 H- v) eThe way it works is very simple:/ [" U( k% v" f! p, h) A" f" m9 N
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for# w0 G- G# }! ~( X  Z( k
WinNT) with the CreateFileA API.
$ X. V5 Y7 r, |7 R
! P7 e1 h% F0 V4 k0 RHere is a sample (checking for 'SICE'):) L5 g/ ]2 x' p6 n7 w1 Y

  r5 g7 V4 D3 s3 C  OBOOL IsSoftIce95Loaded()0 T6 T/ B! Z/ P( W
{
: A' x0 y, M. d3 k; g   HANDLE hFile;  * O! z' x+ [' }
   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,1 E* O/ l' D2 ^# h% ^9 ~& m/ W9 n
                      FILE_SHARE_READ | FILE_SHARE_WRITE,0 a% a( E2 C$ Z* Y8 f' a6 t
                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
* @9 V7 c! t% v" B4 h, i   if( hFile != INVALID_HANDLE_VALUE )
, Z( u* ^$ e8 p8 ~: B* g1 f( ^   {
1 `3 \) C$ l) t" Z  J      CloseHandle(hFile);! O/ G! O" \* ?; N  e$ i
      return TRUE;. m, [0 f. ^! Q% ?7 b, ]
   }& c5 {- ?( v( G1 }( i
   return FALSE;
6 e  ~* ?/ F' W2 o1 D}/ i8 m7 `! _1 l$ V7 q  n, D" w/ V

6 e+ M; Q, D& l5 H: {- t) MAlthough this trick calls the CreateFileA function, don't even expect to be* F8 S$ V. J* m# i6 C
able to intercept it by installing a IFS hook: it will not work, no way!) p8 w+ S' z5 A( ?+ J
In fact, after the call to CreateFileA it will get through VWIN32 0x001F
  @! f8 q8 \8 e$ k* C+ iservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)
0 \  T' A% U( N  e7 p" ~and then browse the DDB list until it find the VxD and its DDB_Control_Proc; c* }. g" `$ b- }7 z" S
field.1 {! X0 Q* a- M& j5 H
In fact, its purpose is not to load/unload VxDs but only to send a 2 \1 T; S! `  t. V+ P6 u
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)& h- ?8 q4 y2 _2 o: u. f
to the VxD Control_Dispatch proc (how the hell a shareware soft could try
( r$ U0 c  N4 }$ B7 v4 T- s' jto load/unload a non-dynamically loadable driver such as SoftICE ;-).! g" l) i3 q) p' z
If the VxD is loaded, it will always clear eax and the Carry flag to allow
' j2 x9 @/ J! Eits handle to be opened and then, will be detected.- S& @7 X+ Y; c
You can check that simply by hooking Winice.exe control proc entry point" s5 O- J4 F1 N; n- P1 h
while running MeltICE.7 t* q& D% I. J
, x! ^0 i: D# |, Q

+ [( ^# w" s% e% e- ]  ^4 K/ t+ Q+ _  00401067:  push      00402025    ; \\.\SICE7 s) {: I& b- i0 H! P' b& k+ B
  0040106C:  call      CreateFileA
6 `/ e. h7 y) \# A! a" x) }% \  00401071:  cmp       eax,-001. n" J# Z" R3 [' ~; {0 m% _# Q
  00401074:  je        004010918 m' [% X0 k  J" ^" x
8 _7 h9 T% }' e% b& b+ b
% s, X' f( u$ F. \5 J) R. z7 S7 C
There could be hundreds of BPX you could use to detect this trick.
0 E7 Z: k2 W! B2 N-The most classical one is:4 J4 n+ g9 O) s# s
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||5 ~+ h4 R) w: P6 u( J, D
    *(esp-&gt;4+4)=='NTIC'/ M3 p) o1 {* t! B) |7 g9 A6 R
3 i5 C. |! v% k' t% m3 s
-The most exotic ones (could be very slooooow :-(
; m/ K7 ]5 f% x9 E   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  9 N' M% }/ W4 l! O
     ;will break 3 times :-(
7 n! d: L7 z, N; l; E7 ?- }' X! S! h
-or (a bit) faster:
2 Y2 F0 g0 k6 ~7 b   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
" v3 ]" k% B; H; N  R2 ]5 `4 h+ f8 o2 i- x
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
, V7 B$ w8 H" e     ;will break 3 times :-(3 ~% I7 e0 R- [. W
5 Q9 C" d: w: D) t
-Much faster:& ~9 X; [& U8 J8 ^
   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV'! D/ l( T/ r. Q  W

+ ^9 ]0 Y( r$ I0 xNote also that some programs (like AZPR3.00) use de old 16-bit _lopen
( O4 [5 S7 z5 I) v/ s" j! jfunction to do the same job:
, V) V# G9 h2 I* N" s4 h7 G" L3 y& |! t0 N/ @" @5 Z7 V2 Q
   push    00                        ; OF_READ! @  g2 n5 O% t
   mov     eax,[00656634]            ; '\\.\SICE',0) r/ h- M- v! ~6 j
   push    eax
: U( F' y- L9 {  U   call    KERNEL32!_lopen$ T" \5 s; k: D9 f1 R0 S
   inc     eax  m1 p/ B+ ]3 Q5 F1 i6 s* q, b# }
   jnz     00650589                  ; detected! Y) B  s5 f, v0 L: V* n
   push    00                        ; OF_READ( |' w9 d* _1 }5 H3 I0 ~! }) n$ [0 ?% h
   mov     eax,[00656638]            ; '\\.\SICE'
0 a' t0 w) o6 f/ t+ I5 D' H& M   push    eax
3 i, L3 N6 Q! O6 s  `; ~   call    KERNEL32!_lopen
, [! s2 d. A+ b8 `! U6 f3 |, o   inc     eax9 M* L: _  B* J# e, i( u
   jz      006505ae                  ; not detected
) l& R$ }2 }' j/ A# c( e
$ l+ p- m0 x1 d. N/ ]
! i/ m4 h0 m. P__________________________________________________________________________- k" f# V3 S% e0 O  c1 M

, O  [  H# L$ |. m6 G7 vMethod 126 [6 H$ b: G- N! ^# n
=========
3 p3 O* {( d8 M9 A# I, q+ a5 b/ M. c
This trick is similar to int41h/4fh Debugger installation check (code 05
) \* \( @7 \* b3 m$ L2 s: y&amp; 06) but very limited because it's only available for Win95/98 (not NT)
' J* ^0 e, K# ^2 n( U4 xas it uses the VxDCall backdoor. This detection was found in Bleem Demo.
- I3 H& U6 I( [! ]% ?) Q* t, x& ^5 X# {0 T
   push  0000004fh         ; function 4fh6 J; [- ?8 w( U! e( I; Q7 A0 j
   push  002a002ah         ; high word specifies which VxD (VWIN32)
1 p" g) n5 E# m) T0 |+ j+ m5 _                           ; low word specifies which service
& S) p4 S8 n; N                             (VWIN32_Int41Dispatch)
( S- K7 `, s0 L7 V6 c! ^& M& f3 z- D: C   call  Kernel32!ORD_001  ; VxdCall; u' ?( Q1 o1 V6 X) W- C
   cmp   ax, 0f386h        ; magic number returned by system debuggers/ m4 J; J" ^) _; ^: p3 k4 k
   jz    SoftICE_detected( a0 Z3 ?" k/ [2 o0 X

* |( |' H7 U9 z& O; p. \Here again, several ways to detect it:2 x& R: j0 A* s6 {
* p7 Z! q+ ^6 C. f0 e
    BPINT 41 if ax==4f
. _1 A* ]: [. A& [+ F; h4 f) {4 q# J* t0 D
    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
  Z1 k0 I5 l% b2 d: |
+ \! Q1 ?6 k* H* Q  J    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A
9 f9 e% L" O: d# d
$ Y9 v9 o/ a3 e! M    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!. L6 X. T1 Z; C+ ]

1 t! o0 F6 l! k__________________________________________________________________________1 d- h, m4 I+ s7 x  {4 X
# g8 y* v$ n4 S  f6 d0 Y  \
Method 13
# i3 l  t# V3 L4 B& g9 |. G* f=========3 i' |# {' O. K2 c% p% Y" ]2 F

, b4 A' U4 P% j( YNot a real method of detection, but a good way to know if SoftICE is
6 {& z0 }" l, d$ A; Pinstalled on a computer and to locate its installation directory.
5 l! ]$ b& j) l' n$ q8 S3 z1 vIt is used by few softs which access the following registry keys (usually #2) :
7 l' b5 D* L' V; b5 P. t& q
3 D# I0 L5 G& F' K-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
8 S5 S( m4 J4 a\Uninstall\SoftICE8 u) p# w* L- o% r
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE
' {) k6 Y7 T+ y8 ?' J: q-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion- h/ f1 ?8 k6 b! w5 f1 k
\App Paths\Loader32.Exe, h+ N) I8 A! C, u
) G$ {$ I, V' J- C: J! O

) o# P7 _, j" Y! g2 }/ @/ gNote that some nasty apps could then erase all files from SoftICE directory6 L! |" r' _  B9 M
(I faced that once :-(6 @! Q4 r# X* F7 x5 U9 A; G" T4 m4 _& L
2 S) o! R( h% o* s) b" K4 t7 M; [
Useful breakpoint to detect it:3 ?' P% e* o) J) m0 o, r* _! X

7 w$ ]6 R; T  `, e     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'
+ ?' S1 |* @) {& {6 S
7 W% |: N, T4 K5 a6 k: {__________________________________________________________________________, j" `. y. J. @, `9 l' }6 }

2 x# x6 b! {' O: A
, a. v+ T7 ?2 p4 nMethod 14   S; V3 P4 z" e& }& C6 R) N
=========
* \5 v, Z+ c( H% D. t  K
$ q  R% U7 s& ]8 nA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
  N: [; o& p, `is to determines whether a debugger is running on your system (ring0 only).# U  w- q( X" e, {' V$ q
8 Z( A" C# `; s0 s) `$ o! p
   VMMCall Test_Debug_Installed
( \; _1 \) b- G. o   je      not_installed
( P6 [+ L2 H5 N% E! O' H) i* ^; \" D" o% [# n
This service just checks a flag.
! ]( W* X" |; `9 X1 [</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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