About anti-SoftICE tricks

[复制链接]
发表于 2008-9-28 16:34:50 | 显示全部楼层 |阅读模式
<TABLE width=500>
1 v; t  ?8 q9 I( W% y1 f<TBODY>+ D! {6 a4 X* \7 r+ H
<TR>6 y7 L0 O" s% w# |( B. X
<TD><PRE>Method 01
4 w3 r' Q* M' M$ @=========8 q: t! G3 i* q6 i5 Z

4 C9 q7 L7 w5 g4 _# |3 m& rThis method of detection of SoftICE (as well as the following one) is( q- M9 B8 S8 o2 \
used by the majority of packers/encryptors found on Internet.& j6 G! C3 m$ ?  ^$ U0 _
It seeks the signature of BoundsChecker in SoftICE* i4 V. {/ F) e1 `( B3 D  ]5 B  u
/ a7 V- s0 j  X! ~5 A
    mov     ebp, 04243484Bh        ; 'BCHK'
! P9 h. u! c  s    mov     ax, 04h+ i' A  `# Y8 ]0 c
    int     3      
# d0 }* v8 H5 v8 P- W+ C; G+ y    cmp     al,4
$ h# }5 t1 p  `( o% W    jnz     SoftICE_Detected
+ {! B: X) N1 J" k2 K2 g7 Y/ c9 b$ u8 l1 r' T" H
___________________________________________________________________________
/ Q! F) Q1 r$ p  \
, \# Q2 m" A& K( rMethod 02
; \; B7 s" T# `, i  a! z$ K=========4 [1 a0 R3 e) H9 x' ^2 K0 Z
, a  o1 P: H& L5 W' t# I" s  e, C
Still a method very much used (perhaps the most frequent one).  It is used
% z4 A/ u7 k  ]) B3 j# ]2 qto get SoftICE 'Back Door commands' which gives infos on Breakpoints,
! t. c" J5 \* k3 ~# E& F9 s+ C' cor execute SoftICE commands...
/ I( m) x: v& R& a2 JIt is also used to crash SoftICE and to force it to execute any commands
. l' B. P: Y$ ?8 ^(HBOOT...) :-((  
( D* Z: m9 D* f( n- m8 [$ K9 R! X- l$ ]& H( Z3 T7 J, A
Here is a quick description:" R8 ~  u5 D. ~- a1 u' G
-AX = 0910h   (Display string in SIce windows)# J6 t) F( `4 I9 E
-AX = 0911h   (Execute SIce commands -command is displayed is ds:dx)+ b( f4 ~: P! p) L' R' p1 e8 N
-AX = 0912h   (Get breakpoint infos)( X! N3 U6 h5 V
-AX = 0913h   (Set Sice breakpoints)$ b9 _( b4 e& i9 z
-AX = 0914h   (Remove SIce breakoints)
" Q1 c1 p* h, G; J; a0 j% i$ C. F0 {1 E+ A
Each time you'll meet this trick, you'll see:
; c! v. X  a; l; v* y" P* x" _4 |-SI = 4647h5 {' @- U5 g+ M3 w* d0 I
-DI = 4A4Dh. ~  I! t  n, Q" K  ?7 O
Which are the 'magic values' used by SoftIce.
& \+ H1 u: x: D( P2 p# wFor more informations, see "Ralf Brown Interrupt list" chapter int 03h.3 U! \2 B, z. F6 p* x
! u8 ^9 ]# j" L0 T/ ~
Here is one example from the file "Haspinst.exe" which is the dongle HASP
' F2 S! e: P- \& @, AEnvelope utility use to protect DOS applications:& F* I6 }' j5 S. p3 j+ I
( [" j5 K$ y' H. v5 e

, z) M7 G! G4 {0 e9 @4C19:0095   MOV    AX,0911  ; execute command.
7 y* N* _6 B* O9 _; Z% {2 n# T4C19:0098   MOV    DX,[BX]  ; ds:dx point to the command (see below).
, E8 p. v  j$ V* K0 R4 ^5 Q3 \( s1 t4C19:009A   MOV    SI,4647  ; 1st magic value.
. a: n$ n) L, C" x6 o1 Z0 `$ ?4C19:009D   MOV    DI,4A4D  ; 2nd magic value.
+ T, D4 K+ m1 f2 ^! q4C19:00A0   INT    3        ; Int call.(if SIce is not loaded, jmp to 00AD*), K' i, _0 Z& {+ o/ O4 v" P
4C19:00A1   ADD    BX,02    ; BX+2 to point to next command to execute  S# S& b% }: t" ^/ a
4C19:00A4   INC    CX3 P$ b) r) j; }
4C19:00A5   CMP    CX,06    ; Repeat 6 times  to execute; l# A! x/ C% j4 k( {
4C19:00A8   JB     0095     ; 6 different commands.: @) Y# C3 S) I' R2 X$ c
4C19:00AA   JMP    0002     ; Bad_Guy jmp back.
- y0 A' R4 |7 F) A5 Q4C19:00AD   MOV    BX,SP    ; Good_Guy go ahead :)
6 y, V" G! }/ d9 X* v- d( F( j: b; a* ?$ \; Q7 w8 H
The program will execute 6 different SIce commands located at ds:dx, which. {& B' r- k3 t% k2 o# d
are: LDT, IDT, GDT, TSS, RS, and ...HBOOT.+ x; H& g/ V) m/ F' Q

- ?4 m# i, E) U* the "jmp to 00ADh" is performed via an SEH if the debugger is not loaded.
% k/ I6 i% r5 U___________________________________________________________________________
; {4 `1 k0 J& u+ ?  n) @  x! B0 z8 N: ^
% a+ l% z/ K/ a7 e5 `7 b, O( ], {0 p: |" x& m( H
Method 03' b. R$ ]$ ~: ^) R
=========6 c1 O* U5 B/ x( G
0 o" u5 }. \2 i2 r
Less used method.  It seeks the ID of SoftICE VxD via the int 2Fh/1684h  z  q- l/ N) J# z
(API Get entry point)
* B. f5 {4 _. q+ a& o        " w0 {+ _; ?/ L. p& Z# c8 }

2 N/ N+ [2 a* D, g, _    xor     di,di3 M6 `( I+ F8 E& _. i4 M
    mov     es,di1 s6 R" E$ Q+ I
    mov     ax, 1684h       " q5 t6 W  R+ t2 \3 _
    mov     bx, 0202h       ; VxD ID of winice- Y" F$ X: c" `7 M9 p! t
    int     2Fh
% F+ D+ Z( I5 T8 a* [    mov     ax, es          ; ES:DI -&gt; VxD API entry point
' P( e) w2 K" m4 }    add     ax, di
2 X" D0 S2 }2 k% g    test    ax,ax
1 x% P' o( c0 P+ D    jnz     SoftICE_Detected" A* k, O4 c" y0 r
% @+ c! c) i" J
___________________________________________________________________________
$ `' O- v; W, [: e! e; \7 V# q  d8 ~; |9 G0 W+ \0 q8 V+ g
Method 04
5 m& E# c& Q" ]! u; p6 ]2 }=========
* b# u! j) k: j" U9 ~. [+ C
) @0 l% x/ Z9 T. i0 f6 }Method identical to the preceding one except that it seeks the ID of SoftICE: P) Q) \5 ~9 O( s# f
GFX VxD.
0 D& B3 j( g9 F/ `  m2 G, _& h* L+ r
$ a% D/ c- _' \- l* k    xor     di,di
- i! i; t, v9 T! N0 i) {- Q3 n    mov     es,di
8 C6 c$ G& B* L    mov     ax, 1684h      
1 x1 R: s3 c* M( P% {9 D    mov     bx, 7a5Fh       ; VxD ID of SIWVID
! n# p1 j- Q! n5 U. v7 b    int     2fh
* J% w- \' H9 O" e    mov     ax, es          ; ES:DI -&gt; VxD API entry point
% [6 R- h. u7 B    add     ax, di
6 c3 u& g7 j: ]- N- @5 l$ j    test    ax,ax
9 K) Y- ^3 H8 u) S) G    jnz     SoftICE_Detected- @) M% q3 F3 I

( m: G9 ~+ N& R5 E- B+ Y! ~__________________________________________________________________________" b0 ?8 R( R$ Q

; v% d9 M! B9 [  K
" Q3 R! J; L7 M) wMethod 05
% j+ _; G& N1 Y6 |8 v% ]=========/ Z, }; [, D+ O! ~" E1 E' L4 B

6 y1 _: u2 M1 bMethod seeking the 'magic number' 0F386h returned (in ax) by all system+ `5 }8 v! g" p6 {! `  \+ u' Z, a
debugger. It calls the int 41h, function 4Fh.
+ y- j) N+ N* }2 j% x- BThere are several alternatives.  5 n9 a! ]5 P( h% a
1 e$ |5 Y7 Z. o; D3 A  Y
The following one is the simplest:
' h8 ]' i+ H& ?$ a! ?/ X' c' n' t4 J+ Y9 ~2 s
    mov     ax,4fh
/ `- n1 L5 ^- w0 p, H  F6 }5 ]% K( K    int     41h
  w& D/ Q+ M: a- I4 g9 ]    cmp     ax, 0F386
: H& m0 V. A4 r# T: u& g    jz      SoftICE_detected
2 J* e5 U/ n7 B! c6 R2 y/ G1 t
( ~. t  g0 U+ S. C& }5 x  y8 ?4 o2 u! w
Next method as well as the following one are 2 examples from Stone's / @% u* q+ X, z1 u; E
"stn-wid.zip" (www.cracking.net):" X0 m; Y% |+ Q) ^# Q' C) z
+ H$ e  Y9 C( x" P
    mov     bx, cs1 R; J5 G: v9 c! r8 K4 }
    lea     dx, int41handler2  J  T. D0 T) U
    xchg    dx, es:[41h*4]
; g9 g' B4 ^( c% H: i, i$ ~    xchg    bx, es:[41h*4+2]
: a- B! V' S! J* h/ D6 {    mov     ax,4fh  f7 {* Y8 q! t# r0 Y' U
    int     41h
* @! c/ l6 w. V2 d# [! b" R    xchg    dx, es:[41h*4]
0 v( m4 O" T" T! L# \) B9 ?    xchg    bx, es:[41h*4+2]
# v! k6 |$ N3 f! n1 F& f    cmp     ax, 0f386h. V9 O4 y2 e1 `# q9 r' W8 c8 t  B
    jz      SoftICE_detected
; z" l# b% W; P- f) Y4 k: ^. u! g, k# v9 q2 Z% x
int41handler2 PROC! ^; S* l% X" E- f( f* w
    iret
' }( o- Y* F5 ~1 K+ qint41handler2 ENDP# ^! {* k! [7 k, F3 ]$ \" O
& J1 Z$ x! }* W

2 E  _1 Q6 Y$ }" T5 i! {_________________________________________________________________________
# @0 `- P* f: S4 N. i8 B4 W1 ]" z) e$ G8 `' m$ _9 Y& c! \1 A
7 h$ g5 D  J8 |% o
Method 06! @! N) m- A7 ~/ J" r) z
=========
" f4 W( K5 J- b5 C3 Q. P0 n
  g7 S6 L6 c/ t5 o4 X# J) B# j- ]0 _! f
2nd method similar to the preceding one but more difficult to detect:
6 |: i5 h1 n( K! |# S" N: |: m/ W6 _% m8 x6 E% I' e

$ K9 z  U' K& A! `+ Zint41handler PROC
$ A5 k' o( v3 A  q) ?4 B4 w3 s7 z    mov     cl,al
. n1 A# }5 j0 F8 |    iret
2 O2 i4 P. Z' V8 y* A* xint41handler ENDP4 D6 ]- ~; p1 U# T+ |0 m& ]

) J) e/ A* ?7 ?; u+ G8 j  G
: b: P+ w5 z$ |) `3 _2 r# s& n  f7 I    xor     ax,ax
. }' c5 _" O( J! j- K  v    mov     es,ax
. d& j/ z+ T' P2 f    mov     bx, cs7 X7 n! b0 r5 n' Y, a
    lea     dx, int41handler' \% ^7 c8 b8 |6 V
    xchg    dx, es:[41h*4]
  t1 c8 g2 n: y$ S2 @" b$ _8 |# }; N5 T    xchg    bx, es:[41h*4+2]
+ t( W* U" E3 {" {/ Y1 `# a( `" {    in      al, 40h
$ W6 j5 Q$ D% H  }' t# e- B9 J2 U    xor     cx,cx
( w9 R; R9 a7 ]. k/ r    int     41h# j& \; T! G! c7 w4 R
    xchg    dx, es:[41h*4]
! n8 N" Q" Q8 h' l2 ~' n1 Z1 x    xchg    bx, es:[41h*4+2]  `$ ?' v  G% k) J
    cmp     cl,al& M! R6 Y( I, L% v
    jnz     SoftICE_detected) O& W5 {2 D, L0 ]1 \9 D
% g3 V* a% {; M# E1 G
_________________________________________________________________________
2 ^0 o9 ]3 z7 M! v! y- k3 E6 o* X( R/ d
Method 07
+ r+ D$ J( U' `=========0 m: d2 S, n) K
/ N) A& r- ?% U3 k+ c% j4 Z. n
Method of detection of the WinICE handler in the int68h (V86)
( p  a+ s8 [7 _4 z% t1 @) u, H
, @# k* O* x% }: Y: {    mov     ah,43h: i7 d$ K+ w% E' |
    int     68h$ J4 P. z# [8 ~2 D& m6 n  k
    cmp     ax,0F386h
  w9 ?  O0 ?& k1 I9 A    jz      SoftICE_Detected
8 @. }9 z/ Q. s+ |3 A  z: T. O' t+ T5 j7 c2 U

* A" d% Z8 t- R5 c=&gt; it is not possible to set a BPINT 68 with softice but you can hook a 32Bit& o* Q' K2 D$ S1 Z2 M9 k1 \+ ~% S
   app like this:3 o1 x" y5 C2 `- A5 @; {) i0 W5 G
3 x% d" ]' C1 h) q6 v: b
   BPX exec_int if ax==68
) @4 b4 ~3 |* H) i   (function called is located at byte ptr [ebp+1Dh] and client eip is
/ H: P. \7 w$ Q( H8 y   located at [ebp+48h] for 32Bit apps)
5 o3 d  }7 ~! n  J__________________________________________________________________________7 ]6 v! L' _! C: g6 ^0 [7 l8 _

: k/ A5 Y$ d, Z" J* F8 E
# ~( [4 n/ R; v9 s# n( L  }9 MMethod 08' h7 c0 L* r. N$ `# e7 i: e/ b8 H
=========
9 M- E1 o' R8 G7 R
; u& ?& K6 [8 t, A  y1 W; t0 HIt is not a method of detection of SoftICE but a possibility to crash the
: S5 T0 m; N0 r' w/ hsystem by intercepting int 01h and int 03h and redirecting them to another1 A7 z  u" Y! ]" L) P4 B
routine.
  ?4 h9 a- q  ^1 FIt calls int 21h functions 25h and 35h (set/get int vector) and ds:dx points
% W/ s5 a- n& ~* Kto the new routine to execute (hangs computer...)' h* x7 |1 P- v2 S
3 b- ^- L1 K; C, c- f
    mov     ah, 25h- u$ Z% e- g$ e6 H) w* Y/ n
    mov     al, Int_Number (01h or 03h): N, e. \' T/ `
    mov     dx, offset New_Int_Routine
9 `+ B7 N0 G0 P4 }    int     21h
9 C& C7 \: _; `
1 u* ?* \9 G( T__________________________________________________________________________
* J3 Q' d. z6 M) K4 t1 A/ ]8 u  ^& e
Method 09
- a1 l0 D& w+ i" a=========
. o0 Q/ v* J6 l* T4 H; d* `2 l1 b" \* w( Y. I9 C
This method is closed to methods 03 and 04 (int 2Fh/1684h) but it is only
& X+ L0 T% F* J2 n7 _performed in ring0 (VxD or a ring3 app using the VxdCall).
4 \8 u1 y' d& W5 E' M0 T3 T: xThe Get_DDB service is used to determine whether or not a VxD is installed! y6 \3 P/ ~2 E% u' L/ I
for the specified device and returns a Device Description Block (in ecx) for
! g3 p3 k& z6 p1 D8 X; o6 I5 uthat device if it is installed.
- T5 C) t* J9 r; ~( l5 \
( l8 W+ U  [, p; n, g1 r  p   mov     eax, Device_ID   ; 202h for SICE or 7a5Fh for SIWVID VxD ID1 a: n4 E2 ]6 a6 M+ O. _. h
   mov     edi, Device_Name ; only used if no VxD ID (useless in our case ;-)
9 b" B+ H: C6 d& g  r; Z. x% y   VMMCall Get_DDB
3 C3 ?# E0 ?1 d( ^1 N' v: _   mov     [DDB], ecx       ; ecx=DDB or 0 if the VxD is not installed$ o5 }/ g8 E. ^  l$ l! i

0 d' h3 m; C1 E/ XNote as well that you can easily detect this method with SoftICE:. S+ s5 _0 v. S# T4 l$ j, x( [, i
   bpx Get_DDB if ax==0202 || ax==7a5fh2 G" s8 S* Q8 Q5 J* P4 ]

, a  `1 T  {5 f6 e__________________________________________________________________________% `$ ]# W2 b' R, A/ L! q5 j

( w* M; I9 ]/ ?6 ]! `7 I! c; xMethod 106 j6 ~9 ]% R- _
=========. G, z$ o, G5 G- L, N# u. S2 [- C! X

- |0 \7 ], F/ j! M) y# J=&gt;Disable or clear breakpoints before using this feature. DO NOT trace with: o7 M4 d" ?9 E2 d5 ~* A9 Q. U
  SoftICE while the option is enable!!* J! U3 y, K% P5 W6 b! {

8 J5 |. m7 a% b( {This trick is very efficient:! K$ E+ ?" }' w" T
by checking the Debug Registers, you can detect if SoftICE is loaded
4 F7 L9 |! y2 {8 F(dr7=0x700 if you loaded the soft with SoftICE loader, 0x400 otherwise) or if0 e' N, }* p' l( c, i4 t7 k, y
there are some memory breakpoints set (dr0 to dr3) simply by reading their: w/ @  K+ o5 f/ a5 z/ _8 T
value (in ring0 only). Values can be manipulated and or changed as well
- s* H; R$ p- d4 D(clearing BPMs for instance)! B3 D2 K5 p! a! H  V. h& n

: U1 q7 S; ~# Q5 E% J( j__________________________________________________________________________
6 w. d; k- r5 c- ?1 q& e! Y) O. o5 @8 {5 X5 Q
Method 11
; C" c( x8 W1 _6 b% r8 A: ?=========# n, _  n, x3 O$ K

9 Y8 M  h* h7 f# F0 h! j2 v; s7 W7 LThis method is most known as 'MeltICE' because it has been freely distributed4 ]3 S0 M5 B* d: H
via www.winfiles.com. However it was first used by NuMega people to allow
- m- Q! }, m+ s6 I4 ZSymbol Loader to check if SoftICE was active or not (the code is located
$ n7 W& G' C. L# d; d# binside nmtrans.dll)./ ?8 w9 U1 e( ^0 D5 S' ]
% s$ `$ Z7 t1 d$ u5 b
The way it works is very simple:4 I( X9 g+ f- ~( ]4 H& ^. N
It tries to open SoftICE drivers handles (SICE, SIWVID for Win9x, NTICE for
- ^! @$ e+ q* R* ^9 a  ?WinNT) with the CreateFileA API.* T2 u2 u9 j3 O. H6 a
) J5 Z; ]+ c$ V, E& B  E; x/ I
Here is a sample (checking for 'SICE'):
4 B) t2 _; a& @/ J
. B  k4 Z" j& m& v: LBOOL IsSoftIce95Loaded()  Q6 g8 i8 _; a
{+ j! k& a% I( g8 S
   HANDLE hFile;  
3 w4 O6 m* f0 L! P% m7 ~   hFile = CreateFile( "\\\\.\\SICE", GENERIC_READ | GENERIC_WRITE,& R  s& _% D7 C
                      FILE_SHARE_READ | FILE_SHARE_WRITE,
/ n( N% m8 K3 Z1 F  j                      NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
6 l. E+ k- N& Y- y0 M   if( hFile != INVALID_HANDLE_VALUE )
7 N# @3 W3 _& o8 ~; S! R   {4 y0 s4 N: P' j9 E+ }4 i
      CloseHandle(hFile);' u0 ~. K2 u1 ~  x
      return TRUE;
* U2 x9 j/ x8 l4 F   }
" x4 |# T6 z9 Y% J/ f' G" G   return FALSE;9 U: C' x- T+ `# Z
}
( w% c: N; n+ i- N. ~, K7 Q* L+ d0 R& V" b7 s
Although this trick calls the CreateFileA function, don't even expect to be0 N. }- i: A* p& ~- i
able to intercept it by installing a IFS hook: it will not work, no way!" }. @0 J& ~3 C  r& o; t; x
In fact, after the call to CreateFileA it will get through VWIN32 0x001F
5 b3 p$ _* S" P# f: Z3 {+ z' qservice _VWIN32_ReleaseWin32Mutex (via Kernel32!ORD_0001/VxDCall function)! @4 }& M7 b- n7 L% ~! ?" T
and then browse the DDB list until it find the VxD and its DDB_Control_Proc6 P" e2 N8 j! b4 a  O
field.
2 J: n" Q$ V+ ~6 l7 K+ C. g, S7 zIn fact, its purpose is not to load/unload VxDs but only to send a 0 a  T4 s/ z. W6 r4 {8 A1 C- B
W32_DEVICEIOCONTROL (0x23) control message (DIOC_OPEN and DIOC_CLOSEHANDLE)# Y, t4 D: l* \% J+ |2 g$ e
to the VxD Control_Dispatch proc (how the hell a shareware soft could try
" U( s# f1 l/ y( e' B- gto load/unload a non-dynamically loadable driver such as SoftICE ;-).
! y- d- V" j& q9 w. T; g& C: U$ tIf the VxD is loaded, it will always clear eax and the Carry flag to allow# A! c4 b2 ]/ X% {2 Y
its handle to be opened and then, will be detected.+ J3 a0 K) ?2 r$ @* W% k
You can check that simply by hooking Winice.exe control proc entry point- W+ U# n/ ]: E* r
while running MeltICE., w  \0 Y: D. T8 }

& B0 G$ [4 I7 S5 w4 G6 F
0 D2 ?+ Y3 r' r  00401067:  push      00402025    ; \\.\SICE
9 Q% c& J' E2 ^6 f0 K# v  0040106C:  call      CreateFileA4 B, Q1 D6 g; j
  00401071:  cmp       eax,-001- z$ \$ o# ?6 g& J2 M+ ^- a- `1 z% Z0 B
  00401074:  je        00401091  m7 b+ h$ g" B) e
7 h. d" }1 o  }! R$ N& ?( D

! H: B1 R( x+ p9 @, i& b7 VThere could be hundreds of BPX you could use to detect this trick.
# j; n( \0 G( H, Y0 q7 i-The most classical one is:; a& s! n* P& W8 |
  BPX CreateFileA if *(esp-&gt;4+4)=='SICE' || *(esp-&gt;4+4)=='SIWV' ||
. d' w1 l5 o" C, ~    *(esp-&gt;4+4)=='NTIC'' u: P3 j( X' j6 v2 n6 W) [
* M- Z2 G# \* S7 z$ v3 \! J
-The most exotic ones (could be very slooooow :-(
. ?+ w% k  @0 v( u+ [   BPINT 30 if eax==002A001F &amp;&amp; (*edi=='SICE' || *edi=='SIWV')  
  t2 a' h9 ^0 Q0 \( u     ;will break 3 times :-(5 B; q" N& b- B+ v
4 N" |2 p  X. O! \1 ?
-or (a bit) faster:
! C. u$ Z7 U' I5 K% c   BPINT 30 if (*edi=='SICE' || *edi=='SIWV')
; y( L+ \! i7 ^5 R3 [$ \  i! X6 A
   BPX KERNEL32!ORD_0001 if *edi=='SICE' || *edi=='SIWV'  
( q  J* `) F  v% C     ;will break 3 times :-(
$ l$ M# e  ^. D3 n
" P$ z% S/ W0 w5 ?) q-Much faster:
& R# c4 C5 g* D   BPX VMM_GetDDBList if eax-&gt;3=='SICE' || eax-&gt;3=='SIWV', @6 r8 j4 _8 D, K2 V

# j$ J* v+ t# M3 O; g6 t1 lNote also that some programs (like AZPR3.00) use de old 16-bit _lopen& F& N+ m  A& b: o
function to do the same job:: H4 Z8 o  d, d. d) V( U5 t4 y
. T$ }, S0 S2 w8 b
   push    00                        ; OF_READ
* w" `! G' J0 J: w. G   mov     eax,[00656634]            ; '\\.\SICE',0' S$ k/ ]0 ~  }  _6 u' o* q$ }( g5 H
   push    eax
+ E* I, q7 g& i( A/ A   call    KERNEL32!_lopen( E- ?8 v% X; v8 A
   inc     eax' h" n  o1 f2 n5 \# d
   jnz     00650589                  ; detected! H, `8 _' @7 v
   push    00                        ; OF_READ
/ r* F& S  k8 W2 A7 S( |   mov     eax,[00656638]            ; '\\.\SICE'# o, q, R# p; H& {* m
   push    eax# Y+ o* M  J: [# w9 H, H; P7 y
   call    KERNEL32!_lopen
  W8 f6 ?5 Z& J' f0 g$ h8 a' N   inc     eax+ `2 \! r* ?- A" H, ^! v
   jz      006505ae                  ; not detected7 Q4 x  h+ `0 s( E
. p9 a0 J* |* u9 V( B- n7 J

7 k% D. j8 B. e8 [* g__________________________________________________________________________  p8 P! z' p& L& e

+ Q* z  w1 X- g% C  R& iMethod 12
0 G5 l/ L( F  n) H8 b/ S=========
1 Q. @5 ?& v% H) [7 }! V9 ?, G8 u; q* h- v+ M0 F
This trick is similar to int41h/4fh Debugger installation check (code 05
% w+ a/ d7 Z  Z4 i1 }&amp; 06) but very limited because it's only available for Win95/98 (not NT), }2 E  I! z' c3 u9 ]) a
as it uses the VxDCall backdoor. This detection was found in Bleem Demo.
3 o4 H6 u+ ]' I& a( u) Q8 T6 I6 c6 b5 I+ }5 E5 g( a
   push  0000004fh         ; function 4fh
$ ]/ ]+ y  P) R$ T* w   push  002a002ah         ; high word specifies which VxD (VWIN32)
2 M! i  [* h5 Z; T8 }# ]                           ; low word specifies which service
; m  B1 E; L4 {9 K) B4 F" |                             (VWIN32_Int41Dispatch). O" c* v4 U0 ~" ?8 Z( c, n
   call  Kernel32!ORD_001  ; VxdCall
+ C/ J6 U" x6 C   cmp   ax, 0f386h        ; magic number returned by system debuggers4 `1 Q8 T/ e0 L
   jz    SoftICE_detected% c: E3 X/ M" h8 U
: [: C9 ^* r: E
Here again, several ways to detect it:' c9 L8 \5 U, }! f8 L
2 h8 I6 C0 N2 U" H
    BPINT 41 if ax==4f
% _, v/ F6 e' c( {* ^* T
, O, G* J4 Q& [: T    BPINT 30 if ax==0xF386   ; SoftICE must be loaded for this one
/ r) h- v# B) T  Q" X4 ~4 V' |: K& \- e$ h+ X/ W
    BPX Exec_PM_Int if eax==41 &amp;&amp; edx-&gt;1c==4f &amp;&amp; edx-&gt;10==002A002A. _" }8 G. S0 M% u

7 M" o& @! O4 ?3 C& P  ~    BPX Kernel32!ord_0001 if esp-&gt;4==002A002A &amp;&amp; esp-&gt;8==4f   ; slooooow!
2 R# \  o# D5 b, ]8 b, j1 ~
) k9 W7 Z1 u  F4 x2 E; G; }! c__________________________________________________________________________
1 _2 u6 a" F0 R2 x; v3 b+ S- E, w& t5 e9 F9 D8 V$ ^, x) w4 a, V
Method 13
: g4 T/ \  L! t8 g, P9 |1 x=========2 L7 [( c0 p  f

& R! h1 K+ Z- t" A3 ^/ f0 ENot a real method of detection, but a good way to know if SoftICE is/ V, N  k* A. {" Y
installed on a computer and to locate its installation directory.
3 J; R3 S6 g; s8 f' C$ }& q, uIt is used by few softs which access the following registry keys (usually #2) :
# j$ J$ h8 W; Y/ j
/ e$ K$ ^  L$ }) Z( e' Z( w-#1: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
: A9 z% c7 ~% }: F2 [* @" J\Uninstall\SoftICE& x; b/ N7 Q! D3 f
-#2: HKEY_LOCAL_MACHINE\Software\NuMega\SoftICE5 {' D# z) O8 y7 I
-#3: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion
% |) b$ F# L" u: h6 K* p\App Paths\Loader32.Exe) P" \/ K5 p% \8 V0 }3 J8 {8 y8 @

+ E% P% g+ ]1 k/ M4 N9 E
9 J8 O- e- L' @0 N$ nNote that some nasty apps could then erase all files from SoftICE directory8 [7 a% d# O- f
(I faced that once :-(
6 B& j9 ?' N* k5 f
; \  r9 H9 p7 c+ t1 l# v6 |* c" W; ~Useful breakpoint to detect it:
/ [$ N, ?; v; N$ `& z) j2 C% l2 Z' `5 d2 d# z0 ^+ ~- B
     BPX _regopenkey if *(esp-&gt;8+0x13)=='tICE' || *(esp-&gt;8+0x37)=='tICE'. [/ R9 Q& J: B
# u$ }. h5 b1 l1 Z7 c/ N' @
__________________________________________________________________________" l; G1 M3 c8 f' h" c) o

( T3 S+ {$ Q! s$ _
$ O- A$ W. X" H: `1 `Method 14
- e* c8 h$ F( G6 x' ]- X+ s" l=========
( `9 W$ e1 K* A1 |# ]1 \
" k7 W. b& r: _# M1 tA call to VMM 'Test_Debug_Installed' service. As the name says, its purpose
4 {+ S% ~6 U+ kis to determines whether a debugger is running on your system (ring0 only).
; ?! L5 d2 M2 n7 b# }5 g6 N' S
9 v( F3 ^8 [) D8 M8 J   VMMCall Test_Debug_Installed1 j( d9 C! `$ W5 m* g3 v3 W
   je      not_installed2 q( B5 m) _$ T' z

, T3 E. Q7 V- K0 V! [% ^: x. n$ OThis service just checks a flag.
/ \. P* _4 L* q7 I' j0 A</PRE></TD></TR></TBODY></TABLE>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号

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

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

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